- PodManagemntActivity:
- when reset is done, buttons are refreshed - when dialog is closed, tab is refreshed - Configuration added: PumpStatus, preference dialog
This commit is contained in:
parent
c5f69347eb
commit
ad6223046c
|
@ -9,11 +9,13 @@ import com.atech.android.library.wizardpager.defs.WizardStepsWayType
|
|||
import info.nightscout.androidaps.MainApp
|
||||
import info.nightscout.androidaps.R
|
||||
import info.nightscout.androidaps.activities.NoSplashActivity
|
||||
import info.nightscout.androidaps.plugins.bus.RxBus
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.comm.AapsOmnipodManager
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodCancelAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.initpod.InitPodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages.InitPodRefreshAction
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.removepod.RemovePodWizardModel
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.events.EventOmnipodPumpValuesChanged
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodUtil
|
||||
import info.nightscout.androidaps.utils.OKDialog
|
||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||
|
@ -48,11 +50,15 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
|
||||
RxBus.send(EventOmnipodPumpValuesChanged())
|
||||
}
|
||||
|
||||
|
||||
fun initPodAction() {
|
||||
|
||||
// TODO check if RL is running and that pod is not active
|
||||
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(this)
|
||||
|
||||
|
@ -75,8 +81,6 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
}
|
||||
|
||||
fun removePodAction() {
|
||||
// TODO check that pod is active
|
||||
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(this)
|
||||
|
||||
|
@ -100,11 +104,10 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
}
|
||||
|
||||
fun resetPodAction() {
|
||||
// TODO check that pod is active
|
||||
|
||||
OKDialog.showConfirmation(this,
|
||||
MainApp.gs(R.string.omnipod_cmd_reset_pod_desc), Thread {
|
||||
AapsOmnipodManager.getInstance().resetPodStatus()
|
||||
refreshButtons()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
public boolean ackAlertsAvailable = false;
|
||||
public String ackAlertsText = null;
|
||||
|
||||
public boolean beepBolusEnabled = true;
|
||||
public boolean beepBasalEnabled = true;
|
||||
public boolean beepSMBEnabled = true;
|
||||
|
||||
|
||||
public OmnipodPumpStatus(PumpDescription pumpDescription) {
|
||||
super(pumpDescription);
|
||||
|
@ -97,6 +101,10 @@ public class OmnipodPumpStatus extends PumpStatus {
|
|||
}
|
||||
}
|
||||
|
||||
this.beepBasalEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBasalEnabled, true);
|
||||
this.beepBolusEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepBolusEnabled, true);
|
||||
this.beepSMBEnabled = SP.getBoolean(OmnipodConst.Prefs.BeepSMBEnabled, true);
|
||||
|
||||
reconfigureService();
|
||||
|
||||
return true;
|
||||
|
|
|
@ -241,8 +241,8 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
double unitsDelivered = bolusDeliveryResult.getUnitsDelivered();
|
||||
|
||||
if (pumpStatus != null && !isSmb) {
|
||||
lastBolusTime = bolusStarted;
|
||||
lastBolusUnits = unitsDelivered;
|
||||
pumpStatus.lastBolusTime = bolusStarted;
|
||||
pumpStatus.lastBolusAmount = unitsDelivered;
|
||||
}
|
||||
|
||||
return new PumpEnactResult().success(true).enacted(true).bolusDelivered(unitsDelivered);
|
||||
|
@ -472,18 +472,15 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
}
|
||||
|
||||
private boolean isBolusBeepsEnabled() {
|
||||
// TODO
|
||||
return true;
|
||||
return this.pumpStatus.beepBolusEnabled;
|
||||
}
|
||||
|
||||
private boolean isSmbBeepsEnabled() {
|
||||
// TODO
|
||||
return true;
|
||||
return this.pumpStatus.beepSMBEnabled;
|
||||
}
|
||||
|
||||
private boolean isBasalBeepsEnabled() {
|
||||
// TODO
|
||||
return true;
|
||||
return this.pumpStatus.beepBasalEnabled;
|
||||
}
|
||||
|
||||
private String getStringResource(int id, Object... args) {
|
||||
|
|
|
@ -2,6 +2,8 @@ package info.nightscout.androidaps.plugins.pump.omnipod.util;
|
|||
|
||||
import org.joda.time.Duration;
|
||||
|
||||
import info.nightscout.androidaps.R;
|
||||
|
||||
/**
|
||||
* Created by andy on 4.8.2019
|
||||
*/
|
||||
|
@ -12,6 +14,9 @@ public class OmnipodConst {
|
|||
|
||||
public class Prefs {
|
||||
public static final String PodState = Prefix + "pod_state";
|
||||
public static final int BeepBasalEnabled = R.string.key_omnipod_beep_basal_enabled;
|
||||
public static final int BeepBolusEnabled = R.string.key_omnipod_beep_bolus_enabled;
|
||||
public static final int BeepSMBEnabled = R.string.key_omnipod_beep_smb_enabled;
|
||||
}
|
||||
|
||||
public class Statistics {
|
||||
|
|
|
@ -1645,6 +1645,14 @@
|
|||
<string name="omnipod_name_short" translatable="false">POD</string>
|
||||
<string name="description_pump_omnipod">Pump integration for Omnipod, requires RileyLink (with at least 2.0 firmware) device.</string>
|
||||
|
||||
<!-- Omnipod Configuration -->
|
||||
<string name="key_omnipod_beep_bolus_enabled" translatable="false">pref_omnipod_beep_bolus_enabled</string>
|
||||
<string name="key_omnipod_beep_basal_enabled" translatable="false">pref_omnipod_beep_basal_enabled</string>
|
||||
<string name="key_omnipod_beep_smb_enabled" translatable="false">pref_omnipod_beep_smb_enabled</string>
|
||||
<string name="omnipod_config_beep_bolus_enabled">Bolus Beep Enabled</string>
|
||||
<string name="omnipod_config_beep_basal_enabled">Basal Beep Enabled</string>
|
||||
<string name="omnipod_config_beep_smb_enabled">SMB Beep Enabled</string>
|
||||
|
||||
<!-- Omnipod - Fragment -->
|
||||
<string name="omnipod_pod_mgmt">Pod Mgmt</string>
|
||||
<string name="omnipod_pod_status">Pod Status</string>
|
||||
|
|
|
@ -11,5 +11,20 @@
|
|||
<intent android:action="info.nightscout.androidaps.plugins.PumpCommon.dialog.RileyLinkBLEScanActivity" />
|
||||
</info.nightscout.androidaps.plugins.pump.common.ui.RileyLinkSelectPreference>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_bolus_enabled"
|
||||
android:title="@string/omnipod_config_beep_bolus_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_basal_enabled"
|
||||
android:title="@string/omnipod_config_beep_basal_enabled" />
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:key="@string/key_omnipod_beep_smb_enabled"
|
||||
android:title="@string/omnipod_config_beep_smb_enabled" />
|
||||
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue