diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
index 0874f29588..13c7f26efb 100644
--- a/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
+++ b/app/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.java
@@ -15,6 +15,8 @@ public class PumpDescription {
public boolean isExtendedBolusCapable = true;
public double extendedBolusStep = 0.1d;
+ public double extendedBolusDurationStep = 30;
+ public double extendedBolusMaxDuration = 12 * 60;
public boolean isTempBasalCapable = true;
public int lowTempBasalStyle = PERCENT;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java
index ee726efb4d..c85d5c4540 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Actions/dialogs/NewExtendedBolusDialog.java
@@ -29,15 +29,8 @@ import info.nightscout.utils.SafeParse;
public class NewExtendedBolusDialog extends DialogFragment implements View.OnClickListener {
- Button okButton;
- EditText insulinEdit;
- RadioButton h05Radio;
- RadioButton h10Radio;
- RadioButton h20Radio;
- RadioButton h30Radio;
- RadioButton h40Radio;
-
PlusMinusEditText editInsulin;
+ PlusMinusEditText editDuration;
Handler mHandler;
public static HandlerThread mHandlerThread;
@@ -54,18 +47,16 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
getDialog().setTitle(getString(R.string.overview_extendedbolus_button));
View view = inflater.inflate(R.layout.overview_newextendedbolus_dialog, container, false);
- okButton = (Button) view.findViewById(R.id.overview_newextendedbolus_okbutton);
- insulinEdit = (EditText) view.findViewById(R.id.overview_newextendedbolus_insulin);
- h05Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_05h);
- h10Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_1h);
- h20Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_2h);
- h30Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_3h);
- h40Radio = (RadioButton) view.findViewById(R.id.overview_newextendedbolus_4h);
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
editInsulin = new PlusMinusEditText(view, R.id.overview_newextendedbolus_insulin, R.id.overview_newextendedbolus_insulin_plus, R.id.overview_newextendedbolus_insulin_minus, 0d, 0d, maxInsulin, 0.1d, new DecimalFormat("0.00"), false);
- okButton.setOnClickListener(this);
+ double extendedDurationStep = MainApp.getConfigBuilder().getPumpDescription().extendedBolusDurationStep;
+ double extendedMaxDuration = MainApp.getConfigBuilder().getPumpDescription().extendedBolusMaxDuration;
+ editDuration = new PlusMinusEditText(view, R.id.overview_newextendedbolus_duration, R.id.overview_newextendedbolus_duration_plus, R.id.overview_newextendedbolus_duration_minus, extendedDurationStep, extendedDurationStep, extendedMaxDuration, extendedDurationStep, new DecimalFormat("0"), false);
+
+ view.findViewById(R.id.ok).setOnClickListener(this);
+ view.findViewById(R.id.cancel).setOnClickListener(this);
return view;
}
@@ -79,14 +70,10 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
@Override
public void onClick(View view) {
switch (view.getId()) {
- case R.id.overview_newextendedbolus_okbutton:
+ case R.id.ok:
try {
- Double insulin = SafeParse.stringToDouble(insulinEdit.getText().toString());
- int durationInMinutes = 30;
- if (h10Radio.isChecked()) durationInMinutes = 60;
- if (h20Radio.isChecked()) durationInMinutes = 120;
- if (h30Radio.isChecked()) durationInMinutes = 180;
- if (h40Radio.isChecked()) durationInMinutes = 240;
+ Double insulin = SafeParse.stringToDouble(editInsulin.getText());
+ int durationInMinutes = SafeParse.stringToInt(editDuration.getText());
String confirmMessage = getString(R.string.setextendedbolusquestion);
@@ -130,6 +117,10 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
} catch (Exception e) {
e.printStackTrace();
}
+ break;
+ case R.id.cancel:
+ dismiss();
+ break;
}
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
index d15c7ec2ef..b908507d09 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewTreatmentDialog.java
@@ -33,11 +33,6 @@ import info.nightscout.utils.SafeParse;
public class NewTreatmentDialog extends DialogFragment implements OnClickListener {
- Button okButton;
- Button cancelButton;
- TextView insulin;
- TextView carbs;
-
PlusMinusEditText editCarbs;
PlusMinusEditText editInsulin;
@@ -55,15 +50,11 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.overview_newtreatment_dialog, null, false);
- okButton = (Button) view.findViewById(R.id.ok);
- okButton.setOnClickListener(this);
- cancelButton = (Button) view.findViewById(R.id.cancel);
- cancelButton.setOnClickListener(this);
+ view.findViewById(R.id.ok).setOnClickListener(this);
+ view.findViewById(R.id.cancel).setOnClickListener(this);
getDialog().getWindow().requestFeature(Window.FEATURE_NO_TITLE);
getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
- insulin = (TextView) view.findViewById(R.id.treatments_newtreatment_insulinamount);
- carbs = (TextView) view.findViewById(R.id.treatments_newtreatment_carbsamount);
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
@@ -87,8 +78,8 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
case R.id.ok:
try {
- Double insulin = SafeParse.stringToDouble(this.insulin.getText().toString());
- final Integer carbs = SafeParse.stringToInt(this.carbs.getText().toString());
+ Double insulin = SafeParse.stringToDouble(editInsulin.getText());
+ final Integer carbs = SafeParse.stringToInt(editCarbs.getText());
String confirmMessage = getString(R.string.entertreatmentquestion) + "\n";
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
index 1faf2f5f7e..70fa2cbce0 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/DanaRPlugin.java
@@ -83,6 +83,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.05d;
+ pumpDescription.extendedBolusDurationStep = 30;
pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
index 9b76b993b3..ff10012f2b 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaR/services/DanaRExecutionService.java
@@ -96,7 +96,7 @@ public class DanaRExecutionService extends Service {
private PowerManager.WakeLock mWakeLock;
private IBinder mBinder = new LocalBinder();
- private DanaRPump danaRPump;
+ private DanaRPump danaRPump = DanaRPump.getInstance();
private Treatment bolusingTreatment = null;
private static Boolean connectionInProgress = false;
@@ -124,7 +124,6 @@ public class DanaRExecutionService extends Service {
public DanaRExecutionService() {
registerBus();
MainApp.instance().getApplicationContext().registerReceiver(receiver, new IntentFilter(BluetoothDevice.ACTION_ACL_DISCONNECTED));
- danaRPump = DanaRPump.getInstance();
PowerManager powerManager = (PowerManager) MainApp.instance().getApplicationContext().getSystemService(Context.POWER_SERVICE);
mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "DanaRExecutionService");
@@ -404,6 +403,7 @@ public class DanaRExecutionService extends Service {
Calendar time = Calendar.getInstance();
mSerialIOThread.sendMessage(new MsgSetCarbsEntry(time, carbs));
}
+
MsgBolusProgress progress = new MsgBolusProgress(amount, t); // initialize static variables
MainApp.bus().post(new EventDanaRBolusStart());
long startTime = new Date().getTime();
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
index 632f66db83..7d6e96a7e8 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/DanaRKoreanPlugin.java
@@ -86,6 +86,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.05d;
+ pumpDescription.extendedBolusDurationStep = 30;
pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
index e660968a1f..d1203a35cb 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRKorean/services/DanaRKoreanExecutionService.java
@@ -219,7 +219,7 @@ public class DanaRKoreanExecutionService extends Service {
mSerialIOThread.disconnect("Recreate SerialIOThread");
}
mSerialIOThread = new SerialIOThread(mRfcommSocket);
- MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTED));
+ MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.CONNECTED, 0));
if (!getPumpStatus()) {
mSerialIOThread.disconnect("getPumpStatus failed");
waitMsec(3000);
@@ -385,7 +385,7 @@ public class DanaRKoreanExecutionService extends Service {
return true;
}
- public boolean bolus(Double amount, int carbs, Treatment t) {
+ public boolean bolus(double amount, int carbs, Treatment t) {
bolusingTreatment = t;
MsgBolusStart start = new MsgBolusStart(amount);
MsgBolusStop stop = new MsgBolusStop(amount, t);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
index 15ca7cd558..d73f8051af 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/DanaRv2Plugin.java
@@ -83,6 +83,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.05d;
+ pumpDescription.extendedBolusDurationStep = 30;
pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
index 9491d0abbd..72009003f6 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpDanaRv2/services/DanaRv2ExecutionService.java
@@ -371,7 +371,7 @@ public class DanaRv2ExecutionService extends Service {
return true;
}
- public boolean bolus(Double amount, int carbs, Treatment t) {
+ public boolean bolus(double amount, int carbs, Treatment t) {
bolusingTreatment = t;
MsgBolusStart start = new MsgBolusStart(amount);
MsgBolusStop stop = new MsgBolusStop(amount, t);
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java
index f2d31b90c6..4354f7d546 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpMDI/MDIPlugin.java
@@ -39,26 +39,8 @@ public class MDIPlugin implements PluginBase, PumpInterface {
pumpDescription.bolusStep = 0.5d;
pumpDescription.isExtendedBolusCapable = false;
- pumpDescription.extendedBolusStep = 0d;
-
pumpDescription.isTempBasalCapable = false;
- pumpDescription.lowTempBasalStyle = PumpDescription.NONE;
- pumpDescription.highTempBasalStyle = PumpDescription.NONE;
- pumpDescription.maxHighTempPercent = 0;
- pumpDescription.maxHighTempAbsolute = 0;
- pumpDescription.lowTempPercentStep = 0;
- pumpDescription.lowTempAbsoluteStep = 0;
- pumpDescription.lowTempPercentDuration = 0;
- pumpDescription.lowTempAbsoluteDuration = 0;
- pumpDescription.highTempPercentStep = 0;
- pumpDescription.highTempAbsoluteStep = 0d;
- pumpDescription.highTempPercentDuration = 0;
- pumpDescription.highTempAbsoluteDuration = 0;
-
pumpDescription.isSetBasalProfileCapable = false;
- pumpDescription.basalStep = 0d;
- pumpDescription.basalMinimumRate = 0d;
-
pumpDescription.isRefillingCapable = false;
}
diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
index 6eb658b8a8..9a26ab4359 100644
--- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
+++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpPlugin.java
@@ -55,6 +55,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
pumpDescription.isExtendedBolusCapable = true;
pumpDescription.extendedBolusStep = 0.2d;
+ pumpDescription.extendedBolusDurationStep = 30;
pumpDescription.isTempBasalCapable = true;
pumpDescription.lowTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
@@ -72,7 +73,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
pumpDescription.isSetBasalProfileCapable = true;
pumpDescription.basalStep = 0.01d;
- pumpDescription.basalMinimumRate = 0.04d;
+ pumpDescription.basalMinimumRate = 0.01d;
pumpDescription.isRefillingCapable = false;
}
diff --git a/app/src/main/java/info/nightscout/utils/PlusMinusEditText.java b/app/src/main/java/info/nightscout/utils/PlusMinusEditText.java
index 9bb7062f04..c9949252af 100644
--- a/app/src/main/java/info/nightscout/utils/PlusMinusEditText.java
+++ b/app/src/main/java/info/nightscout/utils/PlusMinusEditText.java
@@ -116,6 +116,10 @@ public class PlusMinusEditText implements View.OnKeyListener,
return value;
}
+ public String getText() {
+ return editText.getText().toString();
+ }
+
public void setStep(Double step) {
this.step = step;
}
diff --git a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml b/app/src/main/res/layout/overview_newextendedbolus_dialog.xml
index d004c5a59d..7a33737ecf 100644
--- a/app/src/main/res/layout/overview_newextendedbolus_dialog.xml
+++ b/app/src/main/res/layout/overview_newextendedbolus_dialog.xml
@@ -9,29 +9,31 @@
+
-
+ android:layout_height="wrap_content">
+
+ android:textAppearance="@android:style/TextAppearance.Material.Small"
+ android:textStyle="bold" />
+ android:textAppearance="?android:attr/textAppearanceLarge" />
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+ android:layout_height="wrap_content">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_newtempbasal_dialog.xml b/app/src/main/res/layout/overview_newtempbasal_dialog.xml
index 57a1fd5649..7c7232fdb1 100644
--- a/app/src/main/res/layout/overview_newtempbasal_dialog.xml
+++ b/app/src/main/res/layout/overview_newtempbasal_dialog.xml
@@ -64,8 +64,8 @@
android:id="@+id/overview_newtempbasal_percent_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:orientation="horizontal">
+ android:tint="#ffffff" />
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:tint="#ffffff" />
@@ -110,8 +110,8 @@
android:id="@+id/overview_newtempbasal_absolute_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:orientation="horizontal"
- android:layout_gravity="center_horizontal">
+ android:layout_gravity="center_horizontal"
+ android:orientation="horizontal">
+ android:tint="#ffffff" />
+ android:textAppearance="?android:attr/textAppearanceLarge" />
+ android:tint="#ffffff" />