- fix for #66 Init and Remove Pod buttons enabled when RL is not running/connected yet
- more implementation on #15 (not done yet)
This commit is contained in:
parent
e7e8cac81b
commit
6408961f5d
3 changed files with 28 additions and 3 deletions
|
@ -12,10 +12,12 @@ import info.nightscout.androidaps.activities.NoSplashActivity
|
||||||
import info.nightscout.androidaps.events.EventRefreshOverview
|
import info.nightscout.androidaps.events.EventRefreshOverview
|
||||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress
|
import info.nightscout.androidaps.plugins.pump.omnipod.defs.SetupProgress
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.FullInitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.FullInitPodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.RemovePodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.RemovePodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.ShortInitPodWizardModel
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.model.ShortInitPodWizardModel
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
||||||
|
@ -71,7 +73,7 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
fun initPodAction() {
|
fun initPodAction() {
|
||||||
|
|
||||||
val pagerSettings = WizardPagerSettings()
|
val pagerSettings = WizardPagerSettings()
|
||||||
var refreshAction = InitPodRefreshAction(this)
|
var refreshAction = InitPodRefreshAction(this, PodActionType.InitPod)
|
||||||
|
|
||||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||||
|
@ -99,7 +101,7 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
fun removePodAction() {
|
fun removePodAction() {
|
||||||
val pagerSettings = WizardPagerSettings()
|
val pagerSettings = WizardPagerSettings()
|
||||||
var refreshAction = InitPodRefreshAction(this)
|
var refreshAction = InitPodRefreshAction(this, PodActionType.RemovePod)
|
||||||
|
|
||||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||||
|
@ -124,6 +126,7 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
OKDialog.showConfirmation(this,
|
OKDialog.showConfirmation(this,
|
||||||
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
||||||
AapsOmnipodManager.getInstance().resetPodStatus()
|
AapsOmnipodManager.getInstance().resetPodStatus()
|
||||||
|
OmnipodUtil.setDriverState(OmnipodDriverState.Initalized_NoPod)
|
||||||
refreshButtons()
|
refreshButtons()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -144,6 +147,13 @@ class PodManagementActivity : NoSplashActivity() {
|
||||||
|
|
||||||
initpod_remove_pod.isEnabled = isPodSessionActive
|
initpod_remove_pod.isEnabled = isPodSessionActive
|
||||||
initpod_reset_pod.isEnabled = isPodSessionActive
|
initpod_reset_pod.isEnabled = isPodSessionActive
|
||||||
|
|
||||||
|
if (OmnipodUtil.getDriverState()==OmnipodDriverState.NotInitalized) {
|
||||||
|
// if rileylink is not running we disable all operations
|
||||||
|
initpod_init_pod.isEnabled = false
|
||||||
|
initpod_remove_pod.isEnabled = false
|
||||||
|
initpod_reset_pod.isEnabled = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs;
|
||||||
|
|
||||||
|
public enum PodActionType {
|
||||||
|
InitPod,
|
||||||
|
RemovePod,
|
||||||
|
ResetPod
|
||||||
|
}
|
|
@ -4,6 +4,9 @@ import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction;
|
||||||
import com.atech.android.library.wizardpager.defs.action.FinishActionInterface;
|
import com.atech.android.library.wizardpager.defs.action.FinishActionInterface;
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity;
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.defs.PodActionType;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodDriverState;
|
||||||
|
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by andy on 12/11/2019
|
* Created by andy on 12/11/2019
|
||||||
|
@ -11,9 +14,11 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActi
|
||||||
public class InitPodRefreshAction extends AbstractCancelAction implements FinishActionInterface {
|
public class InitPodRefreshAction extends AbstractCancelAction implements FinishActionInterface {
|
||||||
|
|
||||||
private PodManagementActivity podManagementActivity;
|
private PodManagementActivity podManagementActivity;
|
||||||
|
private PodActionType actionType;
|
||||||
|
|
||||||
public InitPodRefreshAction(PodManagementActivity podManagementActivity) {
|
public InitPodRefreshAction(PodManagementActivity podManagementActivity, PodActionType actionType) {
|
||||||
this.podManagementActivity = podManagementActivity;
|
this.podManagementActivity = podManagementActivity;
|
||||||
|
this.actionType = actionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -31,6 +36,9 @@ public class InitPodRefreshAction extends AbstractCancelAction implements Finish
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute() {
|
public void execute() {
|
||||||
|
OmnipodUtil.setDriverState(actionType==PodActionType.InitPod ?
|
||||||
|
OmnipodDriverState.Initalized_PodAvailable : OmnipodDriverState.Initalized_NoPod);
|
||||||
|
|
||||||
podManagementActivity.refreshButtons();
|
podManagementActivity.refreshButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue