- Fixed init pod problem

This commit is contained in:
Andy Rozman 2019-12-15 20:58:15 +00:00
parent 24430a5c81
commit d349343439
2 changed files with 6 additions and 11 deletions

View file

@ -81,11 +81,11 @@ class PodManagementActivity : NoSplashActivity() {
pagerSettings.cancelAction = refreshAction pagerSettings.cancelAction = refreshAction
pagerSettings.finishAction = refreshAction pagerSettings.finishAction = refreshAction
val wizardPagerContext = WizardPagerContext.getInstance(); val wizardPagerContext = WizardPagerContext.getInstance()
wizardPagerContext.clearContext() wizardPagerContext.clearContext()
wizardPagerContext.pagerSettings = pagerSettings wizardPagerContext.pagerSettings = pagerSettings
wizardPagerContext.wizardModel = InitPodWizardModel(applicationContext, !podSessionFullyInitalized) wizardPagerContext.wizardModel = InitPodWizardModel(applicationContext, OmnipodUtil.getPodSessionState() == null)
val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java) val myIntent = Intent(this@PodManagementActivity, WizardPagerActivity::class.java)
this@PodManagementActivity.startActivity(myIntent) this@PodManagementActivity.startActivity(myIntent)
@ -129,15 +129,10 @@ class PodManagementActivity : NoSplashActivity() {
fun refreshButtons() { fun refreshButtons() {
val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null) initpod_init_pod.isEnabled = (OmnipodUtil.getPodSessionState() == null ||
OmnipodUtil.getPodSessionState().getSetupProgress().isBefore(SetupProgress.COMPLETED))
if (isPodSessionActive) { val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null)
podSessionFullyInitalized = !OmnipodUtil.getPodSessionState().getSetupProgress().isBefore(SetupProgress.COMPLETED)
initpod_init_pod.isEnabled = !podSessionFullyInitalized
} else {
podSessionFullyInitalized = false
initpod_init_pod.isEnabled = true
}
initpod_remove_pod.isEnabled = isPodSessionActive initpod_remove_pod.isEnabled = isPodSessionActive
initpod_reset_pod.isEnabled = isPodSessionActive initpod_reset_pod.isEnabled = isPodSessionActive

View file

@ -34,7 +34,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.PodI
*/ */
public class InitPodWizardModel extends AbstractWizardModel { public class InitPodWizardModel extends AbstractWizardModel {
boolean isFullInit = true; boolean isFullInit;
public InitPodWizardModel(Context context, boolean isFullInit) { public InitPodWizardModel(Context context, boolean isFullInit) {
super(context); super(context);