Minor code improvements & formatting
This commit is contained in:
parent
f6a234abc5
commit
d66ccfc041
21 changed files with 22 additions and 5 deletions
|
@ -25,6 +25,7 @@ import javax.inject.Provider
|
||||||
abstract class OmnipodWizardModule {
|
abstract class OmnipodWizardModule {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
fun providesViewModelFactory(@OmnipodPluginQualifier viewModels: MutableMap<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>): ViewModelProvider.Factory {
|
fun providesViewModelFactory(@OmnipodPluginQualifier viewModels: MutableMap<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>): ViewModelProvider.Factory {
|
||||||
|
|
|
@ -50,7 +50,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodFault
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodProgressStatusVerificationFailedException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PodProgressStatusVerificationFailedException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PrecedingCommandFailedUncertainlyException;
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.exception.PrecedingCommandFailedUncertainlyException;
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
|
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
|
||||||
import info.nightscout.androidaps.utils.sharedPreferences.SP;
|
|
||||||
import io.reactivex.Completable;
|
import io.reactivex.Completable;
|
||||||
import io.reactivex.Flowable;
|
import io.reactivex.Flowable;
|
||||||
import io.reactivex.Single;
|
import io.reactivex.Single;
|
||||||
|
@ -62,17 +61,16 @@ public class OmnipodManager {
|
||||||
private static final int ACTION_VERIFICATION_TRIES = 1;
|
private static final int ACTION_VERIFICATION_TRIES = 1;
|
||||||
|
|
||||||
private final OmnipodRileyLinkCommunicationManager communicationService;
|
private final OmnipodRileyLinkCommunicationManager communicationService;
|
||||||
private PodStateManager podStateManager;
|
private final PodStateManager podStateManager;
|
||||||
|
|
||||||
private ActiveBolusData activeBolusData;
|
private ActiveBolusData activeBolusData;
|
||||||
private SingleSubject<Boolean> bolusCommandExecutionSubject;
|
private SingleSubject<Boolean> bolusCommandExecutionSubject;
|
||||||
|
|
||||||
private final Object bolusDataMutex = new Object();
|
private final Object bolusDataMutex = new Object();
|
||||||
|
|
||||||
private AAPSLogger aapsLogger;
|
private final AAPSLogger aapsLogger;
|
||||||
|
|
||||||
public OmnipodManager(AAPSLogger aapsLogger,
|
public OmnipodManager(AAPSLogger aapsLogger,
|
||||||
SP sp,
|
|
||||||
OmnipodRileyLinkCommunicationManager communicationService,
|
OmnipodRileyLinkCommunicationManager communicationService,
|
||||||
PodStateManager podStateManager) {
|
PodStateManager podStateManager) {
|
||||||
if (communicationService == null) {
|
if (communicationService == null) {
|
||||||
|
|
|
@ -143,7 +143,7 @@ public class AapsOmnipodManager {
|
||||||
this.nsUpload = nsUpload;
|
this.nsUpload = nsUpload;
|
||||||
this.profileFunction = profileFunction;
|
this.profileFunction = profileFunction;
|
||||||
|
|
||||||
delegate = new OmnipodManager(aapsLogger, sp, communicationService, podStateManager);
|
delegate = new OmnipodManager(aapsLogger, communicationService, podStateManager);
|
||||||
|
|
||||||
reloadSettings();
|
reloadSettings();
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ import javax.inject.Inject
|
||||||
|
|
||||||
class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
class PodActivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
const val KEY_START_DESTINATION = "startDestination"
|
const val KEY_START_DESTINATION = "startDestination"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment
|
||||||
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
|
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
|
||||||
|
|
||||||
class AttachPodInfoFragment : InfoFragmentBase() {
|
class AttachPodInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_attach_pod_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_attach_pod_title
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
|
||||||
class FillPodInfoFragment : InfoFragmentBase() {
|
class FillPodInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_title
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InitializePodActionFragment : PodActivationActionFragmentBase() {
|
class InitializePodActionFragment : PodActivationActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
lateinit var viewModelFactory: ViewModelProvider.Factory
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
|
@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
|
class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
lateinit var viewModelFactory: ViewModelProvider.Factory
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
|
||||||
class PodActivatedInfoFragment : InfoFragmentBase() {
|
class PodActivatedInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_pod_activated_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_pod_activated_title
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
|
abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
protected lateinit var podStateManager: PodStateManager
|
protected lateinit var podStateManager: PodStateManager
|
||||||
|
|
||||||
|
|
|
@ -6,5 +6,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager) : ActionViewModelBase() {
|
class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager) : ActionViewModelBase() {
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
|
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
|
||||||
}
|
}
|
|
@ -7,5 +7,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val profileFunction: ProfileFunction) : ActionViewModelBase() {
|
class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val profileFunction: ProfileFunction) : ActionViewModelBase() {
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
|
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
|
|
||||||
abstract class OmnipodWizardActivityBase : NoSplashAppCompatActivity() {
|
abstract class OmnipodWizardActivityBase : NoSplashAppCompatActivity() {
|
||||||
|
|
||||||
override fun onBackPressed() {
|
override fun onBackPressed() {
|
||||||
exitActivityAfterConfirmation()
|
exitActivityAfterConfirmation()
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
|
||||||
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
|
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
|
||||||
|
|
||||||
abstract class ActionFragmentBase : WizardFragmentBase() {
|
abstract class ActionFragmentBase : WizardFragmentBase() {
|
||||||
|
|
||||||
protected lateinit var viewModel: ActionViewModelBase
|
protected lateinit var viewModel: ActionViewModelBase
|
||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
|
|
|
@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_progress_indication.*
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
|
|
||||||
abstract class WizardFragmentBase : DaggerFragment() {
|
abstract class WizardFragmentBase : DaggerFragment() {
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater,
|
inflater: LayoutInflater,
|
||||||
container: ViewGroup?,
|
container: ViewGroup?,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.activity.OmnipodWizardActivityBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.activity.OmnipodWizardActivityBase
|
||||||
|
|
||||||
class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
|
class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
|
||||||
import javax.inject.Inject
|
import javax.inject.Inject
|
||||||
|
|
||||||
class DeactivatePodActionFragment : ActionFragmentBase() {
|
class DeactivatePodActionFragment : ActionFragmentBase() {
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@OmnipodPluginQualifier
|
@OmnipodPluginQualifier
|
||||||
lateinit var viewModelFactory: ViewModelProvider.Factory
|
lateinit var viewModelFactory: ViewModelProvider.Factory
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
|
||||||
class DeactivatePodInfoFragment : InfoFragmentBase() {
|
class DeactivatePodInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_deactivate_pod_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_deactivate_pod_title
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
|
||||||
class PodDeactivatedInfoFragment : InfoFragmentBase() {
|
class PodDeactivatedInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_deactivated_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_deactivated_title
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
|
||||||
|
|
||||||
class PodDiscardedInfoFragment : InfoFragmentBase() {
|
class PodDiscardedInfoFragment : InfoFragmentBase() {
|
||||||
|
|
||||||
@StringRes
|
@StringRes
|
||||||
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_discarded_title
|
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_discarded_title
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ 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 DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val commandQueueProvider: CommandQueueProvider) : ActionViewModelBase() {
|
||||||
|
|
||||||
override fun doExecuteAction(): PumpEnactResult {
|
override fun doExecuteAction(): PumpEnactResult {
|
||||||
val singleSubject = SingleSubject.create<PumpEnactResult>()
|
val singleSubject = SingleSubject.create<PumpEnactResult>()
|
||||||
commandQueueProvider.customCommand(CommandDeactivatePod(), object : Callback() {
|
commandQueueProvider.customCommand(CommandDeactivatePod(), object : Callback() {
|
||||||
|
|
Loading…
Reference in a new issue