More work in progress on moving stuff from omnipod-eros to omnipod-common
This commit is contained in:
parent
b56a3d8132
commit
567c215388
71 changed files with 816 additions and 547 deletions
|
@ -634,7 +634,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
|
||||||
}
|
}
|
||||||
|
|
||||||
pump.isSuspended() -> {
|
pump.isSuspended() -> {
|
||||||
binding.infoLayout.apsMode.setImageResource(if (pump.pumpDescription.pumpType == PumpType.Omnipod_Eros) {
|
binding.infoLayout.apsMode.setImageResource(if (pump.model() == PumpType.Omnipod_Eros || pump.model() == PumpType.Omnipod_Dash) {
|
||||||
// For Omnipod, indicate the pump as disconnected when it's suspended.
|
// For Omnipod, indicate the pump as disconnected when it's suspended.
|
||||||
// The only way to 'reconnect' it, is through the Omnipod tab
|
// The only way to 'reconnect' it, is through the Omnipod tab
|
||||||
R.drawable.ic_loop_disconnected
|
R.drawable.ic_loop_disconnected
|
||||||
|
|
|
@ -36,11 +36,11 @@ class StatusLightHandler @Inject constructor(
|
||||||
handleAge(careportal_cannula_age, CareportalEvent.SITECHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
|
handleAge(careportal_cannula_age, CareportalEvent.SITECHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0)
|
||||||
handleAge(careportal_insulin_age, CareportalEvent.INSULINCHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
|
handleAge(careportal_insulin_age, CareportalEvent.INSULINCHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0)
|
||||||
handleAge(careportal_sensor_age, CareportalEvent.SENSORCHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
|
handleAge(careportal_sensor_age, CareportalEvent.SENSORCHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0)
|
||||||
if (pump.pumpDescription.isBatteryReplaceable) {
|
if (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)) {
|
||||||
handleAge(careportal_pb_age, CareportalEvent.PUMPBATTERYCHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
|
handleAge(careportal_pb_age, CareportalEvent.PUMPBATTERYCHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0)
|
||||||
}
|
}
|
||||||
if (!config.NSCLIENT) {
|
if (!config.NSCLIENT) {
|
||||||
if (pump.model() == PumpType.Omnipod_Eros) {
|
if (pump.model() == PumpType.Omnipod_Eros || pump.model() == PumpType.Omnipod_Dash) {
|
||||||
handleOmnipodReservoirLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
|
handleOmnipodReservoirLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
|
||||||
} else {
|
} else {
|
||||||
handleLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
|
handleLevel(careportal_reservoir_level, R.string.key_statuslights_res_critical, 10.0, R.string.key_statuslights_res_warning, 80.0, pump.reservoirLevel, "U")
|
||||||
|
@ -52,8 +52,14 @@ class StatusLightHandler @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config.NSCLIENT) {
|
if (!config.NSCLIENT) {
|
||||||
if (pump.model() == PumpType.Omnipod_Eros && pump is OmnipodErosPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
|
if (pump.model() == PumpType.Omnipod_Dash) {
|
||||||
handleOmnipodBatteryLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", pump.isUseRileyLinkBatteryLevel)
|
// Omnipod Dash does not report its battery level
|
||||||
|
careportal_battery_level?.text = resourceHelper.gs(R.string.notavailable)
|
||||||
|
careportal_battery_level?.setTextColor(Color.WHITE)
|
||||||
|
} else if (pump.model() == PumpType.Omnipod_Eros && pump is OmnipodErosPumpPlugin) { // instance of check is needed because at startup, pump can still be VirtualPumpPlugin and that will cause a crash because of the class cast below
|
||||||
|
// The Omnipod Eros does not report its battery level. However, some RileyLink alternatives do.
|
||||||
|
// Depending on the user's configuration, we will either show the battery level reported by the RileyLink or "n/a"
|
||||||
|
handleOmnipodErosBatteryLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%", pump.isUseRileyLinkBatteryLevel)
|
||||||
} else if (pump.model() != PumpType.AccuChekCombo) {
|
} else if (pump.model() != PumpType.AccuChekCombo) {
|
||||||
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
|
handleLevel(careportal_battery_level, R.string.key_statuslights_bat_critical, 26.0, R.string.key_statuslights_bat_warning, 51.0, pump.batteryLevel.toDouble(), "%")
|
||||||
}
|
}
|
||||||
|
@ -93,7 +99,7 @@ class StatusLightHandler @Inject constructor(
|
||||||
}
|
}
|
||||||
|
|
||||||
@Suppress("SameParameterValue")
|
@Suppress("SameParameterValue")
|
||||||
private fun handleOmnipodBatteryLevel(view: TextView?, criticalSetting: Int, criticalDefaultValue: Double, warnSetting: Int, warnDefaultValue: Double, level: Double, units: String, useRileyLinkBatteryLevel: Boolean) {
|
private fun handleOmnipodErosBatteryLevel(view: TextView?, criticalSetting: Int, criticalDefaultValue: Double, warnSetting: Int, warnDefaultValue: Double, level: Double, units: String, useRileyLinkBatteryLevel: Boolean) {
|
||||||
if (useRileyLinkBatteryLevel) {
|
if (useRileyLinkBatteryLevel) {
|
||||||
handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units)
|
handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.plugins.profile.local.LocalProfilePlugin
|
||||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
|
import info.nightscout.androidaps.plugins.profile.ns.NSProfileFragment
|
||||||
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin
|
import info.nightscout.androidaps.plugins.profile.ns.NSProfilePlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDeviceStatusChange
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.OmnipodDashPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||||
import info.nightscout.androidaps.setupwizard.elements.*
|
import info.nightscout.androidaps.setupwizard.elements.*
|
||||||
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
|
import info.nightscout.androidaps.setupwizard.events.EventSWUpdate
|
||||||
|
@ -277,14 +278,14 @@ class SWDefinition @Inject constructor(
|
||||||
.add(SWInfoText(injector)
|
.add(SWInfoText(injector)
|
||||||
.label(R.string.setupwizard_pump_pump_not_initialized)
|
.label(R.string.setupwizard_pump_pump_not_initialized)
|
||||||
.visibility { !isPumpInitialized() })
|
.visibility { !isPumpInitialized() })
|
||||||
.add( // Omnipod only
|
.add( // Omnipod Eros only
|
||||||
SWInfoText(injector)
|
SWInfoText(injector)
|
||||||
.label(R.string.setupwizard_pump_waiting_for_riley_link_connection)
|
.label(R.string.setupwizard_pump_waiting_for_riley_link_connection)
|
||||||
.visibility {
|
.visibility {
|
||||||
val activePump = activePlugin.activePump
|
val activePump = activePlugin.activePump
|
||||||
activePump is OmnipodErosPumpPlugin && !activePump.isRileyLinkReady
|
activePump is OmnipodErosPumpPlugin && !activePump.isRileyLinkReady
|
||||||
})
|
})
|
||||||
.add( // Omnipod only
|
.add( // Omnipod Eros only
|
||||||
SWEventListener(injector, EventRileyLinkDeviceStatusChange::class.java)
|
SWEventListener(injector, EventRileyLinkDeviceStatusChange::class.java)
|
||||||
.label(R.string.setupwizard_pump_riley_link_status)
|
.label(R.string.setupwizard_pump_riley_link_status)
|
||||||
.visibility { activePlugin.activePump is OmnipodErosPumpPlugin })
|
.visibility { activePlugin.activePump is OmnipodErosPumpPlugin })
|
||||||
|
@ -294,18 +295,21 @@ class SWDefinition @Inject constructor(
|
||||||
.visibility {
|
.visibility {
|
||||||
// Hide for Omnipod, because as we don't require a Pod to be paired in the setup wizard,
|
// Hide for Omnipod, because as we don't require a Pod to be paired in the setup wizard,
|
||||||
// Getting the status might not be possible
|
// Getting the status might not be possible
|
||||||
activePlugin.activePump !is OmnipodErosPumpPlugin
|
activePlugin.activePump !is OmnipodErosPumpPlugin && activePlugin.activePump !is OmnipodDashPumpPlugin
|
||||||
})
|
})
|
||||||
.add(SWEventListener(injector, EventPumpStatusChanged::class.java)
|
.add(SWEventListener(injector, EventPumpStatusChanged::class.java)
|
||||||
.visibility { activePlugin.activePump !is OmnipodErosPumpPlugin })
|
.visibility { activePlugin.activePump !is OmnipodErosPumpPlugin && activePlugin.activePump !is OmnipodDashPumpPlugin })
|
||||||
.validator { isPumpInitialized() }
|
.validator { isPumpInitialized() }
|
||||||
|
|
||||||
private fun isPumpInitialized(): Boolean {
|
private fun isPumpInitialized(): Boolean {
|
||||||
val activePump = activePlugin.activePump
|
val activePump = activePlugin.activePump
|
||||||
|
|
||||||
// For Omnipod, consider the pump initialized when a RL has been configured successfully
|
// For Omnipod, activating a Pod can be done after setup through the Omnipod fragment
|
||||||
// Users will be prompted to activate a Pod after completing the setup wizard.
|
// For the Eros model, consider the pump initialized when a RL has been configured successfully
|
||||||
return activePump.isInitialized() || (activePump is OmnipodErosPumpPlugin && activePump.isRileyLinkReady)
|
// For Dash model, consider the pump setup without any extra conditions
|
||||||
|
return activePump.isInitialized()
|
||||||
|
|| (activePump is OmnipodErosPumpPlugin && activePump.isRileyLinkReady)
|
||||||
|
|| activePump is OmnipodDashPumpPlugin
|
||||||
}
|
}
|
||||||
|
|
||||||
private val screenAps = SWScreen(injector, R.string.configbuilder_aps)
|
private val screenAps = SWScreen(injector, R.string.configbuilder_aps)
|
||||||
|
|
|
@ -1,9 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest package="info.nightscout.androidaps.plugins.pump.omnipod.common">
|
||||||
package="info.nightscout.androidaps.plugins.pump.omnipod.common">
|
|
||||||
|
|
||||||
<application>
|
<application></application>
|
||||||
<activity android:name=".ui.wizard.activation.PodActivationWizardActivity" />
|
|
||||||
<activity android:name=".ui.wizard.deactivation.PodDeactivationWizardActivity" />
|
|
||||||
</application>
|
|
||||||
</manifest>
|
</manifest>
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger
|
|
||||||
|
|
||||||
import dagger.Module
|
|
||||||
import dagger.android.ContributesAndroidInjector
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
|
|
||||||
|
|
||||||
@Module
|
|
||||||
@Suppress("unused")
|
|
||||||
abstract class OmnipodCommonModule {
|
|
||||||
// ACTIVITIES
|
|
||||||
|
|
||||||
@ActivityScope
|
|
||||||
@ContributesAndroidInjector(modules = [OmnipodWizardModule::class])
|
|
||||||
abstract fun contributesActivationWizardActivity(): PodActivationWizardActivity
|
|
||||||
|
|
||||||
@ActivityScope
|
|
||||||
@ContributesAndroidInjector(modules = [OmnipodWizardModule::class])
|
|
||||||
abstract fun contributesDeactivationWizardActivity(): PodDeactivationWizardActivity
|
|
||||||
}
|
|
|
@ -15,7 +15,7 @@ annotation class OmnipodPluginQualifier
|
||||||
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
@Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER)
|
||||||
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
|
@kotlin.annotation.Retention(AnnotationRetention.RUNTIME)
|
||||||
@MapKey
|
@MapKey
|
||||||
internal annotation class ViewModelKey(val value: KClass<out ViewModel>)
|
annotation class ViewModelKey(val value: KClass<out ViewModel>)
|
||||||
|
|
||||||
// TODO: These annotations and Factories could be used globally -> move to core or app
|
// TODO: These annotations and Factories could be used globally -> move to core or app
|
||||||
|
|
||||||
|
|
|
@ -2,23 +2,18 @@ package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger
|
||||||
|
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import dagger.Binds
|
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
import dagger.multibindings.IntoMap
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action.InitializePodFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.AttachPodInfoFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action.InsertCannulaFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.FillPodInfoFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.AttachPodFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.InitializePodActionFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.PodActivatedFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.InsertCannulaActionFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.StartPodActivationFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.PodActivatedInfoFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.action.DeactivatePodFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.InitializePodActionViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.PodDeactivatedFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.InsertCannulaActionViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.PodDiscardedFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.DeactivatePodActionFragment
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.StartPodDeactivationFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.DeactivatePodInfoFragment
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.PodDeactivatedInfoFragment
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.PodDiscardedInfoFragment
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.DeactivatePodActionViewModel
|
|
||||||
import javax.inject.Provider
|
import javax.inject.Provider
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
|
@ -33,61 +28,48 @@ abstract class OmnipodWizardModule {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// #### VIEW MODELS ############################################################################
|
|
||||||
@Binds
|
|
||||||
@IntoMap
|
|
||||||
@OmnipodPluginQualifier
|
|
||||||
@ViewModelKey(InitializePodActionViewModel::class)
|
|
||||||
internal abstract fun initializePodActionViewModel(viewModel: InitializePodActionViewModel): ViewModel
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
@IntoMap
|
|
||||||
@OmnipodPluginQualifier
|
|
||||||
@ViewModelKey(InsertCannulaActionViewModel::class)
|
|
||||||
internal abstract fun insertCannulaActionViewModel(viewModel: InsertCannulaActionViewModel): ViewModel
|
|
||||||
|
|
||||||
@Binds
|
|
||||||
@IntoMap
|
|
||||||
@OmnipodPluginQualifier
|
|
||||||
@ViewModelKey(DeactivatePodActionViewModel::class)
|
|
||||||
internal abstract fun deactivatePodActionViewModel(viewModel: DeactivatePodActionViewModel): ViewModel
|
|
||||||
|
|
||||||
// #### FRAGMENTS ##############################################################################
|
// #### FRAGMENTS ##############################################################################
|
||||||
@FragmentScope
|
|
||||||
@ContributesAndroidInjector
|
// POD ACTIVATION
|
||||||
internal abstract fun contributesDeactivatePodActionFragment(): DeactivatePodActionFragment
|
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesInsertCannulaActionFragment(): InsertCannulaActionFragment
|
internal abstract fun contributesStartPodActivationFragment(): StartPodActivationFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesInitializePodActionFragment(): InitializePodActionFragment
|
internal abstract fun contributesInitializeActionFragment(): InitializePodFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesAttachPodInfoFragment(): AttachPodInfoFragment
|
internal abstract fun contributesAttachPodFragment(): AttachPodFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesDeactivatePodInfoFragment(): DeactivatePodInfoFragment
|
internal abstract fun contributesInsertCannulaFragment(): InsertCannulaFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesFillPodInfoFragment(): FillPodInfoFragment
|
internal abstract fun contributesPodActivatedFragment(): PodActivatedFragment
|
||||||
|
|
||||||
|
// POD DEACTIVATION
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesPodDeactivatedInfoFragment(): PodDeactivatedInfoFragment
|
internal abstract fun contributesStartPodDeactivationFragment(): StartPodDeactivationFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesPodDiscardedInfoFragment(): PodDiscardedInfoFragment
|
internal abstract fun contributesDeactivatePodFragment(): DeactivatePodFragment
|
||||||
|
|
||||||
@FragmentScope
|
@FragmentScope
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
internal abstract fun contributesPodActivatedInfoFragment(): PodActivatedInfoFragment
|
internal abstract fun contributesPodDeactivatedFragment(): PodDeactivatedFragment
|
||||||
|
|
||||||
|
@FragmentScope
|
||||||
|
@ContributesAndroidInjector
|
||||||
|
internal abstract fun contributesPodDiscardedFragment(): PodDiscardedFragment
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import androidx.annotation.IdRes
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
||||||
|
|
||||||
class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
abstract class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val KEY_TYPE = "wizardType"
|
const val KEY_TYPE = "wizardType"
|
||||||
|
@ -18,18 +18,18 @@ class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
private var startDestination: Int = R.id.fillPodInfoFragment
|
private var startDestination: Int = R.id.startPodActivationFragment
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
setContentView(R.layout.omnipod_common_pod_activation_wizard_activity)
|
setContentView(R.layout.omnipod_common_pod_activation_wizard_activity)
|
||||||
|
|
||||||
startDestination = savedInstanceState?.getInt(KEY_START_DESTINATION, R.id.fillPodInfoFragment)
|
startDestination = savedInstanceState?.getInt(KEY_START_DESTINATION, R.id.startPodActivationFragment)
|
||||||
?: if (intent.getSerializableExtra(KEY_TYPE) as Type == Type.LONG) {
|
?: if (intent.getSerializableExtra(KEY_TYPE) as Type == Type.LONG) {
|
||||||
R.id.fillPodInfoFragment
|
R.id.startPodActivationFragment
|
||||||
} else {
|
} else {
|
||||||
R.id.attachPodInfoFragment
|
R.id.attachPodFragment
|
||||||
}
|
}
|
||||||
|
|
||||||
setStartDestination(startDestination)
|
setStartDestination(startDestination)
|
||||||
|
@ -52,7 +52,7 @@ class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
override fun getTotalDefinedNumberOfSteps(): Int = 5
|
override fun getTotalDefinedNumberOfSteps(): Int = 5
|
||||||
|
|
||||||
override fun getActualNumberOfSteps(): Int {
|
override fun getActualNumberOfSteps(): Int {
|
||||||
if (startDestination == R.id.attachPodInfoFragment) {
|
if (startDestination == R.id.attachPodFragment) {
|
||||||
return 3
|
return 3
|
||||||
}
|
}
|
||||||
return 5
|
return 5
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
|
||||||
|
|
||||||
import androidx.annotation.IdRes
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
|
||||||
|
|
||||||
class PodActivatedInfoFragment : InfoFragmentBase() {
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_pod_activated_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_activation_wizard_pod_activated_text
|
|
||||||
|
|
||||||
@IdRes
|
|
||||||
override fun getNextPageActionId(): Int? = null
|
|
||||||
|
|
||||||
override fun getIndex(): Int = 5
|
|
||||||
}
|
|
|
@ -1,16 +1,15 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.InitializePodActionViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InitializePodActionFragment : PodActivationActionFragmentBase() {
|
class InitializePodFragment : PodActivationActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
|
@ -19,18 +18,12 @@ class InitializePodActionFragment : PodActivationActionFragmentBase() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val vm: InitializePodActionViewModel by viewModels { viewModelFactory }
|
val vm: InitializePodViewModel by viewModels { viewModelFactory }
|
||||||
this.viewModel = vm
|
this.viewModel = vm
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_initialize_pod_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = (viewModel as InitializePodActionViewModel).getTextId()
|
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
override fun getNextPageActionId(): Int = R.id.action_initializePodActionFragment_to_attachPodInfoFragment
|
override fun getNextPageActionId(): Int = R.id.action_initializePodFragment_to_attachPodFragment
|
||||||
|
|
||||||
override fun getIndex(): Int = 2
|
override fun getIndex(): Int = 2
|
||||||
}
|
}
|
|
@ -1,16 +1,15 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.InsertCannulaActionViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
|
class InsertCannulaFragment : PodActivationActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
|
@ -19,18 +18,12 @@ class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val vm: InsertCannulaActionViewModel by viewModels { viewModelFactory }
|
val vm: InsertCannulaViewModel by viewModels { viewModelFactory }
|
||||||
this.viewModel = vm
|
this.viewModel = vm
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_insert_cannula_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_activation_wizard_insert_cannula_text
|
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
override fun getNextPageActionId(): Int = R.id.action_insertCannulaActionFragment_to_PodActivatedInfoFragment
|
override fun getNextPageActionId(): Int = R.id.action_insertCannulaFragment_to_PodActivatedFragment
|
||||||
|
|
||||||
override fun getIndex(): Int = 4
|
override fun getIndex(): Int = 4
|
||||||
}
|
}
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.PodActivationActionViewModelBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.PodActivationActionViewModelBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFailure() {
|
override fun onFailure() {
|
||||||
(viewModel as? PodActivationActionViewModelBase)?.let { viewModel ->
|
(actionViewModel as? PodActivationActionViewModelBase)?.let { viewModel ->
|
||||||
if (viewModel.isPodDeactivatable() and (viewModel.isPodInAlarm() or viewModel.isPodActivationTimeExceeded())) {
|
if (viewModel.isPodDeactivatable() and (viewModel.isPodInAlarm() or viewModel.isPodActivationTimeExceeded())) {
|
||||||
view?.let {
|
view?.let {
|
||||||
it.findViewById<Button>(R.id.omnipod_wizard_button_retry)?.visibility = View.GONE
|
it.findViewById<Button>(R.id.omnipod_wizard_button_retry)?.visibility = View.GONE
|
|
@ -1,25 +1,34 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
class AttachPodInfoFragment : InfoFragmentBase() {
|
class AttachPodFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@Inject
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_attach_pod_title
|
@OmnipodPluginQualifier
|
||||||
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
@StringRes
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_activation_wizard_attach_pod_text
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val vm: AttachPodViewModel by viewModels { viewModelFactory }
|
||||||
|
this.viewModel = vm
|
||||||
|
}
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
override fun getNextPageActionId(): Int = R.id.action_attachPodInfoFragment_to_insertCannulaActionFragment
|
override fun getNextPageActionId(): Int = R.id.action_attachPodFragment_to_insertCannulaFragment
|
||||||
|
|
||||||
override fun getIndex(): Int = 3
|
override fun getIndex(): Int = 3
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.annotation.IdRes
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class PodActivatedFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val vm: PodActivatedViewModel by viewModels { viewModelFactory }
|
||||||
|
this.viewModel = vm
|
||||||
|
}
|
||||||
|
|
||||||
|
@IdRes
|
||||||
|
override fun getNextPageActionId(): Int? = null
|
||||||
|
|
||||||
|
override fun getIndex(): Int = 5
|
||||||
|
}
|
|
@ -1,38 +1,30 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.FillPodInfoViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.StartPodActivationViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class FillPodInfoFragment : InfoFragmentBase() {
|
class StartPodActivationFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
lateinit var viewModelFactory: ViewModelProvider.Factory
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
private lateinit var viewModel: FillPodInfoViewModel
|
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val vm: FillPodInfoViewModel by viewModels { viewModelFactory }
|
val vm: StartPodActivationViewModel by viewModels { viewModelFactory }
|
||||||
this.viewModel = vm
|
this.viewModel = vm
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_fill_pod_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = viewModel.getTextId()
|
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
override fun getNextPageActionId(): Int = R.id.action_fillPodInfoFragment_to_initializePodActionFragment
|
override fun getNextPageActionId(): Int = R.id.action_startPodActivationFragment_to_initializePodFragment
|
||||||
|
|
||||||
override fun getIndex(): Int = 1
|
override fun getIndex(): Int = 1
|
||||||
}
|
}
|
|
@ -1,10 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel
|
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
|
|
||||||
class FillPodInfoViewModel : ViewModel() {
|
|
||||||
|
|
||||||
@StringRes fun getTextId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_text
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel
|
|
||||||
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodManager
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val podStateManager: AapsPodStateManager) : PodActivationActionViewModelBase() {
|
|
||||||
|
|
||||||
override fun isPodInAlarm(): Boolean = podStateManager.isPodFaulted
|
|
||||||
|
|
||||||
override fun isPodActivationTimeExceeded(): Boolean = podStateManager.isPodActivationTimeExceeded
|
|
||||||
|
|
||||||
override fun isPodDeactivatable(): Boolean = podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
|
|
||||||
|
|
||||||
@StringRes fun getTextId() = R.string.omnipod_pod_activation_wizard_initialize_pod_text
|
|
||||||
}
|
|
|
@ -1,17 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel
|
|
||||||
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
|
||||||
import info.nightscout.androidaps.interfaces.ProfileFunction
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodManager
|
|
||||||
import javax.inject.Inject
|
|
||||||
|
|
||||||
class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val podStateManager: AapsPodStateManager, private val profileFunction: ProfileFunction) : PodActivationActionViewModelBase() {
|
|
||||||
|
|
||||||
override fun isPodInAlarm(): Boolean = podStateManager.isPodFaulted
|
|
||||||
|
|
||||||
override fun isPodActivationTimeExceeded(): Boolean = podStateManager.isPodActivationTimeExceeded
|
|
||||||
|
|
||||||
override fun isPodDeactivatable(): Boolean = podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
|
|
||||||
}
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action
|
||||||
|
|
||||||
|
abstract class InitializePodViewModel : PodActivationActionViewModelBase()
|
|
@ -0,0 +1,3 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action
|
||||||
|
|
||||||
|
abstract class InsertCannulaViewModel : PodActivationActionViewModelBase()
|
|
@ -1,4 +1,4 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ActionViewModelBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ActionViewModelBase
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class AttachPodViewModel : ViewModelBase()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class PodActivatedViewModel : ViewModelBase()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class StartPodActivationViewModel : ViewModelBase()
|
|
@ -4,71 +4,70 @@ import android.annotation.SuppressLint
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
|
import android.widget.ProgressBar
|
||||||
|
import android.widget.TextView
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ActionViewModelBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.PodActivationActionViewModelBase
|
||||||
import info.nightscout.androidaps.utils.extensions.toVisibility
|
import info.nightscout.androidaps.utils.extensions.toVisibility
|
||||||
|
|
||||||
abstract class ActionFragmentBase : WizardFragmentBase() {
|
abstract class ActionFragmentBase : WizardFragmentBase() {
|
||||||
|
|
||||||
protected lateinit var viewModel: ActionViewModelBase
|
val actionViewModel: PodActivationActionViewModelBase
|
||||||
|
get() = viewModel as PodActivationActionViewModelBase
|
||||||
|
|
||||||
@SuppressLint("CutPasteId")
|
@SuppressLint("CutPasteId")
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
binding.navButtonsLayout.buttonNext.isEnabled = false
|
binding.navButtonsLayout.buttonNext.isEnabled = false
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_page_text).setText(getTextId())
|
view.findViewById<TextView>(R.id.omnipod_wizard_action_page_text).setText(getTextId())
|
||||||
|
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).setOnClickListener { viewModel.executeAction() }
|
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).setOnClickListener { actionViewModel.executeAction() }
|
||||||
|
|
||||||
viewModel.isActionExecutingLiveData.observe(viewLifecycleOwner, { isExecuting ->
|
actionViewModel.isActionExecutingLiveData.observe(viewLifecycleOwner, { isExecuting ->
|
||||||
if (isExecuting) {
|
if (isExecuting) {
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_error).visibility = View.GONE
|
view.findViewById<TextView>(R.id.omnipod_wizard_action_error).visibility = View.GONE
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_button_deactivate_pod).visibility = View.GONE
|
view.findViewById<Button>(R.id.omnipod_wizard_button_deactivate_pod).visibility = View.GONE
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_button_discard_pod).visibility = View.GONE
|
view.findViewById<Button>(R.id.omnipod_wizard_button_discard_pod).visibility = View.GONE
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).visibility = View.GONE
|
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).visibility = View.GONE
|
||||||
}
|
}
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_progress_indication).visibility = isExecuting.toVisibility()
|
view.findViewById<ProgressBar>(R.id.omnipod_wizard_action_progress_indication).visibility = isExecuting.toVisibility()
|
||||||
view.findViewById<Button>(R.id.button_cancel).isEnabled = !isExecuting
|
view.findViewById<Button>(R.id.button_cancel).isEnabled = !isExecuting
|
||||||
})
|
})
|
||||||
|
|
||||||
viewModel.actionResultLiveData.observe(viewLifecycleOwner, { result ->
|
actionViewModel.actionResultLiveData.observe(viewLifecycleOwner, { result ->
|
||||||
result?.let {
|
result?.let {
|
||||||
val isExecuting = isActionExecuting()
|
val isExecuting = isActionExecuting()
|
||||||
|
|
||||||
view.findViewById<Button>(R.id.button_next).isEnabled = result.success
|
view.findViewById<Button>(R.id.button_next).isEnabled = result.success
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_success).visibility = result.success.toVisibility()
|
view.findViewById<TextView>(R.id.omnipod_wizard_action_success).visibility = result.success.toVisibility()
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_error).visibility = (!isExecuting && !result.success).toVisibility()
|
view.findViewById<TextView>(R.id.omnipod_wizard_action_error).visibility = (!isExecuting && !result.success).toVisibility()
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).visibility = (!isExecuting && !result.success).toVisibility()
|
view.findViewById<Button>(R.id.omnipod_wizard_button_retry).visibility = (!isExecuting && !result.success).toVisibility()
|
||||||
|
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
view.findViewById<Button>(R.id.omnipod_wizard_action_error).text = result.comment
|
view.findViewById<TextView>(R.id.omnipod_wizard_action_error).text = result.comment
|
||||||
onFailure()
|
onFailure()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
if (savedInstanceState == null && !isActionExecuting()) {
|
if (savedInstanceState == null && !isActionExecuting()) {
|
||||||
viewModel.executeAction()
|
actionViewModel.executeAction()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun isActionExecuting() = viewModel.isActionExecutingLiveData.value!!
|
protected fun isActionExecuting() = actionViewModel.isActionExecutingLiveData.value!!
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
super.onDestroyView()
|
super.onDestroyView()
|
||||||
viewModel.isActionExecutingLiveData.removeObservers(viewLifecycleOwner)
|
actionViewModel.isActionExecutingLiveData.removeObservers(viewLifecycleOwner)
|
||||||
viewModel.actionResultLiveData.removeObservers(viewLifecycleOwner)
|
actionViewModel.actionResultLiveData.removeObservers(viewLifecycleOwner)
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract fun onFailure()
|
abstract fun onFailure()
|
||||||
|
|
||||||
@StringRes
|
|
||||||
abstract fun getTextId(): Int
|
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
override fun getLayoutId(): Int = R.layout.omnipod_common_wizard_action_page_fragment
|
override fun getLayoutId(): Int = R.layout.omnipod_common_wizard_action_page_fragment
|
||||||
}
|
}
|
|
@ -4,7 +4,6 @@ import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.annotation.LayoutRes
|
import androidx.annotation.LayoutRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
|
|
||||||
abstract class InfoFragmentBase : WizardFragmentBase() {
|
abstract class InfoFragmentBase : WizardFragmentBase() {
|
||||||
|
@ -15,9 +14,6 @@ abstract class InfoFragmentBase : WizardFragmentBase() {
|
||||||
view.findViewById<TextView>(R.id.omnipod_wizard_info_page_text).setText(getTextId())
|
view.findViewById<TextView>(R.id.omnipod_wizard_info_page_text).setText(getTextId())
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
|
||||||
abstract fun getTextId(): Int
|
|
||||||
|
|
||||||
@LayoutRes
|
@LayoutRes
|
||||||
override fun getLayoutId(): Int = R.layout.omnipod_common_wizard_info_page_fragment
|
override fun getLayoutId(): Int = R.layout.omnipod_common_wizard_info_page_fragment
|
||||||
}
|
}
|
|
@ -13,10 +13,13 @@ import dagger.android.support.DaggerFragment
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonWizardBaseFragmentBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonWizardBaseFragmentBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
abstract class WizardFragmentBase : DaggerFragment() {
|
abstract class WizardFragmentBase : DaggerFragment() {
|
||||||
|
|
||||||
|
protected lateinit var viewModel: ViewModelBase
|
||||||
|
|
||||||
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
|
var _binding: OmnipodCommonWizardBaseFragmentBinding? = null
|
||||||
|
|
||||||
// This property is only valid between onCreateView and
|
// This property is only valid between onCreateView and
|
||||||
|
@ -84,7 +87,9 @@ abstract class WizardFragmentBase : DaggerFragment() {
|
||||||
protected abstract fun getNextPageActionId(): Int?
|
protected abstract fun getNextPageActionId(): Int?
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
protected abstract fun getTitleId(): Int
|
protected fun getTitleId(): Int = viewModel.getTitleId()
|
||||||
|
|
||||||
|
@StringRes protected fun getTextId(): Int = viewModel.getTextId()
|
||||||
|
|
||||||
protected abstract fun getIndex(): Int
|
protected abstract fun getIndex(): Int
|
||||||
}
|
}
|
|
@ -2,12 +2,11 @@ package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.
|
||||||
|
|
||||||
import androidx.lifecycle.LiveData
|
import androidx.lifecycle.LiveData
|
||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import io.reactivex.schedulers.Schedulers
|
import io.reactivex.schedulers.Schedulers
|
||||||
import io.reactivex.subjects.SingleSubject
|
import io.reactivex.subjects.SingleSubject
|
||||||
|
|
||||||
abstract class ActionViewModelBase : ViewModel() {
|
abstract class ActionViewModelBase : ViewModelBase() {
|
||||||
|
|
||||||
private val _isActionExecutingLiveData = MutableLiveData(false)
|
private val _isActionExecutingLiveData = MutableLiveData(false)
|
||||||
val isActionExecutingLiveData: LiveData<Boolean> = _isActionExecutingLiveData
|
val isActionExecutingLiveData: LiveData<Boolean> = _isActionExecutingLiveData
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
|
||||||
|
abstract class ViewModelBase : ViewModel() {
|
||||||
|
|
||||||
|
@StringRes abstract fun getTitleId(): Int
|
||||||
|
|
||||||
|
@StringRes abstract fun getTextId(): Int
|
||||||
|
}
|
|
@ -4,7 +4,7 @@ import android.os.Bundle
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.activity.OmnipodWizardActivityBase
|
||||||
|
|
||||||
class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
|
abstract class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment
|
|
||||||
|
|
||||||
import androidx.annotation.IdRes
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
|
||||||
|
|
||||||
class DeactivatePodInfoFragment : InfoFragmentBase() {
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivate_pod_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivate_pod_text
|
|
||||||
|
|
||||||
@IdRes
|
|
||||||
override fun getNextPageActionId(): Int = R.id.action_deactivatePodInfoFragment_to_deactivatePodActionFragment
|
|
||||||
|
|
||||||
override fun getIndex(): Int = 1
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment
|
|
||||||
|
|
||||||
import androidx.annotation.IdRes
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
|
||||||
|
|
||||||
class PodDeactivatedInfoFragment : InfoFragmentBase() {
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_deactivated_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_deactivated_text
|
|
||||||
|
|
||||||
@IdRes
|
|
||||||
override fun getNextPageActionId(): Int? = null
|
|
||||||
|
|
||||||
override fun getIndex(): Int = 3
|
|
||||||
}
|
|
|
@ -1,20 +0,0 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment
|
|
||||||
|
|
||||||
import androidx.annotation.IdRes
|
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
|
||||||
|
|
||||||
class PodDiscardedInfoFragment : InfoFragmentBase() {
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_discarded_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_discarded_text
|
|
||||||
|
|
||||||
@IdRes
|
|
||||||
override fun getNextPageActionId(): Int? = null
|
|
||||||
|
|
||||||
override fun getIndex(): Int = 3
|
|
||||||
}
|
|
|
@ -1,10 +1,9 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.action
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Button
|
import android.widget.Button
|
||||||
import androidx.annotation.IdRes
|
import androidx.annotation.IdRes
|
||||||
import androidx.annotation.StringRes
|
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
@ -12,10 +11,10 @@ import androidx.navigation.fragment.findNavController
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.ActionFragmentBase
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.DeactivatePodActionViewModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DeactivatePodActionFragment : ActionFragmentBase() {
|
class DeactivatePodFragment : ActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
|
@ -26,7 +25,7 @@ class DeactivatePodActionFragment : ActionFragmentBase() {
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
val vm: DeactivatePodActionViewModel by viewModels { viewModelFactory }
|
val vm: DeactivatePodViewModel by viewModels { viewModelFactory }
|
||||||
this.viewModel = vm
|
this.viewModel = vm
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +38,8 @@ class DeactivatePodActionFragment : ActionFragmentBase() {
|
||||||
.setTitle(getString(R.string.omnipod_common_pod_deactivation_wizard_discard_pod))
|
.setTitle(getString(R.string.omnipod_common_pod_deactivation_wizard_discard_pod))
|
||||||
.setMessage(getString(R.string.omnipod_common_pod_deactivation_wizard_discard_pod_confirmation))
|
.setMessage(getString(R.string.omnipod_common_pod_deactivation_wizard_discard_pod_confirmation))
|
||||||
.setPositiveButton(getString(R.string.omnipod_common_yes)) { _, _ ->
|
.setPositiveButton(getString(R.string.omnipod_common_yes)) { _, _ ->
|
||||||
(viewModel as DeactivatePodActionViewModel).discardPod()
|
(actionViewModel as DeactivatePodViewModel).discardPod()
|
||||||
findNavController().navigate(R.id.action_deactivatePodActionFragment_to_podDiscardedInfoFragment)
|
findNavController().navigate(R.id.action_deactivatePodFragment_to_podDiscardedFragment)
|
||||||
}
|
}
|
||||||
.setNegativeButton(getString(R.string.omnipod_common_no), null)
|
.setNegativeButton(getString(R.string.omnipod_common_no), null)
|
||||||
.show()
|
.show()
|
||||||
|
@ -52,14 +51,8 @@ class DeactivatePodActionFragment : ActionFragmentBase() {
|
||||||
buttonDiscardPod.visibility = View.VISIBLE
|
buttonDiscardPod.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivating_pod_title
|
|
||||||
|
|
||||||
@StringRes
|
|
||||||
override fun getTextId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivating_pod_text
|
|
||||||
|
|
||||||
@IdRes
|
@IdRes
|
||||||
override fun getNextPageActionId(): Int = R.id.action_deactivatePodActionFragment_to_podDeactivatedInfoFragment
|
override fun getNextPageActionId(): Int = R.id.action_deactivatePodFragment_to_podDeactivatedFragment
|
||||||
|
|
||||||
override fun getIndex(): Int = 2
|
override fun getIndex(): Int = 2
|
||||||
}
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.annotation.IdRes
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class PodDeactivatedFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val vm: PodDeactivatedViewModel by viewModels { viewModelFactory }
|
||||||
|
this.viewModel = vm
|
||||||
|
}
|
||||||
|
|
||||||
|
@IdRes
|
||||||
|
override fun getNextPageActionId(): Int? = null
|
||||||
|
|
||||||
|
override fun getIndex(): Int = 3
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.annotation.IdRes
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class PodDiscardedFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val vm: PodDiscardedViewModel by viewModels { viewModelFactory }
|
||||||
|
this.viewModel = vm
|
||||||
|
}
|
||||||
|
|
||||||
|
@IdRes
|
||||||
|
override fun getNextPageActionId(): Int? = null
|
||||||
|
|
||||||
|
override fun getIndex(): Int = 3
|
||||||
|
}
|
|
@ -0,0 +1,30 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info
|
||||||
|
|
||||||
|
import android.os.Bundle
|
||||||
|
import androidx.annotation.IdRes
|
||||||
|
import androidx.fragment.app.viewModels
|
||||||
|
import androidx.lifecycle.ViewModelProvider
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class StartPodDeactivationFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
||||||
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
val vm: StartPodDeactivationViewModel by viewModels { viewModelFactory }
|
||||||
|
this.viewModel = vm
|
||||||
|
}
|
||||||
|
|
||||||
|
@IdRes
|
||||||
|
override fun getNextPageActionId(): Int = R.id.action_startPodDeactivationFragment_to_deactivatePodFragment
|
||||||
|
|
||||||
|
override fun getIndex(): Int = 1
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ActionViewModelBase
|
||||||
|
|
||||||
|
abstract class DeactivatePodViewModel : ActionViewModelBase() {
|
||||||
|
|
||||||
|
abstract fun discardPod()
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class PodDeactivatedViewModel : ViewModelBase()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class PodDiscardedViewModel : ViewModelBase()
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ViewModelBase
|
||||||
|
|
||||||
|
abstract class StartPodDeactivationViewModel : ViewModelBase()
|
|
@ -1,41 +1,41 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
app:startDestination="@id/fillPodInfoFragment">
|
app:startDestination="@id/startPodActivationFragment">
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/fillPodInfoFragment"
|
android:id="@+id/startPodActivationFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.FillPodInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.StartPodActivationFragment"
|
||||||
android:label="FillPodInfoFragment">
|
android:label="StartPodActivationFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_fillPodInfoFragment_to_initializePodActionFragment"
|
android:id="@+id/action_startPodActivationFragment_to_initializePodFragment"
|
||||||
app:destination="@id/initializePodActionFragment" />
|
app:destination="@id/initializePodFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/initializePodActionFragment"
|
android:id="@+id/initializePodFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.InitializePodActionFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action.InitializePodFragment"
|
||||||
android:label="initializePodActionFragment">
|
android:label="InitializePodFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_initializePodActionFragment_to_attachPodInfoFragment"
|
android:id="@+id/action_initializePodFragment_to_attachPodFragment"
|
||||||
app:destination="@id/attachPodInfoFragment" />
|
app:destination="@id/attachPodFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/attachPodInfoFragment"
|
android:id="@+id/attachPodFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.AttachPodInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.AttachPodFragment"
|
||||||
android:label="AttachPodInfoFragment">
|
android:label="AttachPodFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_attachPodInfoFragment_to_insertCannulaActionFragment"
|
android:id="@+id/action_attachPodFragment_to_insertCannulaFragment"
|
||||||
app:destination="@id/insertCannulaActionFragment" />
|
app:destination="@id/insertCannulaFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/insertCannulaActionFragment"
|
android:id="@+id/insertCannulaFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.InsertCannulaActionFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.action.InsertCannulaFragment"
|
||||||
android:label="InsertCannulaActionFragment">
|
android:label="InsertCannulaFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_insertCannulaActionFragment_to_PodActivatedInfoFragment"
|
android:id="@+id/action_insertCannulaFragment_to_PodActivatedFragment"
|
||||||
app:destination="@id/PodActivatedInfoFragment" />
|
app:destination="@id/PodActivatedFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/PodActivatedInfoFragment"
|
android:id="@+id/PodActivatedFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.PodActivatedInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.PodActivatedFragment"
|
||||||
android:label="PodActivatedInfoFragment" />
|
android:label="PodActivatedFragment" />
|
||||||
</navigation>
|
</navigation>
|
|
@ -1,32 +1,32 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
app:startDestination="@id/deactivatePodInfoFragment">
|
app:startDestination="@id/startPodDeactivationFragment">
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/deactivatePodInfoFragment"
|
android:id="@+id/startPodDeactivationFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.DeactivatePodInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.StartPodDeactivationFragment"
|
||||||
android:label="DeactivatePodInfoFragment">
|
android:label="StartPodDeactivationFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_deactivatePodInfoFragment_to_deactivatePodActionFragment"
|
android:id="@+id/action_startPodDeactivationFragment_to_deactivatePodFragment"
|
||||||
app:destination="@id/deactivatePodActionFragment" />
|
app:destination="@id/deactivatePodFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/deactivatePodActionFragment"
|
android:id="@+id/deactivatePodFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.DeactivatePodActionFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.action.DeactivatePodFragment"
|
||||||
android:label="DeactivatePodActionFragment">
|
android:label="DeactivatePodFragment">
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_deactivatePodActionFragment_to_podDeactivatedInfoFragment"
|
android:id="@+id/action_deactivatePodFragment_to_podDeactivatedFragment"
|
||||||
app:destination="@id/podDeactivatedInfoFragment" />
|
app:destination="@id/podDeactivatedFragment" />
|
||||||
<action
|
<action
|
||||||
android:id="@+id/action_deactivatePodActionFragment_to_podDiscardedInfoFragment"
|
android:id="@+id/action_deactivatePodFragment_to_podDiscardedFragment"
|
||||||
app:destination="@id/podDiscardedInfoFragment" />
|
app:destination="@id/podDiscardedFragment" />
|
||||||
</fragment>
|
</fragment>
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/podDeactivatedInfoFragment"
|
android:id="@+id/podDeactivatedFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.PodDeactivatedInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.PodDeactivatedFragment"
|
||||||
android:label="PodDeactivatedInfoFragment" />
|
android:label="PodDeactivatedFragment" />
|
||||||
<fragment
|
<fragment
|
||||||
android:id="@+id/podDiscardedInfoFragment"
|
android:id="@+id/podDiscardedFragment"
|
||||||
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.PodDiscardedInfoFragment"
|
android:name="info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.PodDiscardedFragment"
|
||||||
android:label="PodDiscardedInfoFragment" />
|
android:label="PodDiscardedFragment" />
|
||||||
</navigation>
|
</navigation>
|
|
@ -94,7 +94,7 @@
|
||||||
<string name="omnipod_common_wizard_exit_confirmation_title">Exit</string>
|
<string name="omnipod_common_wizard_exit_confirmation_title">Exit</string>
|
||||||
|
|
||||||
<!-- Omnipod - Pod Activation Wizard -->
|
<!-- Omnipod - Pod Activation Wizard -->
|
||||||
<string name="omnipod_common_pod_activation_wizard_fill_pod_title">Fill Pod</string>
|
<string name="omnipod_common_pod_activation_wizard_start_pod_activation_title">Fill Pod</string>
|
||||||
<string name="omnipod_common_pod_activation_wizard_initialize_pod_title">Initialize Pod</string>
|
<string name="omnipod_common_pod_activation_wizard_initialize_pod_title">Initialize Pod</string>
|
||||||
<string name="omnipod_common_pod_activation_wizard_attach_pod_title">Attach Pod</string>
|
<string name="omnipod_common_pod_activation_wizard_attach_pod_title">Attach Pod</string>
|
||||||
<string name="omnipod_common_pod_activation_wizard_attach_pod_text">Prepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
|
<string name="omnipod_common_pod_activation_wizard_attach_pod_text">Prepare the infusion site. Remove the Pod\'s needle cap and adhesive backing and attach the Pod to the infusion site.\n\nIf the cannula sticks out, please press <b>Cancel</b> and discard your Pod.\n\nPress <b>Next</b> to insert the cannula and begin basal delivery.</string>
|
||||||
|
@ -105,8 +105,8 @@
|
||||||
<string name="omnipod_common_pod_activation_wizard_pod_activated_text">The new Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and change your Pod if you think it has not.</string>
|
<string name="omnipod_common_pod_activation_wizard_pod_activated_text">The new Pod is now active.\n\nYour basal schedule has been programmed and the cannula has been inserted.\n\nPlease verify that the cannula has been inserted correctly and change your Pod if you think it has not.</string>
|
||||||
|
|
||||||
<!-- Omnipod - Pod Deactivation Wizard -->
|
<!-- Omnipod - Pod Deactivation Wizard -->
|
||||||
<string name="omnipod_common_pod_deactivation_wizard_deactivate_pod_title">Deactivate Pod</string>
|
<string name="omnipod_common_pod_deactivation_wizard_start_pod_deactivation_title">Deactivate Pod</string>
|
||||||
<string name="omnipod_common_pod_deactivation_wizard_deactivate_pod_text">Press <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
|
<string name="omnipod_common_pod_deactivation_wizard_start_pod_deactivation_text">Press <b>Next</b> to deactivate the Pod.\n\n<b>Note:</b> This will suspend all insulin delivery and deactivate the Pod.</string>
|
||||||
<string name="omnipod_common_pod_deactivation_wizard_deactivating_pod_title">Deactivating Pod</string>
|
<string name="omnipod_common_pod_deactivation_wizard_deactivating_pod_title">Deactivating Pod</string>
|
||||||
<string name="omnipod_common_pod_deactivation_wizard_deactivating_pod_text">Deactivating the Pod.\n\nWhen deactivation has completed successfully, you can press <b>Next</b>.</string>
|
<string name="omnipod_common_pod_deactivation_wizard_deactivating_pod_text">Deactivating the Pod.\n\nWhen deactivation has completed successfully, you can press <b>Next</b>.</string>
|
||||||
<string name="omnipod_common_pod_deactivation_wizard_pod_deactivated_title">Pod Deactivated</string>
|
<string name="omnipod_common_pod_deactivation_wizard_pod_deactivated_title">Pod Deactivated</string>
|
||||||
|
|
|
@ -2,6 +2,7 @@ package info.nightscout.androidaps.plugins.pump.omnipod.dash;
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -82,11 +83,11 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void connect(String reason) {
|
@Override public void connect(@NotNull String reason) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void disconnect(String reason) {
|
@Override public void disconnect(@NotNull String reason) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,15 +95,15 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void getPumpStatus(String reason) {
|
@Override public void getPumpStatus(@NotNull String reason) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult setNewBasalProfile(Profile profile) {
|
@NotNull @Override public PumpEnactResult setNewBasalProfile(@NotNull Profile profile) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public boolean isThisProfileSet(Profile profile) {
|
@Override public boolean isThisProfileSet(@NotNull Profile profile) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +123,7 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo) {
|
@NotNull @Override public PumpEnactResult deliverTreatment(@NotNull DetailedBolusInfo detailedBolusInfo) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,47 +131,47 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
@NotNull @Override public PumpEnactResult setTempBasalAbsolute(double absoluteRate, int durationInMinutes, @NotNull Profile profile, boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, Profile profile, boolean enforceNew) {
|
@NotNull @Override public PumpEnactResult setTempBasalPercent(int percent, int durationInMinutes, @NotNull Profile profile, boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes) {
|
@NotNull @Override public PumpEnactResult setExtendedBolus(double insulin, int durationInMinutes) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
@NotNull @Override public PumpEnactResult cancelTempBasal(boolean enforceNew) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult cancelExtendedBolus() {
|
@NotNull @Override public PumpEnactResult cancelExtendedBolus() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public JSONObject getJSONStatus(Profile profile, String profileName, String version) {
|
@NotNull @Override public JSONObject getJSONStatus(@NotNull Profile profile, @NotNull String profileName, @NotNull String version) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public ManufacturerType manufacturer() {
|
@NotNull @Override public ManufacturerType manufacturer() {
|
||||||
return getPumpDescription().pumpType.getManufacturer();
|
return getPumpDescription().pumpType.getManufacturer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpType model() {
|
@NotNull @Override public PumpType model() {
|
||||||
return getPumpDescription().pumpType;
|
return getPumpDescription().pumpType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String serialNumber() {
|
@NotNull @Override public String serialNumber() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpDescription getPumpDescription() {
|
@NotNull @Override public PumpDescription getPumpDescription() {
|
||||||
return PUMP_DESCRIPTION;
|
return PUMP_DESCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public String shortStatus(boolean veryShort) {
|
@NotNull @Override public String shortStatus(boolean veryShort) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -178,7 +179,7 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public PumpEnactResult loadTDDs() {
|
@NotNull @Override public PumpEnactResult loadTDDs() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -192,15 +193,15 @@ public class OmnipodDashPumpPlugin extends PumpPluginBase implements PumpInterfa
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeCustomAction(CustomActionType customActionType) {
|
public void executeCustomAction(@NotNull CustomActionType customActionType) {
|
||||||
aapsLogger.warn(LTag.PUMP, "Unknown custom action: " + customActionType);
|
aapsLogger.warn(LTag.PUMP, "Unsupported custom action: " + customActionType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable @Override public PumpEnactResult executeCustomCommand(CustomCommand customCommand) {
|
@Nullable @Override public PumpEnactResult executeCustomCommand(@NotNull CustomCommand customCommand) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void timezoneOrDSTChanged(TimeChangeType timeChangeType) {
|
@Override public void timezoneOrDSTChanged(@NotNull TimeChangeType timeChangeType) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,16 +5,30 @@ import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
import dagger.android.support.DaggerFragment
|
import dagger.android.support.DaggerFragment
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonOverviewButtonsBinding
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonOverviewPodInfoBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBinding
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dash.databinding.OmnipodDashOverviewBluetoothStatusBinding
|
||||||
|
|
||||||
class OmnipodDashOverviewFragment : DaggerFragment() {
|
class OmnipodDashOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
private var _binding: OmnipodDashOverviewBinding? = null
|
var _binding: OmnipodDashOverviewBinding? = null
|
||||||
|
var _bluetoothStatusBinding: OmnipodDashOverviewBluetoothStatusBinding? = null
|
||||||
|
var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
||||||
|
var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
||||||
|
|
||||||
// This property is only valid between onCreateView and
|
// These properties are only valid between onCreateView and
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
private val binding get() = _binding!!
|
val binding get() = _binding!!
|
||||||
|
val bluetoothStatusBinding get() = _bluetoothStatusBinding!!
|
||||||
|
val podInfoBinding get() = _podInfoBinding!!
|
||||||
|
val buttonBinding get() = _buttonBinding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||||
OmnipodDashOverviewBinding.inflate(inflater, container!!).also { _binding = it }.root
|
OmnipodDashOverviewBinding.inflate(inflater, container, false).also {
|
||||||
|
_buttonBinding = OmnipodCommonOverviewButtonsBinding.bind(it.root)
|
||||||
|
_podInfoBinding = OmnipodCommonOverviewPodInfoBinding.bind(it.root)
|
||||||
|
_bluetoothStatusBinding = OmnipodDashOverviewBluetoothStatusBinding.bind(it.root)
|
||||||
|
_binding = it
|
||||||
|
}.root
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -24,13 +24,9 @@
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:background="@color/list_delimiter" />
|
android:background="@color/list_delimiter" />
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_dash_overview_bluetooth_status" />
|
||||||
android:id="@+id/bluetooth_status"
|
|
||||||
layout="@layout/omnipod_dash_overview_bluetooth_status" />
|
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_common_overview_pod_info" />
|
||||||
android:id="@+id/pod_info"
|
|
||||||
layout="@layout/omnipod_common_overview_pod_info" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -43,10 +39,8 @@
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_common_overview_buttons" />
|
||||||
android:id="@+id/buttons"
|
|
||||||
layout="@layout/omnipod_common_overview_buttons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</merge>
|
</RelativeLayout>
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
android:enabled="true"
|
android:enabled="true"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
|
<activity android:name=".ui.wizard.activation.ErosPodActivationWizardActivity" />
|
||||||
|
<activity android:name=".ui.wizard.deactivation.ErosPodDeactivationWizardActivity" />
|
||||||
<activity android:name=".ui.ErosPodManagementActivity" />
|
<activity android:name=".ui.ErosPodManagementActivity" />
|
||||||
<activity android:name=".ui.ErosPodHistoryActivity" />
|
<activity android:name=".ui.ErosPodHistoryActivity" />
|
||||||
</application>
|
</application>
|
||||||
|
|
|
@ -3,27 +3,40 @@ package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import dagger.android.ContributesAndroidInjector
|
import dagger.android.ContributesAndroidInjector
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ActivityScope
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.data.RLHistoryItemOmnipod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.rileylink.manager.OmnipodRileyLinkCommunicationManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.ErosPodHistoryActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.ErosPodHistoryActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.ErosPodManagementActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.ErosPodManagementActivity
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.ErosPodActivationWizardActivity
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.ErosPodDeactivationWizardActivity
|
||||||
|
|
||||||
@Module
|
@Module
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
abstract class OmnipodErosModule {
|
abstract class OmnipodErosModule {
|
||||||
|
|
||||||
// Activities
|
// ACTIVITIES
|
||||||
|
@ActivityScope
|
||||||
|
@ContributesAndroidInjector(modules = [OmnipodErosWizardModule::class])
|
||||||
|
abstract fun contributesActivationWizardActivity(): ErosPodActivationWizardActivity
|
||||||
|
|
||||||
|
@ActivityScope
|
||||||
|
@ContributesAndroidInjector(modules = [OmnipodErosWizardModule::class])
|
||||||
|
abstract fun contributesDeactivationWizardActivity(): ErosPodDeactivationWizardActivity
|
||||||
|
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract fun contributesPodManagementActivity(): ErosPodManagementActivity
|
abstract fun contributesPodManagementActivity(): ErosPodManagementActivity
|
||||||
@ContributesAndroidInjector abstract fun contributesPodHistoryActivity(): ErosPodHistoryActivity
|
@ContributesAndroidInjector abstract fun contributesPodHistoryActivity(): ErosPodHistoryActivity
|
||||||
|
|
||||||
// Service
|
// SERVICES
|
||||||
|
|
||||||
@ContributesAndroidInjector
|
@ContributesAndroidInjector
|
||||||
abstract fun omnipodCommunicationManagerProvider(): OmnipodRileyLinkCommunicationManager
|
abstract fun omnipodCommunicationManagerProvider(): OmnipodRileyLinkCommunicationManager
|
||||||
|
|
||||||
// Data
|
// DATA
|
||||||
|
|
||||||
@ContributesAndroidInjector abstract fun rlHistoryItemOmnipod(): RLHistoryItemOmnipod
|
@ContributesAndroidInjector abstract fun rlHistoryItemOmnipod(): RLHistoryItemOmnipod
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.dagger
|
||||||
|
|
||||||
|
import androidx.lifecycle.ViewModel
|
||||||
|
import dagger.Binds
|
||||||
|
import dagger.Module
|
||||||
|
import dagger.multibindings.IntoMap
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.OmnipodPluginQualifier
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.dagger.ViewModelKey
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.action.ErosInitializePodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.action.ErosInsertCannulaViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info.ErosAttachPodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info.ErosPodActivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info.ErosStartPodActivationViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.action.ErosDeactivatePodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info.ErosPodDeactivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info.ErosPodDiscardedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info.ErosStartPodDeactivationViewModel
|
||||||
|
|
||||||
|
@Module
|
||||||
|
@Suppress("unused")
|
||||||
|
abstract class OmnipodErosWizardModule {
|
||||||
|
// #### VIEW MODELS ############################################################################
|
||||||
|
|
||||||
|
// POD ACTIVATION
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(ErosStartPodActivationViewModel::class)
|
||||||
|
internal abstract fun startPodActivationViewModel(viewModel: ErosStartPodActivationViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(InitializePodViewModel::class)
|
||||||
|
internal abstract fun initializePodViewModel(viewModel: ErosInitializePodViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(AttachPodViewModel::class)
|
||||||
|
internal abstract fun attachPodViewModel(viewModel: ErosAttachPodViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(InsertCannulaViewModel::class)
|
||||||
|
internal abstract fun insertCannulaViewModel(viewModel: ErosInsertCannulaViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(PodActivatedViewModel::class)
|
||||||
|
internal abstract fun podActivatedViewModel(viewModel: ErosPodActivatedViewModel): ViewModel
|
||||||
|
|
||||||
|
// POD DEACTIVATION
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(StartPodDeactivationViewModel::class)
|
||||||
|
internal abstract fun startPodDeactivationViewModel(viewModel: ErosStartPodDeactivationViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(DeactivatePodViewModel::class)
|
||||||
|
internal abstract fun deactivatePodViewModel(viewModel: ErosDeactivatePodViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(PodDeactivatedViewModel::class)
|
||||||
|
internal abstract fun podDeactivatedViewModel(viewModel: ErosPodDeactivatedViewModel): ViewModel
|
||||||
|
|
||||||
|
@Binds
|
||||||
|
@IntoMap
|
||||||
|
@OmnipodPluginQualifier
|
||||||
|
@ViewModelKey(PodDiscardedViewModel::class)
|
||||||
|
internal abstract fun podDiscardedViewModel(viewModel: ErosPodDiscardedViewModel): ViewModel
|
||||||
|
}
|
|
@ -132,7 +132,7 @@ public class ErosPodHistoryActivity extends NoSplashAppCompatActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
setContentView(R.layout.omnipod_pod_history_activity);
|
setContentView(R.layout.omnipod_eros_pod_history_activity);
|
||||||
|
|
||||||
historyTypeSpinner = findViewById(R.id.omnipod_historytype);
|
historyTypeSpinner = findViewById(R.id.omnipod_historytype);
|
||||||
statusView = findViewById(R.id.omnipod_historystatus);
|
statusView = findViewById(R.id.omnipod_historystatus);
|
||||||
|
@ -223,7 +223,7 @@ public class ErosPodHistoryActivity extends NoSplashAppCompatActivity {
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
public HistoryViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||||
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.omnipod_pod_history_item, //
|
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.omnipod_eros_pod_history_item, //
|
||||||
viewGroup, false);
|
viewGroup, false);
|
||||||
return new HistoryViewHolder(v);
|
return new HistoryViewHolder(v);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,15 +15,16 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.tasks.ServiceTaskExecutor
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandPlayTestBeep
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodPodManagementBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodErosPodManagementBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.manager.PodStateManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.event.EventOmnipodErosPumpValuesChanged
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandReadPulseLog
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.queue.command.CommandReadPulseLog
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.ErosPodActivationWizardActivity
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.ErosPodDeactivationWizardActivity
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
import info.nightscout.androidaps.queue.events.EventQueueChanged
|
||||||
import info.nightscout.androidaps.utils.FabricPrivacy
|
import info.nightscout.androidaps.utils.FabricPrivacy
|
||||||
|
@ -54,12 +55,12 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
private var disposables: CompositeDisposable = CompositeDisposable()
|
private var disposables: CompositeDisposable = CompositeDisposable()
|
||||||
|
|
||||||
private lateinit var binding: OmnipodPodManagementBinding
|
private lateinit var binding: OmnipodErosPodManagementBinding
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
binding = OmnipodPodManagementBinding.inflate(layoutInflater)
|
binding = OmnipodErosPodManagementBinding.inflate(layoutInflater)
|
||||||
setContentView(binding.root)
|
setContentView(binding.root)
|
||||||
|
|
||||||
binding.buttonActivatePod.setOnClickListener {
|
binding.buttonActivatePod.setOnClickListener {
|
||||||
|
@ -70,13 +71,13 @@ class ErosPodManagementActivity : NoSplashAppCompatActivity() {
|
||||||
PodActivationWizardActivity.Type.LONG
|
PodActivationWizardActivity.Type.LONG
|
||||||
}
|
}
|
||||||
|
|
||||||
val intent = Intent(this, PodActivationWizardActivity::class.java)
|
val intent = Intent(this, ErosPodActivationWizardActivity::class.java)
|
||||||
intent.putExtra(PodActivationWizardActivity.KEY_TYPE, type)
|
intent.putExtra(PodActivationWizardActivity.KEY_TYPE, type)
|
||||||
startActivity(intent)
|
startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttonDeactivatePod.setOnClickListener {
|
binding.buttonDeactivatePod.setOnClickListener {
|
||||||
startActivity(Intent(this, PodDeactivationWizardActivity::class.java))
|
startActivity(Intent(this, ErosPodDeactivationWizardActivity::class.java))
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttonDiscardPod.setOnClickListener {
|
binding.buttonDiscardPod.setOnClickListener {
|
||||||
|
|
|
@ -22,6 +22,8 @@ import info.nightscout.androidaps.plugins.pump.common.events.EventRileyLinkDevic
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.defs.RileyLinkServiceState
|
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.defs.RileyLinkTargetDevice
|
||||||
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.RileyLinkServiceData
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonOverviewButtonsBinding
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.databinding.OmnipodCommonOverviewPodInfoBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandAcknowledgeAlerts
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandAcknowledgeAlerts
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandHandleTimeChange
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandHandleTimeChange
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandResumeDelivery
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandResumeDelivery
|
||||||
|
@ -29,6 +31,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.Comm
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.OmnipodErosPumpPlugin
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodErosOverviewBinding
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodErosOverviewBinding
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.databinding.OmnipodErosOverviewRileyLinkStatusBinding
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.OmnipodConstants
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.PodProgressStatus
|
||||||
|
@ -94,20 +97,29 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var _binding: OmnipodErosOverviewBinding? = null
|
var _binding: OmnipodErosOverviewBinding? = null
|
||||||
|
var _rileyLinkStatusBinding: OmnipodErosOverviewRileyLinkStatusBinding? = null
|
||||||
|
var _podInfoBinding: OmnipodCommonOverviewPodInfoBinding? = null
|
||||||
|
var _buttonBinding: OmnipodCommonOverviewButtonsBinding? = null
|
||||||
|
|
||||||
// This property is only valid between onCreateView and
|
// These properties are only valid between onCreateView and
|
||||||
// onDestroyView.
|
// onDestroyView.
|
||||||
val binding get() = _binding!!
|
val binding get() = _binding!!
|
||||||
|
val rileyLinkStatusBinding get() = _rileyLinkStatusBinding!!
|
||||||
|
val podInfoBinding get() = _podInfoBinding!!
|
||||||
|
val buttonBinding get() = _buttonBinding!!
|
||||||
|
|
||||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
|
||||||
OmnipodErosOverviewBinding.inflate(inflater, container!!).also {
|
OmnipodErosOverviewBinding.inflate(inflater, container, false).also {
|
||||||
|
_buttonBinding = OmnipodCommonOverviewButtonsBinding.bind(it.root)
|
||||||
|
_podInfoBinding = OmnipodCommonOverviewPodInfoBinding.bind(it.root)
|
||||||
|
_rileyLinkStatusBinding = OmnipodErosOverviewRileyLinkStatusBinding.bind(it.root)
|
||||||
_binding = it
|
_binding = it
|
||||||
}.root
|
}.root
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
binding.buttons.buttonPodManagement.setOnClickListener {
|
buttonBinding.buttonPodManagement.setOnClickListener {
|
||||||
if (omnipodErosPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
|
if (omnipodErosPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
|
||||||
activity?.let { activity ->
|
activity?.let { activity ->
|
||||||
context?.let { context ->
|
context?.let { context ->
|
||||||
|
@ -122,19 +134,19 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttons.buttonResumeDelivery.setOnClickListener {
|
buttonBinding.buttonResumeDelivery.setOnClickListener {
|
||||||
disablePodActionButtons()
|
disablePodActionButtons()
|
||||||
commandQueue.customCommand(CommandResumeDelivery(),
|
commandQueue.customCommand(CommandResumeDelivery(),
|
||||||
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_resume_delivery), true).messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_delivery_resumed)))
|
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_resume_delivery), true).messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_delivery_resumed)))
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttons.buttonRefreshStatus.setOnClickListener {
|
buttonBinding.buttonRefreshStatus.setOnClickListener {
|
||||||
disablePodActionButtons()
|
disablePodActionButtons()
|
||||||
commandQueue.customCommand(CommandGetPodStatus(),
|
commandQueue.customCommand(CommandGetPodStatus(),
|
||||||
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_refresh_status), false))
|
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_refresh_status), false))
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttons.buttonSilenceAlerts.setOnClickListener {
|
buttonBinding.buttonSilenceAlerts.setOnClickListener {
|
||||||
disablePodActionButtons()
|
disablePodActionButtons()
|
||||||
commandQueue.customCommand(CommandAcknowledgeAlerts(),
|
commandQueue.customCommand(CommandAcknowledgeAlerts(),
|
||||||
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_silence_alerts), false)
|
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_silence_alerts), false)
|
||||||
|
@ -142,14 +154,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
.actionOnSuccess { rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_ALERTS)) })
|
.actionOnSuccess { rxBus.send(EventDismissNotification(Notification.OMNIPOD_POD_ALERTS)) })
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttons.buttonSuspendDelivery.setOnClickListener {
|
buttonBinding.buttonSuspendDelivery.setOnClickListener {
|
||||||
disablePodActionButtons()
|
disablePodActionButtons()
|
||||||
commandQueue.customCommand(CommandSuspendDelivery(),
|
commandQueue.customCommand(CommandSuspendDelivery(),
|
||||||
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_suspend_delivery), true)
|
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_suspend_delivery), true)
|
||||||
.messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_suspended_delivery)))
|
.messageOnSuccess(resourceHelper.gs(R.string.omnipod_common_confirmation_suspended_delivery)))
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.buttons.buttonSetTime.setOnClickListener {
|
buttonBinding.buttonSetTime.setOnClickListener {
|
||||||
disablePodActionButtons()
|
disablePodActionButtons()
|
||||||
commandQueue.customCommand(CommandHandleTimeChange(true),
|
commandQueue.customCommand(CommandHandleTimeChange(true),
|
||||||
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_set_time), true)
|
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_common_error_failed_to_set_time), true)
|
||||||
|
@ -216,7 +228,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
val resourceId = rileyLinkServiceState.resourceId
|
val resourceId = rileyLinkServiceState.resourceId
|
||||||
val rileyLinkError = rileyLinkServiceData.rileyLinkError
|
val rileyLinkError = rileyLinkServiceData.rileyLinkError
|
||||||
|
|
||||||
binding.rileyLink.rileyLinkStatus.text =
|
rileyLinkStatusBinding.rileyLinkStatus.text =
|
||||||
when {
|
when {
|
||||||
rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
|
rileyLinkServiceState == RileyLinkServiceState.NotStarted -> resourceHelper.gs(resourceId)
|
||||||
rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
rileyLinkServiceState.isConnecting -> "{fa-bluetooth-b spin} " + resourceHelper.gs(resourceId)
|
||||||
|
@ -224,7 +236,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
rileyLinkServiceState.isError && rileyLinkError != null -> "{fa-bluetooth-b} " + resourceHelper.gs(rileyLinkError.getResourceId(RileyLinkTargetDevice.Omnipod))
|
||||||
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
else -> "{fa-bluetooth-b} " + resourceHelper.gs(resourceId)
|
||||||
}
|
}
|
||||||
binding.rileyLink.rileyLinkStatus.setTextColor(if (rileyLinkServiceState.isError || rileyLinkError != null) Color.RED else Color.WHITE)
|
rileyLinkStatusBinding.rileyLinkStatus.setTextColor(if (rileyLinkServiceState.isError || rileyLinkError != null) Color.RED else Color.WHITE)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateOmnipodStatus() {
|
private fun updateOmnipodStatus() {
|
||||||
|
@ -242,41 +254,41 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!podStateManager.hasPodState() || !podStateManager.isPodInitialized) {
|
if (!podStateManager.hasPodState() || !podStateManager.isPodInitialized) {
|
||||||
binding.podInfo.podAddress.text = if (podStateManager.hasPodState()) {
|
podInfoBinding.podAddress.text = if (podStateManager.hasPodState()) {
|
||||||
podStateManager.address.toString()
|
podStateManager.address.toString()
|
||||||
} else {
|
} else {
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
}
|
}
|
||||||
binding.podInfo.podLot.text = PLACEHOLDER
|
podInfoBinding.podLot.text = PLACEHOLDER
|
||||||
binding.podInfo.podTid.text = PLACEHOLDER
|
podInfoBinding.podTid.text = PLACEHOLDER
|
||||||
binding.podInfo.firmwareVersion.text = PLACEHOLDER
|
podInfoBinding.firmwareVersion.text = PLACEHOLDER
|
||||||
binding.podInfo.timeOnPod.text = PLACEHOLDER
|
podInfoBinding.timeOnPod.text = PLACEHOLDER
|
||||||
binding.podInfo.podExpiryDate.text = PLACEHOLDER
|
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||||
binding.podInfo.podExpiryDate.setTextColor(Color.WHITE)
|
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
||||||
binding.podInfo.baseBasalRate.text = PLACEHOLDER
|
podInfoBinding.baseBasalRate.text = PLACEHOLDER
|
||||||
binding.podInfo.totalDelivered.text = PLACEHOLDER
|
podInfoBinding.totalDelivered.text = PLACEHOLDER
|
||||||
binding.podInfo.reservoir.text = PLACEHOLDER
|
podInfoBinding.reservoir.text = PLACEHOLDER
|
||||||
binding.podInfo.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
||||||
binding.podInfo.podActiveAlerts.text = PLACEHOLDER
|
podInfoBinding.podActiveAlerts.text = PLACEHOLDER
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.podAddress.text = podStateManager.address.toString()
|
podInfoBinding.podAddress.text = podStateManager.address.toString()
|
||||||
binding.podInfo.podLot.text = podStateManager.lot.toString()
|
podInfoBinding.podLot.text = podStateManager.lot.toString()
|
||||||
binding.podInfo.podTid.text = podStateManager.tid.toString()
|
podInfoBinding.podTid.text = podStateManager.tid.toString()
|
||||||
binding.podInfo.firmwareVersion.text = resourceHelper.gs(R.string.omnipod_eros_overview_firmware_version_value, podStateManager.pmVersion.toString(), podStateManager.piVersion.toString())
|
podInfoBinding.firmwareVersion.text = resourceHelper.gs(R.string.omnipod_eros_overview_firmware_version_value, podStateManager.pmVersion.toString(), podStateManager.piVersion.toString())
|
||||||
|
|
||||||
binding.podInfo.timeOnPod.text = readableZonedTime(podStateManager.time)
|
podInfoBinding.timeOnPod.text = readableZonedTime(podStateManager.time)
|
||||||
binding.podInfo.timeOnPod.setTextColor(if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
podInfoBinding.timeOnPod.setTextColor(if (podStateManager.timeDeviatesMoreThan(OmnipodConstants.TIME_DEVIATION_THRESHOLD)) {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
})
|
})
|
||||||
val expiresAt = podStateManager.expiresAt
|
val expiresAt = podStateManager.expiresAt
|
||||||
if (expiresAt == null) {
|
if (expiresAt == null) {
|
||||||
binding.podInfo.podExpiryDate.text = PLACEHOLDER
|
podInfoBinding.podExpiryDate.text = PLACEHOLDER
|
||||||
binding.podInfo.podExpiryDate.setTextColor(Color.WHITE)
|
podInfoBinding.podExpiryDate.setTextColor(Color.WHITE)
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.podExpiryDate.text = readableZonedTime(expiresAt)
|
podInfoBinding.podExpiryDate.text = readableZonedTime(expiresAt)
|
||||||
binding.podInfo.podExpiryDate.setTextColor(if (DateTime.now().isAfter(expiresAt)) {
|
podInfoBinding.podExpiryDate.setTextColor(if (DateTime.now().isAfter(expiresAt)) {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
|
@ -289,14 +301,14 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// base basal rate
|
// base basal rate
|
||||||
binding.podInfo.baseBasalRate.text = if (podStateManager.isPodActivationCompleted) {
|
podInfoBinding.baseBasalRate.text = if (podStateManager.isPodActivationCompleted) {
|
||||||
resourceHelper.gs(R.string.pump_basebasalrate, omnipodErosPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now()))))
|
resourceHelper.gs(R.string.pump_basebasalrate, omnipodErosPumpPlugin.model().determineCorrectBasalSize(podStateManager.basalSchedule.rateAt(TimeUtil.toDuration(DateTime.now()))))
|
||||||
} else {
|
} else {
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
}
|
}
|
||||||
|
|
||||||
// total delivered
|
// total delivered
|
||||||
binding.podInfo.totalDelivered.text = if (podStateManager.isPodActivationCompleted && podStateManager.totalInsulinDelivered != null) {
|
podInfoBinding.totalDelivered.text = if (podStateManager.isPodActivationCompleted && podStateManager.totalInsulinDelivered != null) {
|
||||||
resourceHelper.gs(R.string.omnipod_common_overview_total_delivered_value, podStateManager.totalInsulinDelivered - OmnipodConstants.POD_SETUP_UNITS)
|
resourceHelper.gs(R.string.omnipod_common_overview_total_delivered_value, podStateManager.totalInsulinDelivered - OmnipodConstants.POD_SETUP_UNITS)
|
||||||
} else {
|
} else {
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
|
@ -304,21 +316,21 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
|
|
||||||
// reservoir
|
// reservoir
|
||||||
if (podStateManager.reservoirLevel == null) {
|
if (podStateManager.reservoirLevel == null) {
|
||||||
binding.podInfo.reservoir.text = resourceHelper.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
podInfoBinding.reservoir.text = resourceHelper.gs(R.string.omnipod_common_overview_reservoir_value_over50)
|
||||||
binding.podInfo.reservoir.setTextColor(Color.WHITE)
|
podInfoBinding.reservoir.setTextColor(Color.WHITE)
|
||||||
} else {
|
} else {
|
||||||
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
val lowReservoirThreshold = (omnipodAlertUtil.lowReservoirAlertUnits
|
||||||
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
|
?: OmnipodConstants.DEFAULT_MAX_RESERVOIR_ALERT_THRESHOLD).toDouble()
|
||||||
|
|
||||||
binding.podInfo.reservoir.text = resourceHelper.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
podInfoBinding.reservoir.text = resourceHelper.gs(R.string.omnipod_common_overview_reservoir_value, podStateManager.reservoirLevel)
|
||||||
binding.podInfo.reservoir.setTextColor(if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
podInfoBinding.reservoir.setTextColor(if (podStateManager.reservoirLevel < lowReservoirThreshold) {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.podInfo.podActiveAlerts.text = if (podStateManager.hasActiveAlerts()) {
|
podInfoBinding.podActiveAlerts.text = if (podStateManager.hasActiveAlerts()) {
|
||||||
TextUtils.join(System.lineSeparator(), omnipodUtil.getTranslatedActiveAlerts(podStateManager))
|
TextUtils.join(System.lineSeparator(), omnipodUtil.getTranslatedActiveAlerts(podStateManager))
|
||||||
} else {
|
} else {
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
|
@ -326,27 +338,27 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errors.size == 0) {
|
if (errors.size == 0) {
|
||||||
binding.podInfo.errors.text = PLACEHOLDER
|
podInfoBinding.errors.text = PLACEHOLDER
|
||||||
binding.podInfo.errors.setTextColor(Color.WHITE)
|
podInfoBinding.errors.setTextColor(Color.WHITE)
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.errors.text = StringUtils.join(errors, System.lineSeparator())
|
podInfoBinding.errors.text = StringUtils.join(errors, System.lineSeparator())
|
||||||
binding.podInfo.errors.setTextColor(Color.RED)
|
podInfoBinding.errors.setTextColor(Color.RED)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLastConnection() {
|
private fun updateLastConnection() {
|
||||||
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
if (podStateManager.isPodInitialized && podStateManager.lastSuccessfulCommunication != null) {
|
||||||
binding.podInfo.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
podInfoBinding.lastConnection.text = readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||||
val lastConnectionColor =
|
val lastConnectionColor =
|
||||||
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
if (omnipodErosPumpPlugin.isUnreachableAlertTimeoutExceeded(getPumpUnreachableTimeout().millis)) {
|
||||||
Color.RED
|
Color.RED
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
}
|
}
|
||||||
binding.podInfo.lastConnection.setTextColor(lastConnectionColor)
|
podInfoBinding.lastConnection.setTextColor(lastConnectionColor)
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.lastConnection.setTextColor(Color.WHITE)
|
podInfoBinding.lastConnection.setTextColor(Color.WHITE)
|
||||||
binding.podInfo.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
|
podInfoBinding.lastConnection.text = if (podStateManager.hasPodState() && podStateManager.lastSuccessfulCommunication != null) {
|
||||||
readableDuration(podStateManager.lastSuccessfulCommunication)
|
readableDuration(podStateManager.lastSuccessfulCommunication)
|
||||||
} else {
|
} else {
|
||||||
PLACEHOLDER
|
PLACEHOLDER
|
||||||
|
@ -355,7 +367,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updatePodStatus() {
|
private fun updatePodStatus() {
|
||||||
binding.podInfo.podStatus.text = if (!podStateManager.hasPodState()) {
|
podInfoBinding.podStatus.text = if (!podStateManager.hasPodState()) {
|
||||||
resourceHelper.gs(R.string.omnipod_common_pod_status_no_active_pod)
|
resourceHelper.gs(R.string.omnipod_common_pod_status_no_active_pod)
|
||||||
} else if (!podStateManager.isPodActivationCompleted) {
|
} else if (!podStateManager.isPodActivationCompleted) {
|
||||||
if (!podStateManager.isPodInitialized) {
|
if (!podStateManager.isPodInitialized) {
|
||||||
|
@ -394,7 +406,7 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
} else {
|
} else {
|
||||||
Color.WHITE
|
Color.WHITE
|
||||||
}
|
}
|
||||||
binding.podInfo.podStatus.setTextColor(podStatusColor)
|
podInfoBinding.podStatus.setTextColor(podStatusColor)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateLastBolus() {
|
private fun updateLastBolus() {
|
||||||
|
@ -409,20 +421,20 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.podInfo.lastBolus.text = text
|
podInfoBinding.lastBolus.text = text
|
||||||
binding.podInfo.lastBolus.setTextColor(textColor)
|
podInfoBinding.lastBolus.setTextColor(textColor)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.lastBolus.text = PLACEHOLDER
|
podInfoBinding.lastBolus.text = PLACEHOLDER
|
||||||
binding.podInfo.lastBolus.setTextColor(Color.WHITE)
|
podInfoBinding.lastBolus.setTextColor(Color.WHITE)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateTempBasal() {
|
private fun updateTempBasal() {
|
||||||
if (podStateManager.isPodActivationCompleted && podStateManager.isTempBasalRunning) {
|
if (podStateManager.isPodActivationCompleted && podStateManager.isTempBasalRunning) {
|
||||||
if (!podStateManager.hasTempBasal()) {
|
if (!podStateManager.hasTempBasal()) {
|
||||||
binding.podInfo.tempBasal.text = "???"
|
podInfoBinding.tempBasal.text = "???"
|
||||||
binding.podInfo.tempBasal.setTextColor(Color.RED)
|
podInfoBinding.tempBasal.setTextColor(Color.RED)
|
||||||
} else {
|
} else {
|
||||||
val now = DateTime.now()
|
val now = DateTime.now()
|
||||||
|
|
||||||
|
@ -442,8 +454,8 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.podInfo.tempBasal.text = text
|
podInfoBinding.tempBasal.text = text
|
||||||
binding.podInfo.tempBasal.setTextColor(textColor)
|
podInfoBinding.tempBasal.setTextColor(textColor)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var text = PLACEHOLDER
|
var text = PLACEHOLDER
|
||||||
|
@ -456,17 +468,17 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
text += " (" + resourceHelper.gs(R.string.omnipod_eros_uncertain) + ")"
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.podInfo.tempBasal.text = text
|
podInfoBinding.tempBasal.text = text
|
||||||
binding.podInfo.tempBasal.setTextColor(textColor)
|
podInfoBinding.tempBasal.setTextColor(textColor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateQueueStatus() {
|
private fun updateQueueStatus() {
|
||||||
if (isQueueEmpty()) {
|
if (isQueueEmpty()) {
|
||||||
binding.podInfo.queue.visibility = View.GONE
|
podInfoBinding.queue.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
binding.podInfo.queue.visibility = View.VISIBLE
|
podInfoBinding.queue.visibility = View.VISIBLE
|
||||||
binding.podInfo.queue.text = commandQueue.spannedStatus().toString()
|
podInfoBinding.queue.text = commandQueue.spannedStatus().toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,52 +491,52 @@ class OmnipodErosOverviewFragment : DaggerFragment() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun disablePodActionButtons() {
|
private fun disablePodActionButtons() {
|
||||||
binding.buttons.buttonSilenceAlerts.isEnabled = false
|
buttonBinding.buttonSilenceAlerts.isEnabled = false
|
||||||
binding.buttons.buttonResumeDelivery.isEnabled = false
|
buttonBinding.buttonResumeDelivery.isEnabled = false
|
||||||
binding.buttons.buttonSuspendDelivery.isEnabled = false
|
buttonBinding.buttonSuspendDelivery.isEnabled = false
|
||||||
binding.buttons.buttonSetTime.isEnabled = false
|
buttonBinding.buttonSetTime.isEnabled = false
|
||||||
binding.buttons.buttonRefreshStatus.isEnabled = false
|
buttonBinding.buttonRefreshStatus.isEnabled = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateRefreshStatusButton() {
|
private fun updateRefreshStatusButton() {
|
||||||
binding.buttons.buttonRefreshStatus.isEnabled = podStateManager.isPodInitialized && podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
buttonBinding.buttonRefreshStatus.isEnabled = podStateManager.isPodInitialized && podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
||||||
&& rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
&& rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateResumeDeliveryButton() {
|
private fun updateResumeDeliveryButton() {
|
||||||
if (podStateManager.isPodRunning && (podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandResumeDelivery::class.java))) {
|
if (podStateManager.isPodRunning && (podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandResumeDelivery::class.java))) {
|
||||||
binding.buttons.buttonResumeDelivery.visibility = View.VISIBLE
|
buttonBinding.buttonResumeDelivery.visibility = View.VISIBLE
|
||||||
binding.buttons.buttonResumeDelivery.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
buttonBinding.buttonResumeDelivery.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||||
} else {
|
} else {
|
||||||
binding.buttons.buttonResumeDelivery.visibility = View.GONE
|
buttonBinding.buttonResumeDelivery.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSilenceAlertsButton() {
|
private fun updateSilenceAlertsButton() {
|
||||||
if (!omnipodManager.isAutomaticallyAcknowledgeAlertsEnabled && podStateManager.isPodRunning && (podStateManager.hasActiveAlerts() || commandQueue.isCustomCommandInQueue(CommandAcknowledgeAlerts::class.java))) {
|
if (!omnipodManager.isAutomaticallyAcknowledgeAlertsEnabled && podStateManager.isPodRunning && (podStateManager.hasActiveAlerts() || commandQueue.isCustomCommandInQueue(CommandAcknowledgeAlerts::class.java))) {
|
||||||
binding.buttons.buttonSilenceAlerts.visibility = View.VISIBLE
|
buttonBinding.buttonSilenceAlerts.visibility = View.VISIBLE
|
||||||
binding.buttons.buttonSilenceAlerts.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
buttonBinding.buttonSilenceAlerts.isEnabled = rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||||
} else {
|
} else {
|
||||||
binding.buttons.buttonSilenceAlerts.visibility = View.GONE
|
buttonBinding.buttonSilenceAlerts.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSuspendDeliveryButton() {
|
private fun updateSuspendDeliveryButton() {
|
||||||
// If the Pod is currently suspended, we show the Resume delivery button instead.
|
// If the Pod is currently suspended, we show the Resume delivery button instead.
|
||||||
if (omnipodManager.isSuspendDeliveryButtonEnabled && podStateManager.isPodRunning && (!podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandSuspendDelivery::class.java))) {
|
if (omnipodManager.isSuspendDeliveryButtonEnabled && podStateManager.isPodRunning && (!podStateManager.isSuspended || commandQueue.isCustomCommandInQueue(CommandSuspendDelivery::class.java))) {
|
||||||
binding.buttons.buttonSuspendDelivery.visibility = View.VISIBLE
|
buttonBinding.buttonSuspendDelivery.visibility = View.VISIBLE
|
||||||
binding.buttons.buttonSuspendDelivery.isEnabled = podStateManager.isPodRunning && !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
buttonBinding.buttonSuspendDelivery.isEnabled = podStateManager.isPodRunning && !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||||
} else {
|
} else {
|
||||||
binding.buttons.buttonSuspendDelivery.visibility = View.GONE
|
buttonBinding.buttonSuspendDelivery.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateSetTimeButton() {
|
private fun updateSetTimeButton() {
|
||||||
if (podStateManager.isPodRunning && (podStateManager.timeDeviatesMoreThan(Duration.standardMinutes(5)) || commandQueue.isCustomCommandInQueue(CommandHandleTimeChange::class.java))) {
|
if (podStateManager.isPodRunning && (podStateManager.timeDeviatesMoreThan(Duration.standardMinutes(5)) || commandQueue.isCustomCommandInQueue(CommandHandleTimeChange::class.java))) {
|
||||||
binding.buttons.buttonSetTime.visibility = View.VISIBLE
|
buttonBinding.buttonSetTime.visibility = View.VISIBLE
|
||||||
binding.buttons.buttonSetTime.isEnabled = !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
buttonBinding.buttonSetTime.isEnabled = !podStateManager.isSuspended && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
|
||||||
} else {
|
} else {
|
||||||
binding.buttons.buttonSetTime.visibility = View.GONE
|
buttonBinding.buttonSetTime.visibility = View.GONE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.PodActivationWizardActivity
|
||||||
|
|
||||||
|
class ErosPodActivationWizardActivity : PodActivationWizardActivity()
|
|
@ -0,0 +1,27 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.action
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class ErosInitializePodViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodErosManager, private val podStateManager: AapsErosPodStateManager) : InitializePodViewModel() {
|
||||||
|
|
||||||
|
override fun isPodInAlarm(): Boolean = podStateManager.isPodFaulted
|
||||||
|
|
||||||
|
override fun isPodActivationTimeExceeded(): Boolean = podStateManager.isPodActivationTimeExceeded
|
||||||
|
|
||||||
|
override fun isPodDeactivatable(): Boolean = podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
||||||
|
|
||||||
|
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_initialize_pod_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_eros_pod_activation_wizard_initialize_pod_text
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.action
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
|
import info.nightscout.androidaps.interfaces.ProfileFunction
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.driver.definition.ActivationProgress
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsErosPodStateManager
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
|
import javax.inject.Inject
|
||||||
|
|
||||||
|
class ErosInsertCannulaViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodErosManager, private val podStateManager: AapsErosPodStateManager, private val profileFunction: ProfileFunction) : InsertCannulaViewModel() {
|
||||||
|
|
||||||
|
override fun isPodInAlarm(): Boolean = podStateManager.isPodFaulted
|
||||||
|
|
||||||
|
override fun isPodActivationTimeExceeded(): Boolean = podStateManager.isPodActivationTimeExceeded
|
||||||
|
|
||||||
|
override fun isPodDeactivatable(): Boolean = podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)
|
||||||
|
|
||||||
|
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_insert_cannula_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_activation_wizard_insert_cannula_text
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.AttachPodViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosAttachPodViewModel : AttachPodViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_attach_pod_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_activation_wizard_attach_pod_text
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.PodActivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosPodActivatedViewModel : PodActivatedViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_pod_activated_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_activation_wizard_pod_activated_text
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.activation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.info.StartPodActivationViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosStartPodActivationViewModel : StartPodActivationViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_activation_wizard_start_pod_activation_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId(): Int = R.string.omnipod_eros_pod_activation_wizard_start_pod_activation_text
|
||||||
|
}
|
|
@ -0,0 +1,5 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.PodDeactivationWizardActivity
|
||||||
|
|
||||||
|
class ErosPodDeactivationWizardActivity : PodDeactivationWizardActivity()
|
|
@ -1,15 +1,17 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.action
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
import info.nightscout.androidaps.data.PumpEnactResult
|
import info.nightscout.androidaps.data.PumpEnactResult
|
||||||
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
import info.nightscout.androidaps.interfaces.CommandQueueProvider
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandDeactivatePod
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.queue.command.CommandDeactivatePod
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.common.viewmodel.ActionViewModelBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.action.DeactivatePodViewModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.manager.AapsOmnipodErosManager
|
||||||
import info.nightscout.androidaps.queue.Callback
|
import info.nightscout.androidaps.queue.Callback
|
||||||
import io.reactivex.subjects.SingleSubject
|
import io.reactivex.subjects.SingleSubject
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val commandQueueProvider: CommandQueueProvider) : ActionViewModelBase() {
|
class ErosDeactivatePodViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodErosManager, private val commandQueueProvider: CommandQueueProvider) : DeactivatePodViewModel() {
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult {
|
override fun doExecuteAction(): PumpEnactResult {
|
||||||
val singleSubject = SingleSubject.create<PumpEnactResult>()
|
val singleSubject = SingleSubject.create<PumpEnactResult>()
|
||||||
|
@ -21,7 +23,13 @@ class DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodMa
|
||||||
return singleSubject.blockingGet()
|
return singleSubject.blockingGet()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun discardPod() {
|
override fun discardPod() {
|
||||||
aapsOmnipodManager.discardPodState()
|
aapsOmnipodManager.discardPodState()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivating_pod_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId(): Int = R.string.omnipod_common_pod_deactivation_wizard_deactivating_pod_text
|
||||||
}
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDeactivatedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosPodDeactivatedViewModel : PodDeactivatedViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_deactivated_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_deactivation_wizard_pod_deactivated_text
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.PodDiscardedViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosPodDiscardedViewModel : PodDiscardedViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_pod_discarded_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_deactivation_wizard_pod_discarded_text
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.eros.ui.wizard.deactivation.viewmodel.info
|
||||||
|
|
||||||
|
import androidx.annotation.StringRes
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.viewmodel.info.StartPodDeactivationViewModel
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.eros.R
|
||||||
|
|
||||||
|
class ErosStartPodDeactivationViewModel : StartPodDeactivationViewModel() {
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTitleId(): Int = R.string.omnipod_common_pod_deactivation_wizard_start_pod_deactivation_title
|
||||||
|
|
||||||
|
@StringRes
|
||||||
|
override fun getTextId() = R.string.omnipod_common_pod_deactivation_wizard_start_pod_deactivation_text
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
@ -24,13 +24,9 @@
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:background="@color/list_delimiter" />
|
android:background="@color/list_delimiter" />
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_eros_overview_riley_link_status" />
|
||||||
android:id="@+id/riley_link"
|
|
||||||
layout="@layout/omnipod_eros_overview_riley_link_status" />
|
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_common_overview_pod_info" />
|
||||||
android:id="@+id/pod_info"
|
|
||||||
layout="@layout/omnipod_common_overview_pod_info" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
@ -43,10 +39,8 @@
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<include
|
<include layout="@layout/omnipod_common_overview_buttons" />
|
||||||
android:id="@+id/buttons"
|
|
||||||
layout="@layout/omnipod_common_overview_buttons" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</merge>
|
</RelativeLayout>
|
||||||
|
|
|
@ -2,39 +2,39 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:gravity="end"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1.5"
|
android:layout_weight="1.5"
|
||||||
android:layout_width="match_parent"
|
android:gravity="end"
|
||||||
android:paddingEnd="5dp"
|
|
||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
android:text="@string/rileylink_status"
|
android:text="@string/rileylink_status"
|
||||||
android:textSize="14sp" />
|
android:textSize="14sp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:gravity="center_horizontal"
|
android:layout_width="5dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="0"
|
android:layout_weight="0"
|
||||||
android:layout_width="5dp"
|
android:gravity="center_horizontal"
|
||||||
android:paddingEnd="2dp"
|
|
||||||
android:paddingStart="2dp"
|
android:paddingStart="2dp"
|
||||||
|
android:paddingEnd="2dp"
|
||||||
android:text=":"
|
android:text=":"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
tools:ignore="HardcodedText" />
|
tools:ignore="HardcodedText" />
|
||||||
|
|
||||||
<com.joanzapata.iconify.widget.IconTextView
|
<com.joanzapata.iconify.widget.IconTextView
|
||||||
android:gravity="start"
|
|
||||||
android:id="@+id/riley_link_status"
|
android:id="@+id/riley_link_status"
|
||||||
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:layout_width="match_parent"
|
android:gravity="start"
|
||||||
android:paddingEnd="5dp"
|
|
||||||
android:paddingStart="5dp"
|
android:paddingStart="5dp"
|
||||||
|
android:paddingEnd="5dp"
|
||||||
android:text="{fa-bluetooth-b}"
|
android:text="{fa-bluetooth-b}"
|
||||||
android:textColor="@android:color/white"
|
android:textColor="@android:color/white"
|
||||||
android:textSize="14sp"
|
android:textSize="14sp"
|
||||||
|
@ -43,11 +43,11 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
android:background="@color/list_delimiter"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="2dip"
|
android:layout_height="2dip"
|
||||||
android:layout_marginBottom="5dp"
|
|
||||||
android:layout_marginLeft="20dp"
|
android:layout_marginLeft="20dp"
|
||||||
android:layout_marginRight="20dp"
|
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:layout_width="fill_parent" />
|
android:layout_marginRight="20dp"
|
||||||
|
android:layout_marginBottom="5dp"
|
||||||
|
android:background="@color/list_delimiter" />
|
||||||
</merge>
|
</merge>
|
|
@ -89,7 +89,7 @@
|
||||||
<string name="omnipod_eros_pod_management_pulse_log_value">Pulse Log (copied to clipboard)</string>
|
<string name="omnipod_eros_pod_management_pulse_log_value">Pulse Log (copied to clipboard)</string>
|
||||||
|
|
||||||
<!-- Omnipod Eros - Pod Activation Wizard -->
|
<!-- Omnipod Eros - Pod Activation Wizard -->
|
||||||
<string name="omnipod_eros_pod_activation_wizard_fill_pod_text">Fill a new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.\n<b>Note:</b> please place the RileyLink in an upright position and place the Pod a few inches away from it.</string>
|
<string name="omnipod_eros_pod_activation_wizard_start_pod_activation_text">Fill a new Pod with enough insulin for 3 days.\n\nListen for two beeps from the Pod during the filling process. These indicate that the minimum amount of 85U has been inserted. Be sure to completely empty the fill syringe, even after hearing the two beeps.\n\nAfter filling the Pod, please press <b>Next</b>.\n\n<b>Note:</b> do not remove the Pod\'s needle cap at this time.\n<b>Note:</b> please place the RileyLink in an upright position and place the Pod a few inches away from it.</string>
|
||||||
<string name="omnipod_eros_pod_activation_wizard_initialize_pod_text">Trying to pair with the new Pod and prime it.\n\nWhen the initialization process has successfully been completed, you can press <b>Next</b>.\n\n<b>Note:</b> please place the RileyLink in an upright position and place the Pod a few inches away from it.</string>
|
<string name="omnipod_eros_pod_activation_wizard_initialize_pod_text">Trying to pair with the new Pod and prime it.\n\nWhen the initialization process has successfully been completed, you can press <b>Next</b>.\n\n<b>Note:</b> please place the RileyLink in an upright position and place the Pod a few inches away from it.</string>
|
||||||
|
|
||||||
<!-- Omnipod Eros - Other -->
|
<!-- Omnipod Eros - Other -->
|
||||||
|
|
Loading…
Reference in a new issue