- Added new version of library
- added new Cancel/Finish action that refreshes dialog
This commit is contained in:
parent
df82a90b36
commit
a7153cf8b8
10 changed files with 105 additions and 87 deletions
|
@ -111,7 +111,7 @@ android {
|
|||
versionCode 1500
|
||||
version "omnipod-0.1-SNAPSHOT"
|
||||
buildConfigField "String", "VERSION", '"' + version + '"'
|
||||
buildConfigField "String", "DEV_VERSION", "2.6-dev"
|
||||
buildConfigField "String", "DEV_VERSION", '"2.6-dev"'
|
||||
buildConfigField "String", "BUILDVERSION", '"' + generateGitBuild() + '-' + generateDate() + '"'
|
||||
buildConfigField "String", "REMOTE", '"' + generateGitRemote() + '"'
|
||||
buildConfigField "String", "HEAD", '"' + generateGitBuild() + '"'
|
||||
|
|
Binary file not shown.
|
@ -139,6 +139,8 @@ public class OmnipodPumpPlugin extends PumpPluginAbstract implements OmnipodPump
|
|||
if (omnipodCommunicationManager == null) {
|
||||
omnipodCommunicationManager = AapsOmnipodManager.getInstance();
|
||||
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
|
||||
} else {
|
||||
omnipodCommunicationManager.setPumpStatus(pumpStatusLocal);
|
||||
}
|
||||
|
||||
omnipodUIComm = new OmnipodUIComm(omnipodCommunicationManager, plugin, pumpStatusLocal);
|
||||
|
|
|
@ -12,7 +12,9 @@ import info.nightscout.androidaps.activities.NoSplashActivity
|
|||
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.util.OmnipodUtil
|
||||
import info.nightscout.androidaps.utils.OKDialog
|
||||
import kotlinx.android.synthetic.main.omnipod_pod_mgmt.*
|
||||
|
||||
|
@ -42,6 +44,8 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
showPodHistory()
|
||||
}
|
||||
|
||||
refreshButtons();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -50,13 +54,15 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
// TODO check if RL is running and that pod is not active
|
||||
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(this)
|
||||
|
||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||
pagerSettings.setFinishButtonBackground(R.drawable.finish_background)
|
||||
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
|
||||
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||
pagerSettings.setCancelAction(InitPodCancelAction())
|
||||
pagerSettings.cancelAction = refreshAction
|
||||
pagerSettings.finishAction = refreshAction
|
||||
|
||||
val wizardPagerContext = WizardPagerContext.getInstance();
|
||||
|
||||
|
@ -72,13 +78,15 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
// TODO check that pod is active
|
||||
|
||||
val pagerSettings = WizardPagerSettings()
|
||||
var refreshAction = InitPodRefreshAction(this)
|
||||
|
||||
pagerSettings.setWizardStepsWayType(WizardStepsWayType.CancelNext)
|
||||
pagerSettings.setFinishStringResourceId(R.string.close)
|
||||
pagerSettings.setFinishButtonBackground(R.drawable.finish_background)
|
||||
pagerSettings.setNextButtonBackground(R.drawable.selectable_item_background)
|
||||
pagerSettings.setBackStringResourceId(R.string.cancel)
|
||||
//pagerSettings.setCancelAction(InitPodCancelAction())
|
||||
pagerSettings.cancelAction = refreshAction
|
||||
pagerSettings.finishAction = refreshAction
|
||||
|
||||
val wizardPagerContext = WizardPagerContext.getInstance();
|
||||
|
||||
|
@ -105,4 +113,14 @@ class PodManagementActivity : NoSplashActivity() {
|
|||
MainApp.gs(R.string.omnipod_cmd_pod_history_na), null)
|
||||
}
|
||||
|
||||
|
||||
fun refreshButtons() {
|
||||
|
||||
val isPodSessionActive = (OmnipodUtil.getPodSessionState()!=null)
|
||||
|
||||
initpod_init_pod.isEnabled = !isPodSessionActive
|
||||
initpod_remove_pod.isEnabled = isPodSessionActive
|
||||
initpod_reset_pod.isEnabled = isPodSessionActive
|
||||
}
|
||||
|
||||
}
|
|
@ -15,8 +15,10 @@ public class InitPodCancelAction extends AbstractCancelAction {
|
|||
}
|
||||
|
||||
if (this.cancelActionText.equals("Cancel")) {
|
||||
AapsOmnipodManager.getInstance().resetPodStatus();
|
||||
//AapsOmnipodManager.getInstance().resetPodStatus();
|
||||
}
|
||||
|
||||
//refreshButtons()
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.dialogs.wizard.pages;
|
||||
|
||||
import com.atech.android.library.wizardpager.defs.action.AbstractCancelAction;
|
||||
import com.atech.android.library.wizardpager.defs.action.FinishActionInterface;
|
||||
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.dialogs.PodManagementActivity;
|
||||
|
||||
/**
|
||||
* Created by andy on 12/11/2019
|
||||
*/
|
||||
public class InitPodRefreshAction extends AbstractCancelAction implements FinishActionInterface {
|
||||
|
||||
private PodManagementActivity podManagementActivity;
|
||||
|
||||
public InitPodRefreshAction(PodManagementActivity podManagementActivity) {
|
||||
this.podManagementActivity = podManagementActivity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(String cancelReason) {
|
||||
if (cancelReason != null && cancelReason.trim().length() > 0) {
|
||||
this.cancelActionText = cancelReason;
|
||||
}
|
||||
|
||||
if (this.cancelActionText.equals("Cancel")) {
|
||||
//AapsOmnipodManager.getInstance().resetPodStatus();
|
||||
}
|
||||
|
||||
podManagementActivity.refreshButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
podManagementActivity.refreshButtons();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFinishActionText() {
|
||||
return "Finish_OK";
|
||||
}
|
||||
}
|
|
@ -29,7 +29,7 @@ import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalSchedu
|
|||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.schedule.BasalScheduleEntry;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.defs.state.PodSessionState;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.OmnipodPumpStatus;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodDbEntryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.driver.db.PodHistoryEntryType;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.ActionInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommandInitializationException;
|
||||
import info.nightscout.androidaps.plugins.pump.omnipod.exception.CommunicationException;
|
||||
|
@ -308,7 +308,7 @@ public class AapsOmnipodManager implements OmnipodCommunicationManagerInterface
|
|||
}
|
||||
|
||||
|
||||
private void addToHistory(long requestTime, PodDbEntryType entryType, String data, boolean success) {
|
||||
private void addToHistory(long requestTime, PodHistoryEntryType entryType, String data, boolean success) {
|
||||
// TODO andy needs to be refactored
|
||||
|
||||
//PodDbEntry entry = new PodDbEntry(requestTime, entryType);
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||
|
||||
import info.nightscout.androidaps.db.DbObjectBase;
|
||||
|
||||
/**
|
||||
* Created by andy on 24.11.2019
|
||||
*/
|
||||
public class PodDbEntry implements DbObjectBase {
|
||||
|
||||
private long dateTime;
|
||||
private PodDbEntryType podDbEntryType;
|
||||
private String data;
|
||||
private boolean success;
|
||||
private long pumpId;
|
||||
private Boolean successConfirmed;
|
||||
|
||||
//private String request;
|
||||
//private long dateTimeResponse;
|
||||
//private String response;
|
||||
|
||||
|
||||
public PodDbEntry(PodDbEntryType podDbEntryType) {
|
||||
this.dateTime = System.currentTimeMillis();
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
public PodDbEntry(long requestTime, PodDbEntryType podDbEntryType) {
|
||||
this.dateTime = requestTime;
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public long getDateTime() {
|
||||
return dateTime;
|
||||
}
|
||||
|
||||
public void setDateTime(long dateTime) {
|
||||
this.dateTime = dateTime;
|
||||
}
|
||||
|
||||
public PodDbEntryType getPodDbEntryType() {
|
||||
return podDbEntryType;
|
||||
}
|
||||
|
||||
public void setPodDbEntryType(PodDbEntryType podDbEntryType) {
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long getDate() {
|
||||
return this.dateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getPumpId() {
|
||||
return pumpId;
|
||||
}
|
||||
|
||||
private void generatePumpId() {
|
||||
// TODO
|
||||
// yyyymmddhhMMssxx (time and xx is code of podDbEntryType)
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -22,7 +22,7 @@ public class PodHistory implements DbObjectBase {
|
|||
@DatabaseField(id = true)
|
||||
public long date;
|
||||
|
||||
private PodDbEntryType podDbEntryType;
|
||||
private PodHistoryEntryType podHistoryEntryType;
|
||||
|
||||
@DatabaseField
|
||||
private long podEntryTypeCode;
|
||||
|
@ -36,21 +36,26 @@ public class PodHistory implements DbObjectBase {
|
|||
@DatabaseField
|
||||
private long pumpId;
|
||||
|
||||
@DatabaseField
|
||||
private String podSerial;
|
||||
|
||||
@DatabaseField
|
||||
private Boolean successConfirmed;
|
||||
|
||||
|
||||
|
||||
public PodHistory(PodDbEntryType podDbEntryType) {
|
||||
public PodHistory(PodHistoryEntryType podDbEntryType) {
|
||||
this.date = System.currentTimeMillis();
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
||||
public PodHistory(long dateTimeInMillis, PodDbEntryType podDbEntryType) {
|
||||
public PodHistory(long dateTimeInMillis, PodHistoryEntryType podDbEntryType) {
|
||||
this.date = dateTimeInMillis;
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
generatePumpId();
|
||||
}
|
||||
|
||||
|
@ -64,12 +69,12 @@ public class PodHistory implements DbObjectBase {
|
|||
this.date = date;
|
||||
}
|
||||
|
||||
public PodDbEntryType getPodDbEntryType() {
|
||||
return podDbEntryType;
|
||||
public PodHistoryEntryType getPodDbEntryType() {
|
||||
return podHistoryEntryType;
|
||||
}
|
||||
|
||||
public void setPodDbEntryType(PodDbEntryType podDbEntryType) {
|
||||
this.podDbEntryType = podDbEntryType;
|
||||
public void setPodDbEntryType(PodHistoryEntryType podDbEntryType) {
|
||||
this.podHistoryEntryType = podDbEntryType;
|
||||
this.podEntryTypeCode = podDbEntryType.getCode();
|
||||
}
|
||||
|
||||
|
@ -115,4 +120,11 @@ public class PodHistory implements DbObjectBase {
|
|||
}
|
||||
|
||||
|
||||
public String getPodSerial() {
|
||||
return podSerial;
|
||||
}
|
||||
|
||||
public void setPodSerial(String podSerial) {
|
||||
this.podSerial = podSerial;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
package info.nightscout.androidaps.plugins.pump.omnipod.driver.db;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by andy on 24.11.2019
|
||||
*/
|
||||
public enum PodDbEntryType {
|
||||
public enum PodHistoryEntryType {
|
||||
|
||||
PairAndPrime(1),
|
||||
InsertCannula(2),
|
||||
|
@ -29,9 +32,19 @@ public enum PodDbEntryType {
|
|||
;
|
||||
|
||||
private int code;
|
||||
private static Map<Integer, PodHistoryEntryType> instanceMap;
|
||||
|
||||
PodDbEntryType(int code) {
|
||||
|
||||
static {
|
||||
instanceMap = new HashMap<>();
|
||||
|
||||
for (PodHistoryEntryType value : values()) {
|
||||
instanceMap.put(value.code, value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PodHistoryEntryType(int code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
Loading…
Reference in a new issue