Minor code improvements & formatting

This commit is contained in:
Bart Sopers 2020-11-16 20:45:15 +01:00
parent f6a234abc5
commit d66ccfc041
21 changed files with 22 additions and 5 deletions

View file

@ -25,6 +25,7 @@ import javax.inject.Provider
abstract class OmnipodWizardModule {
companion object {
@Provides
@OmnipodPluginQualifier
fun providesViewModelFactory(@OmnipodPluginQualifier viewModels: MutableMap<Class<out ViewModel>, @JvmSuppressWildcards Provider<ViewModel>>): ViewModelProvider.Factory {

View file

@ -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.PrecedingCommandFailedUncertainlyException;
import info.nightscout.androidaps.plugins.pump.omnipod.rileylink.manager.OmnipodRileyLinkCommunicationManager;
import info.nightscout.androidaps.utils.sharedPreferences.SP;
import io.reactivex.Completable;
import io.reactivex.Flowable;
import io.reactivex.Single;
@ -62,17 +61,16 @@ public class OmnipodManager {
private static final int ACTION_VERIFICATION_TRIES = 1;
private final OmnipodRileyLinkCommunicationManager communicationService;
private PodStateManager podStateManager;
private final PodStateManager podStateManager;
private ActiveBolusData activeBolusData;
private SingleSubject<Boolean> bolusCommandExecutionSubject;
private final Object bolusDataMutex = new Object();
private AAPSLogger aapsLogger;
private final AAPSLogger aapsLogger;
public OmnipodManager(AAPSLogger aapsLogger,
SP sp,
OmnipodRileyLinkCommunicationManager communicationService,
PodStateManager podStateManager) {
if (communicationService == null) {

View file

@ -143,7 +143,7 @@ public class AapsOmnipodManager {
this.nsUpload = nsUpload;
this.profileFunction = profileFunction;
delegate = new OmnipodManager(aapsLogger, sp, communicationService, podStateManager);
delegate = new OmnipodManager(aapsLogger, communicationService, podStateManager);
reloadSettings();
}

View file

@ -10,6 +10,7 @@ import javax.inject.Inject
class PodActivationWizardActivity : OmnipodWizardActivityBase() {
companion object {
const val KEY_START_DESTINATION = "startDestination"
}

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
class AttachPodInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_attach_pod_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class FillPodInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_fill_pod_title

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
import javax.inject.Inject
class InitializePodActionFragment : PodActivationActionFragmentBase() {
@Inject
@OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -11,6 +11,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.view
import javax.inject.Inject
class InsertCannulaActionFragment : PodActivationActionFragmentBase() {
@Inject
@OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodActivatedInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_activation_wizard_pod_activated_title

View file

@ -11,6 +11,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import javax.inject.Inject
abstract class PodActivationActionFragmentBase : ActionFragmentBase() {
@Inject
protected lateinit var podStateManager: PodStateManager

View file

@ -6,5 +6,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
import javax.inject.Inject
class InitializePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.initializePod()
}

View file

@ -7,5 +7,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.viewmode
import javax.inject.Inject
class InsertCannulaActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val profileFunction: ProfileFunction) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult = aapsOmnipodManager.insertCannula(profileFunction.getProfile())
}

View file

@ -7,6 +7,7 @@ import info.nightscout.androidaps.activities.NoSplashAppCompatActivity
import info.nightscout.androidaps.plugins.pump.omnipod.R
abstract class OmnipodWizardActivityBase : NoSplashAppCompatActivity() {
override fun onBackPressed() {
exitActivityAfterConfirmation()
}

View file

@ -12,6 +12,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import kotlinx.android.synthetic.main.omnipod_wizard_nav_buttons.*
abstract class ActionFragmentBase : WizardFragmentBase() {
protected lateinit var viewModel: ActionViewModelBase
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

@ -19,6 +19,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_progress_indication.*
import kotlin.math.roundToInt
abstract class WizardFragmentBase : DaggerFragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,

View file

@ -5,6 +5,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.activity.OmnipodWizardActivityBase
class PodDeactivationWizardActivity : OmnipodWizardActivityBase() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

View file

@ -18,6 +18,7 @@ import kotlinx.android.synthetic.main.omnipod_wizard_action_page_fragment.*
import javax.inject.Inject
class DeactivatePodActionFragment : ActionFragmentBase() {
@Inject
@OmnipodPluginQualifier
lateinit var viewModelFactory: ViewModelProvider.Factory

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class DeactivatePodInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_deactivate_pod_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodDeactivatedInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_deactivated_title

View file

@ -6,6 +6,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.common.fragment.InfoFragmentBase
class PodDiscardedInfoFragment : InfoFragmentBase() {
@StringRes
override fun getTitleId(): Int = R.string.omnipod_pod_deactivation_wizard_pod_discarded_title

View file

@ -10,6 +10,7 @@ import io.reactivex.subjects.SingleSubject
import javax.inject.Inject
class DeactivatePodActionViewModel @Inject constructor(private val aapsOmnipodManager: AapsOmnipodManager, private val commandQueueProvider: CommandQueueProvider) : ActionViewModelBase() {
override fun doExecuteAction(): PumpEnactResult {
val singleSubject = SingleSubject.create<PumpEnactResult>()
commandQueueProvider.customCommand(CommandDeactivatePod(), object : Callback() {