Cleanup
This commit is contained in:
parent
2c712bd1c0
commit
a6ea69bad0
|
@ -15,19 +15,15 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.HtmlHelper
|
||||
import info.nightscout.androidaps.utils.plusAssign
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.loop_fragment.*
|
||||
|
||||
class LoopFragment : Fragment() {
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.loop_fragment, container, false)
|
||||
|
|
|
@ -15,9 +15,9 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.utils.plusAssign
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.openapsama_fragment.*
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
|
@ -27,10 +27,6 @@ class OpenAPSAMAFragment : Fragment() {
|
|||
private val log = LoggerFactory.getLogger(L.APS)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.openapsama_fragment, container, false)
|
||||
|
|
|
@ -13,9 +13,9 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.utils.plusAssign
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.openapsama_fragment.*
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
|
@ -23,10 +23,6 @@ class OpenAPSMAFragment : Fragment() {
|
|||
private val log = LoggerFactory.getLogger(L.APS)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.openapsma_fragment, container, false)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package info.nightscout.androidaps.plugins.aps.openAPSSMB
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import android.text.TextUtils
|
||||
import android.view.LayoutInflater
|
||||
|
@ -15,9 +16,9 @@ import info.nightscout.androidaps.plugins.bus.RxBus
|
|||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.JSONFormatter
|
||||
import info.nightscout.androidaps.utils.plusAssign
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.openapsama_fragment.*
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
|
@ -27,10 +28,6 @@ class OpenAPSSMBFragment : Fragment() {
|
|||
private val log = LoggerFactory.getLogger(L.APS)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.openapsama_fragment, container, false)
|
||||
|
@ -85,6 +82,7 @@ class OpenAPSSMBFragment : Fragment() {
|
|||
openapsma_iobdata.text = TextUtils.concat(String.format(MainApp.gs(R.string.array_of_elements), iobArray.length()) + "\n", JSONFormatter.format(iobArray.getString(0)))
|
||||
} catch (e: JSONException) {
|
||||
log.error("Unhandled exception", e)
|
||||
@SuppressLint("SetTextl18n")
|
||||
openapsma_iobdata.text = "JSONException see log for details"
|
||||
}
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ import info.nightscout.androidaps.plugins.general.automation.dialogs.EditEventDi
|
|||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationDataChanged
|
||||
import info.nightscout.androidaps.plugins.general.automation.events.EventAutomationUpdateGui
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.plusAssign
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.automation_fragment.*
|
||||
|
||||
class AutomationFragment : Fragment() {
|
||||
|
@ -22,10 +22,6 @@ class AutomationFragment : Fragment() {
|
|||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
private var eventListAdapter: EventListAdapter? = null
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.automation_fragment, container, false)
|
||||
}
|
||||
|
|
|
@ -21,12 +21,8 @@ import info.nightscout.androidaps.plugins.general.automation.triggers.*
|
|||
import info.nightscout.androidaps.plugins.iob.iobCobCalculator.events.EventAutosensCalculationFinished
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.services.LocationService
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.SP
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONException
|
||||
|
@ -60,10 +56,6 @@ object AutomationPlugin : PluginBase(PluginDescription()
|
|||
}
|
||||
}
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
val context = MainApp.instance().applicationContext
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
|
||||
|
@ -131,6 +123,7 @@ object AutomationPlugin : PluginBase(PluginDescription()
|
|||
loopHandler.removeCallbacks(refreshLoop)
|
||||
val context = MainApp.instance().applicationContext
|
||||
context.stopService(Intent(context, LocationService::class.java))
|
||||
super.onStop()
|
||||
}
|
||||
|
||||
private fun storeToSP() {
|
||||
|
|
|
@ -113,6 +113,7 @@ public class NSClientPlugin extends PluginBase {
|
|||
context.unbindService(mConnection);
|
||||
|
||||
nsClientReceiverDelegate.unregisterReceivers();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -71,6 +71,7 @@ public class OverviewPlugin extends PluginBase {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -113,6 +113,7 @@ public class PersistentNotificationPlugin extends PluginBase {
|
|||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
MainApp.instance().stopService(new Intent(MainApp.instance(), DummyService.class));
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private void triggerNotificationUpdate() {
|
||||
|
|
|
@ -98,6 +98,7 @@ public class SmsCommunicatorPlugin extends PluginBase {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -16,17 +16,12 @@ import info.nightscout.androidaps.utils.FabricPrivacy
|
|||
import info.nightscout.androidaps.utils.SP
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.tidepool_fragment.*
|
||||
|
||||
class TidepoolFragment : Fragment() {
|
||||
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? {
|
||||
return inflater.inflate(R.layout.tidepool_fragment, container, false)
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package info.nightscout.androidaps.plugins.general.tidepool
|
||||
|
||||
import android.text.Html
|
||||
import android.text.Spanned
|
||||
import info.nightscout.androidaps.Constants
|
||||
import info.nightscout.androidaps.MainApp
|
||||
|
@ -23,7 +22,6 @@ import info.nightscout.androidaps.receivers.ChargingStateReceiver
|
|||
import info.nightscout.androidaps.receivers.NetworkChangeReceiver
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import io.reactivex.schedulers.Schedulers
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.util.*
|
||||
|
@ -43,10 +41,6 @@ object TidepoolPlugin : PluginBase(PluginDescription()
|
|||
private val listLog = ArrayList<EventTidepoolStatus>()
|
||||
var textLog: Spanned = HtmlHelper.fromHtml("")
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
super.onStart()
|
||||
disposable += RxBus
|
||||
|
|
|
@ -91,6 +91,7 @@ public class WearPlugin extends PluginBase {
|
|||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
disposable.clear();
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private void sendDataToWatch(boolean status, boolean basals, boolean bgValue) {
|
||||
|
|
|
@ -65,6 +65,7 @@ public class NSProfilePlugin extends PluginBase implements ProfileInterface {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public void handleNewData(Intent intent) {
|
||||
|
|
|
@ -100,6 +100,7 @@ public abstract class PumpPluginAbstract extends PluginBase implements PumpInter
|
|||
serviceRunning = false;
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -27,13 +27,9 @@ import info.nightscout.androidaps.plugins.pump.danaRKorean.DanaRKoreanPlugin
|
|||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.plugins.treatments.fragments.ProfileViewerDialog
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.SetWarnColor
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.danar_fragment.*
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
|
@ -41,10 +37,6 @@ class DanaRFragment : Fragment() {
|
|||
private val log = LoggerFactory.getLogger(L.PUMP)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
private val loopHandler = Handler()
|
||||
private lateinit var refreshLoop: Runnable
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ public class DanaRPlugin extends AbstractDanaRPlugin {
|
|||
context.unbindService(mConnection);
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
|
|
@ -68,6 +68,7 @@ public class DanaRKoreanPlugin extends AbstractDanaRPlugin {
|
|||
context.unbindService(mConnection);
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
|
|
@ -123,6 +123,7 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
|
|||
context.unbindService(mConnection);
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -71,6 +71,7 @@ public class DanaRv2Plugin extends AbstractDanaRPlugin {
|
|||
context.unbindService(mConnection);
|
||||
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
private ServiceConnection mConnection = new ServiceConnection() {
|
||||
|
|
|
@ -35,13 +35,9 @@ import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
|||
import info.nightscout.androidaps.plugins.treatments.TreatmentsPlugin
|
||||
import info.nightscout.androidaps.queue.Callback
|
||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||
import info.nightscout.androidaps.utils.DateUtil
|
||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||
import info.nightscout.androidaps.utils.SetWarnColor
|
||||
import info.nightscout.androidaps.utils.T
|
||||
import info.nightscout.androidaps.utils.*
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
import kotlinx.android.synthetic.main.medtronic_fragment.*
|
||||
import org.slf4j.LoggerFactory
|
||||
|
||||
|
@ -50,10 +46,6 @@ class MedtronicFragment : Fragment() {
|
|||
private val log = LoggerFactory.getLogger(L.PUMP)
|
||||
private var disposable: CompositeDisposable = CompositeDisposable()
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
||||
private val loopHandler = Handler()
|
||||
private lateinit var refreshLoop: Runnable
|
||||
|
||||
|
|
|
@ -128,6 +128,7 @@ public class VirtualPumpPlugin extends PluginBase implements PumpInterface {
|
|||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().unregister(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
|
|
@ -110,6 +110,7 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
@Override
|
||||
protected void onStop() {
|
||||
MainApp.bus().register(this);
|
||||
super.onStop();
|
||||
}
|
||||
|
||||
public TreatmentService getService() {
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
package info.nightscout.androidaps.utils
|
||||
|
||||
import io.reactivex.disposables.CompositeDisposable
|
||||
import io.reactivex.disposables.Disposable
|
||||
|
||||
operator fun CompositeDisposable.plusAssign(disposable: Disposable) {
|
||||
add(disposable)
|
||||
}
|
||||
|
Loading…
Reference in a new issue