diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index e791cb6a73..87551a7641 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -634,7 +634,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList } 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. // The only way to 'reconnect' it, is through the Omnipod tab R.drawable.ic_loop_disconnected diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index f2cbd11ebb..c414d1c5a2 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -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_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) - 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) } 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") } else { 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 (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 - 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) + if (pump.model() == PumpType.Omnipod_Dash) { + // 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) { 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") - 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) { handleLevel(view, criticalSetting, criticalDefaultValue, warnSetting, warnDefaultValue, level, units) } else { diff --git a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt index 55ed268dfe..9a077ce965 100644 --- a/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt +++ b/app/src/main/java/info/nightscout/androidaps/setupwizard/SWDefinition.kt @@ -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.NSProfilePlugin 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.setupwizard.elements.* import info.nightscout.androidaps.setupwizard.events.EventSWUpdate @@ -277,14 +278,14 @@ class SWDefinition @Inject constructor( .add(SWInfoText(injector) .label(R.string.setupwizard_pump_pump_not_initialized) .visibility { !isPumpInitialized() }) - .add( // Omnipod only + .add( // Omnipod Eros only SWInfoText(injector) .label(R.string.setupwizard_pump_waiting_for_riley_link_connection) .visibility { val activePump = activePlugin.activePump activePump is OmnipodErosPumpPlugin && !activePump.isRileyLinkReady }) - .add( // Omnipod only + .add( // Omnipod Eros only SWEventListener(injector, EventRileyLinkDeviceStatusChange::class.java) .label(R.string.setupwizard_pump_riley_link_status) .visibility { activePlugin.activePump is OmnipodErosPumpPlugin }) @@ -294,18 +295,21 @@ class SWDefinition @Inject constructor( .visibility { // 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 - activePlugin.activePump !is OmnipodErosPumpPlugin + activePlugin.activePump !is OmnipodErosPumpPlugin && activePlugin.activePump !is OmnipodDashPumpPlugin }) .add(SWEventListener(injector, EventPumpStatusChanged::class.java) - .visibility { activePlugin.activePump !is OmnipodErosPumpPlugin }) + .visibility { activePlugin.activePump !is OmnipodErosPumpPlugin && activePlugin.activePump !is OmnipodDashPumpPlugin }) .validator { isPumpInitialized() } private fun isPumpInitialized(): Boolean { val activePump = activePlugin.activePump - // For Omnipod, consider the pump initialized when a RL has been configured successfully - // Users will be prompted to activate a Pod after completing the setup wizard. - return activePump.isInitialized() || (activePump is OmnipodErosPumpPlugin && activePump.isRileyLinkReady) + // For Omnipod, activating a Pod can be done after setup through the Omnipod fragment + // For the Eros model, consider the pump initialized when a RL has been configured successfully + // 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) diff --git a/omnipod-common/src/main/AndroidManifest.xml b/omnipod-common/src/main/AndroidManifest.xml index 24a9e72c49..651caba55f 100644 --- a/omnipod-common/src/main/AndroidManifest.xml +++ b/omnipod-common/src/main/AndroidManifest.xml @@ -1,9 +1,5 @@ - + - - - - + \ No newline at end of file diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodCommonModule.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodCommonModule.kt deleted file mode 100644 index 2525c3fd8c..0000000000 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodCommonModule.kt +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt index 98cd2bab92..906d0f3413 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodInjectHelpers.kt @@ -15,7 +15,7 @@ annotation class OmnipodPluginQualifier @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER, AnnotationTarget.PROPERTY_SETTER) @kotlin.annotation.Retention(AnnotationRetention.RUNTIME) @MapKey -internal annotation class ViewModelKey(val value: KClass) +annotation class ViewModelKey(val value: KClass) // TODO: These annotations and Factories could be used globally -> move to core or app diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt index 56991866e1..5b3a0075c0 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/dagger/OmnipodWizardModule.kt @@ -2,23 +2,18 @@ package info.nightscout.androidaps.plugins.pump.omnipod.common.dagger import androidx.lifecycle.ViewModel import androidx.lifecycle.ViewModelProvider -import dagger.Binds import dagger.Module import dagger.Provides import dagger.android.ContributesAndroidInjector -import dagger.multibindings.IntoMap -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.FillPodInfoFragment -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.InsertCannulaActionFragment -import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.PodActivatedInfoFragment -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.InsertCannulaActionViewModel -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.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 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.action.InsertCannulaFragment +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.info.PodActivatedFragment +import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.fragment.info.StartPodActivationFragment +import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.action.DeactivatePodFragment +import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.deactivation.fragment.info.PodDeactivatedFragment +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.info.StartPodDeactivationFragment import javax.inject.Provider @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 ############################################################################## - @FragmentScope - @ContributesAndroidInjector - internal abstract fun contributesDeactivatePodActionFragment(): DeactivatePodActionFragment + + // POD ACTIVATION @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesInsertCannulaActionFragment(): InsertCannulaActionFragment + internal abstract fun contributesStartPodActivationFragment(): StartPodActivationFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesInitializePodActionFragment(): InitializePodActionFragment + internal abstract fun contributesInitializeActionFragment(): InitializePodFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesAttachPodInfoFragment(): AttachPodInfoFragment + internal abstract fun contributesAttachPodFragment(): AttachPodFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesDeactivatePodInfoFragment(): DeactivatePodInfoFragment + internal abstract fun contributesInsertCannulaFragment(): InsertCannulaFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesFillPodInfoFragment(): FillPodInfoFragment + internal abstract fun contributesPodActivatedFragment(): PodActivatedFragment + + // POD DEACTIVATION @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesPodDeactivatedInfoFragment(): PodDeactivatedInfoFragment + internal abstract fun contributesStartPodDeactivationFragment(): StartPodDeactivationFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesPodDiscardedInfoFragment(): PodDiscardedInfoFragment + internal abstract fun contributesDeactivatePodFragment(): DeactivatePodFragment @FragmentScope @ContributesAndroidInjector - internal abstract fun contributesPodActivatedInfoFragment(): PodActivatedInfoFragment + internal abstract fun contributesPodDeactivatedFragment(): PodDeactivatedFragment + + @FragmentScope + @ContributesAndroidInjector + internal abstract fun contributesPodDiscardedFragment(): PodDiscardedFragment + } diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt index 3c1bc29bd5..8d187febfa 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/PodActivationWizardActivity.kt @@ -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.ui.wizard.common.activity.OmnipodWizardActivityBase -class PodActivationWizardActivity : OmnipodWizardActivityBase() { +abstract class PodActivationWizardActivity : OmnipodWizardActivityBase() { companion object { const val KEY_TYPE = "wizardType" @@ -18,18 +18,18 @@ class PodActivationWizardActivity : OmnipodWizardActivityBase() { } @IdRes - private var startDestination: Int = R.id.fillPodInfoFragment + private var startDestination: Int = R.id.startPodActivationFragment override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) 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) { - R.id.fillPodInfoFragment + R.id.startPodActivationFragment } else { - R.id.attachPodInfoFragment + R.id.attachPodFragment } setStartDestination(startDestination) @@ -52,7 +52,7 @@ class PodActivationWizardActivity : OmnipodWizardActivityBase() { override fun getTotalDefinedNumberOfSteps(): Int = 5 override fun getActualNumberOfSteps(): Int { - if (startDestination == R.id.attachPodInfoFragment) { + if (startDestination == R.id.attachPodFragment) { return 3 } return 5 diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivatedInfoFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivatedInfoFragment.kt deleted file mode 100644 index 387646d015..0000000000 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivatedInfoFragment.kt +++ /dev/null @@ -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 -} \ No newline at end of file diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InitializePodActionFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt similarity index 59% rename from omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InitializePodActionFragment.kt rename to omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt index 26f7170155..eced08a2b3 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InitializePodActionFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InitializePodFragment.kt @@ -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 androidx.annotation.IdRes -import androidx.annotation.StringRes 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.activation.viewmodel.InitializePodActionViewModel +import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InitializePodViewModel import javax.inject.Inject -class InitializePodActionFragment : PodActivationActionFragmentBase() { +class InitializePodFragment : PodActivationActionFragmentBase() { @Inject @OmnipodPluginQualifier @@ -19,18 +18,12 @@ class InitializePodActionFragment : PodActivationActionFragmentBase() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val vm: InitializePodActionViewModel by viewModels { viewModelFactory } + val vm: InitializePodViewModel by viewModels { viewModelFactory } 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 - 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 } \ No newline at end of file diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InsertCannulaActionFragment.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt similarity index 58% rename from omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InsertCannulaActionFragment.kt rename to omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt index bd8ec93d7f..12483400e6 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/InsertCannulaActionFragment.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/InsertCannulaFragment.kt @@ -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 androidx.annotation.IdRes -import androidx.annotation.StringRes 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.activation.viewmodel.InsertCannulaActionViewModel +import info.nightscout.androidaps.plugins.pump.omnipod.common.ui.wizard.activation.viewmodel.action.InsertCannulaViewModel import javax.inject.Inject -class InsertCannulaActionFragment : PodActivationActionFragmentBase() { +class InsertCannulaFragment : PodActivationActionFragmentBase() { @Inject @OmnipodPluginQualifier @@ -19,18 +18,12 @@ class InsertCannulaActionFragment : PodActivationActionFragmentBase() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) - val vm: InsertCannulaActionViewModel by viewModels { viewModelFactory } + val vm: InsertCannulaViewModel by viewModels { viewModelFactory } 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 - 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 } \ No newline at end of file diff --git a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivationActionFragmentBase.kt b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/PodActivationActionFragmentBase.kt similarity index 88% rename from omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivationActionFragmentBase.kt rename to omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/PodActivationActionFragmentBase.kt index 31ffbb909f..8d44d7dcd1 100644 --- a/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/PodActivationActionFragmentBase.kt +++ b/omnipod-common/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/common/ui/wizard/activation/fragment/action/PodActivationActionFragmentBase.kt @@ -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.os.Bundle import android.view.View import android.widget.Button 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.deactivation.PodDeactivationWizardActivity @@ -23,7 +23,7 @@ abstract class PodActivationActionFragmentBase : ActionFragmentBase() { } override fun onFailure() { - (viewModel as? PodActivationActionViewModelBase)?.let { viewModel -> + (actionViewModel as? PodActivationActionViewModelBase)?.let { viewModel -> if (viewModel.isPodDeactivatable() and (viewModel.isPodInAlarm() or viewModel.isPodActivationTimeExceeded())) { view?.let { it.findViewById