diff --git a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt index 3b4965c605..fce062f89f 100644 --- a/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/activities/MyPreferenceFragment.kt @@ -76,7 +76,7 @@ class MyPreferenceFragment : PreferenceFragmentCompat(), OnSharedPreferenceChang @Inject lateinit var insulinOrefFreePeakPlugin: InsulinOrefFreePeakPlugin @Inject lateinit var loopPlugin: LoopPlugin @Inject lateinit var localInsightPlugin: LocalInsightPlugin - @Inject lateinit var medtronicPumpPlugin: info.nightscout.androidaps.plugins.pump.medtronic.MedtronicPumpPlugin + @Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var nsClientPlugin: NSClientPlugin @Inject lateinit var openAPSAMAPlugin: OpenAPSAMAPlugin @Inject lateinit var openAPSSMBPlugin: OpenAPSSMBPlugin diff --git a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt index dda071f1d2..3c2e89b348 100644 --- a/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt +++ b/app/src/main/java/info/nightscout/androidaps/dependencyInjection/ActivitiesModule.kt @@ -10,6 +10,7 @@ import info.nightscout.androidaps.plugins.general.maintenance.activities.PrefImp import info.nightscout.androidaps.plugins.general.overview.activities.QuickWizardListActivity import info.nightscout.androidaps.plugins.general.smsCommunicator.activities.SmsCommunicatorOtpActivity import info.nightscout.androidaps.plugins.pump.common.dialog.RileyLinkBLEScanActivity +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightAlertActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingActivity import info.nightscout.androidaps.plugins.pump.insight.activities.InsightPairingInformationActivity @@ -30,7 +31,7 @@ abstract class ActivitiesModule { @ContributesAndroidInjector abstract fun contributesPreferencesActivity(): PreferencesActivity @ContributesAndroidInjector abstract fun contributesQuickWizardListActivity(): QuickWizardListActivity @ContributesAndroidInjector abstract fun contributesRequestDexcomPermissionActivity(): RequestDexcomPermissionActivity - @ContributesAndroidInjector abstract fun contributesRileyLinkStatusActivity(): info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity + @ContributesAndroidInjector abstract fun contributesRileyLinkStatusActivity(): RileyLinkStatusActivity @ContributesAndroidInjector abstract fun contributesRileyLinkBLEScanActivity(): RileyLinkBLEScanActivity @ContributesAndroidInjector abstract fun contributesSetupWizardActivity(): SetupWizardActivity @ContributesAndroidInjector abstract fun contributesSingleFragmentActivity(): SingleFragmentActivity diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt index 000d6651c6..5c3914de1f 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/OmnipodFragment.kt @@ -85,7 +85,7 @@ class OmnipodFragment : DaggerFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - omnipod_rl_status.text = resourceHelper.gs(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState.NotStarted.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.Omnipod)) + omnipod_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.Omnipod)) omnipod_pod_status.setTextColor(Color.WHITE) omnipod_pod_status.text = "{fa-bed}" @@ -114,7 +114,7 @@ class OmnipodFragment : DaggerFragment() { omnipod_stats.setOnClickListener { if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) { - startActivity(Intent(context, info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity::class.java)) + startActivity(Intent(context, RileyLinkStatusActivity::class.java)) } else { displayNotConfiguredDialog() } @@ -211,12 +211,12 @@ class OmnipodFragment : DaggerFragment() { aapsLogger.info(LTag.PUMP, "setDeviceStatus: [pumpStatus={}]", omnipodPumpStatus) - val resourceId = omnipodPumpStatus.rileyLinkServiceState.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.Omnipod) + val resourceId = omnipodPumpStatus.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.Omnipod) val rileyLinkError = omnipodPumpPlugin.rileyLinkService?.error omnipod_rl_status.text = when { - omnipodPumpStatus.rileyLinkServiceState == info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) + omnipodPumpStatus.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) omnipodPumpStatus.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) @@ -229,7 +229,7 @@ class OmnipodFragment : DaggerFragment() { omnipod_errors.text = omnipodPumpStatus.rileyLinkError?.let { - resourceHelper.gs(it.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.Omnipod)) + resourceHelper.gs(it.getResourceId(RileyLinkTargetDevice.Omnipod)) } ?: "-" val driverState = omnipodUtil.getDriverState(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt index 4100ee3a8c..db46550a05 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/events/EventOmnipodDeviceStatusChange.kt @@ -11,14 +11,14 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionStat */ class EventOmnipodDeviceStatusChange : Event { - var rileyLinkServiceState: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState? = null - var rileyLinkError: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError? = null + var rileyLinkServiceState: RileyLinkServiceState? = null + var rileyLinkError: RileyLinkError? = null var podSessionState: PodSessionState? = null var errorDescription: String? = null var podDeviceState: PodDeviceState? = null @JvmOverloads - constructor(rileyLinkServiceState: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState?, rileyLinkError: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkError? = null) { + constructor(rileyLinkServiceState: RileyLinkServiceState?, rileyLinkError: RileyLinkError? = null) { this.rileyLinkServiceState = rileyLinkServiceState this.rileyLinkError = rileyLinkError } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt index ced1bcd888..50a2db2f66 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/sensitivity/AbstractSensitivityPlugin.kt @@ -21,10 +21,12 @@ abstract class AbstractSensitivityPlugin( injector: HasAndroidInjector, aapsLogger: AAPSLogger, resourceHelper: - ResourceHelper, - val sp: SP + ResourceHelper //, + //var sp: SP ) : PluginBase(pluginDescription, aapsLogger, resourceHelper, injector), SensitivityInterface { + lateinit var sp: SP + abstract override fun detectSensitivity(plugin: IobCobCalculatorInterface, fromTime: Long, toTime: Long): AutosensResult fun fillResult(ratio: Double, carbsAbsorbed: Double, pastSensitivity: String, diff --git a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt index 37712451bb..a4c8431e0e 100644 --- a/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt +++ b/medtronic/src/main/java/info/nightscout/androidaps/plugins/pump/medtronic/MedtronicFragment.kt @@ -24,6 +24,11 @@ import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDevic import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpConfigurationChanged import info.nightscout.androidaps.plugins.pump.medtronic.events.EventMedtronicPumpValuesChanged import info.nightscout.androidaps.plugins.pump.common.events.EventRefreshButtonState +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity +import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil import info.nightscout.androidaps.queue.Callback import info.nightscout.androidaps.queue.events.EventQueueChanged @@ -49,10 +54,10 @@ class MedtronicFragment : DaggerFragment() { @Inject lateinit var activePlugin: ActivePluginProvider @Inject lateinit var medtronicPumpPlugin: MedtronicPumpPlugin @Inject lateinit var warnColors: WarnColors - @Inject lateinit var rileyLinkUtil: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.RileyLinkUtil + @Inject lateinit var rileyLinkUtil: RileyLinkUtil @Inject lateinit var medtronicUtil: MedtronicUtil @Inject lateinit var medtronicPumpStatus: MedtronicPumpStatus - @Inject lateinit var rileyLinkServiceData: info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData + @Inject lateinit var rileyLinkServiceData: RileyLinkServiceData private var disposable: CompositeDisposable = CompositeDisposable() @@ -75,7 +80,7 @@ class MedtronicFragment : DaggerFragment() { medtronic_pumpstatus.setBackgroundColor(resourceHelper.gc(R.color.colorInitializingBorder)) - medtronic_rl_status.text = resourceHelper.gs(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState.NotStarted.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) + medtronic_rl_status.text = resourceHelper.gs(RileyLinkServiceState.NotStarted.getResourceId(RileyLinkTargetDevice.MedtronicPump)) medtronic_pump_status.setTextColor(Color.WHITE) medtronic_pump_status.text = "{fa-bed}" @@ -104,7 +109,7 @@ class MedtronicFragment : DaggerFragment() { medtronic_stats.setOnClickListener { if (medtronicPumpPlugin.rileyLinkService?.verifyConfiguration() == true) { - startActivity(Intent(context, info.nightscout.androidaps.plugins.pump.common.hw.rileylink.dialog.RileyLinkStatusActivity::class.java)) + startActivity(Intent(context, RileyLinkStatusActivity::class.java)) } else { displayNotConfiguredDialog() } @@ -167,11 +172,11 @@ class MedtronicFragment : DaggerFragment() { @Synchronized private fun setDeviceStatus() { - val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump) + val resourceId = rileyLinkServiceData.rileyLinkServiceState.getResourceId(RileyLinkTargetDevice.MedtronicPump) val rileyLinkError = medtronicPumpPlugin.rileyLinkService?.error medtronic_rl_status.text = when { - rileyLinkServiceData.rileyLinkServiceState == info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) + rileyLinkServiceData.rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError == null -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId) rileyLinkServiceData.rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) @@ -181,7 +186,7 @@ class MedtronicFragment : DaggerFragment() { medtronic_errors.text = rileyLinkServiceData.rileyLinkError?.let { - resourceHelper.gs(it.getResourceId(info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkTargetDevice.MedtronicPump)) + resourceHelper.gs(it.getResourceId(RileyLinkTargetDevice.MedtronicPump)) } ?: "-" when (medtronicPumpStatus.pumpDeviceState) { diff --git a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleUnitTest.java b/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleUnitTest.java deleted file mode 100644 index 98bc082706..0000000000 --- a/medtronic/src/test/java/info/nightscout/androidaps/plugins/pump/medtronic/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.medtronic; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file diff --git a/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/ExampleUnitTest.java b/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/ExampleUnitTest.java deleted file mode 100644 index 9c4318ff41..0000000000 --- a/rileylink/src/test/java/info/nightscout/androidaps/plugins/pump/common/ExampleUnitTest.java +++ /dev/null @@ -1,17 +0,0 @@ -package info.nightscout.androidaps.plugins.pump.common; - -import org.junit.Test; - -import static org.junit.Assert.*; - -/** - * Example local unit test, which will execute on the development machine (host). - * - * @see Testing documentation - */ -public class ExampleUnitTest { - @Test - public void addition_isCorrect() { - assertEquals(4, 2 + 2); - } -} \ No newline at end of file