temp basal dialog design
This commit is contained in:
parent
3861bece54
commit
f5f7d28cc1
8 changed files with 269 additions and 198 deletions
|
@ -6,9 +6,8 @@ package info.nightscout.androidaps.interfaces;
|
|||
|
||||
public class PumpDescription {
|
||||
public static final int NONE = 0;
|
||||
public static final int PERCENT = 1;
|
||||
public static final int ABSOLUTE = 2;
|
||||
public static final int EXTENDED = 4;
|
||||
public static final int PERCENT = 0x01;
|
||||
public static final int ABSOLUTE = 0x02;
|
||||
|
||||
public boolean isBolusCapable = true;
|
||||
public double bolusStep = 0.1d;
|
||||
|
@ -19,18 +18,17 @@ public class PumpDescription {
|
|||
public double extendedBolusMaxDuration = 12 * 60;
|
||||
|
||||
public boolean isTempBasalCapable = true;
|
||||
public int lowTempBasalStyle = PERCENT;
|
||||
public int highTempBasalStyle = PERCENT;
|
||||
public int maxHighTempPercent = 200;
|
||||
public double maxHighTempAbsolute = 0; // zero = no limit
|
||||
public int lowTempPercentStep = 10;
|
||||
public double lowTempAbsoluteStep = 0.05d;
|
||||
public int lowTempPercentDuration = 30;
|
||||
public int lowTempAbsoluteDuration = 30;
|
||||
public double highTempPercentStep = 10;
|
||||
public double highTempAbsoluteStep = 0.05d;
|
||||
public int highTempPercentDuration = 30;
|
||||
public int highTempAbsoluteDuration = 30;
|
||||
public int tempBasalStyle = PERCENT;
|
||||
|
||||
public int maxTempPercent = 200;
|
||||
public int tempPercentStep = 10;
|
||||
|
||||
public double maxTempAbsolute = 10;
|
||||
public double tempAbsoluteStep = 0.05d;
|
||||
|
||||
public int tempDurationStep = 60;
|
||||
public int tempMaxDuration = 12 * 60;
|
||||
|
||||
|
||||
public boolean isSetBasalProfileCapable = true;
|
||||
public double basalStep = 0.01d;
|
||||
|
|
|
@ -11,11 +11,10 @@ import android.support.v7.app.AlertDialog;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.RelativeLayout;
|
||||
|
||||
import com.crashlytics.android.answers.Answers;
|
||||
import com.crashlytics.android.answers.CustomEvent;
|
||||
|
@ -26,6 +25,7 @@ import info.nightscout.androidaps.Constants;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.PumpEnactResult;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSProfile;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
|
@ -33,23 +33,17 @@ import info.nightscout.utils.SafeParse;
|
|||
|
||||
public class NewTempBasalDialog extends DialogFragment implements View.OnClickListener, RadioGroup.OnCheckedChangeListener {
|
||||
|
||||
Button okButton;
|
||||
EditText basalPercentEdit;
|
||||
EditText basalAbsoluteEdit;
|
||||
RadioButton percentRadio;
|
||||
RadioButton absoluteRadio;
|
||||
RadioGroup basalTypeRadioGroup;
|
||||
RadioButton h05Radio;
|
||||
RadioButton h10Radio;
|
||||
RadioButton h20Radio;
|
||||
RadioButton h30Radio;
|
||||
RadioButton h40Radio;
|
||||
RelativeLayout typeSelectorLayout;
|
||||
|
||||
LinearLayout percentLayout;
|
||||
LinearLayout absoluteLayout;
|
||||
|
||||
PlusMinusEditText basalPercentPM;
|
||||
PlusMinusEditText basalAbsolutePM;
|
||||
PlusMinusEditText basalPercent;
|
||||
PlusMinusEditText basalAbsolute;
|
||||
PlusMinusEditText duration;
|
||||
|
||||
Handler mHandler;
|
||||
public static HandlerThread mHandlerThread;
|
||||
|
@ -66,31 +60,51 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
getDialog().setTitle(getString(R.string.overview_tempbasal_button));
|
||||
|
||||
View view = inflater.inflate(R.layout.overview_newtempbasal_dialog, container, false);
|
||||
okButton = (Button) view.findViewById(R.id.overview_newtempbasal_okbutton);
|
||||
basalPercentEdit = (EditText) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
|
||||
basalAbsoluteEdit = (EditText) view.findViewById(R.id.overview_newtempbasal_basalabsoluteinput);
|
||||
|
||||
percentLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_percent_layout);
|
||||
absoluteLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_absolute_layout);
|
||||
percentRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_percent_radio);
|
||||
basalTypeRadioGroup = (RadioGroup) view.findViewById(R.id.overview_newtempbasal_radiogroup);
|
||||
absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
|
||||
h05Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_05h);
|
||||
h10Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_1h);
|
||||
h20Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_2h);
|
||||
h30Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_3h);
|
||||
h40Radio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_4h);
|
||||
typeSelectorLayout = (RelativeLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
|
||||
|
||||
Integer maxPercent = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalPercentOnlyForCheckLimit);
|
||||
basalPercentPM = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus, 100d, 0d, (double) maxPercent, 5d, new DecimalFormat("0"), true);
|
||||
PumpDescription pumpDescription = MainApp.getConfigBuilder().getPumpDescription();
|
||||
|
||||
basalPercent = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus,
|
||||
100d, 0d, (double) pumpDescription.maxTempPercent, (double) pumpDescription.tempPercentStep, new DecimalFormat("0"), true);
|
||||
|
||||
Double maxAbsolute = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalAbsoluteOnlyForCheckLimit);
|
||||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
Double currentBasal = 0d;
|
||||
if (profile != null) currentBasal = profile.getBasal(NSProfile.secondsFromMidnight());
|
||||
basalAbsolutePM = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus, currentBasal, 0d, maxAbsolute, 0.05d, new DecimalFormat("0.00"), true);
|
||||
basalAbsolute = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus,
|
||||
currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true);
|
||||
|
||||
double tempDurationStep = MainApp.getConfigBuilder().getPumpDescription().tempDurationStep;
|
||||
double tempMaxDuration = MainApp.getConfigBuilder().getPumpDescription().tempMaxDuration;
|
||||
duration = new PlusMinusEditText(view, R.id.overview_newtempbasal_duration, R.id.overview_newtempbasal_duration_plus, R.id.overview_newtempbasal_duration_minus,
|
||||
tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false);
|
||||
|
||||
if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT && (pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
|
||||
// Both allowed
|
||||
typeSelectorLayout.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
typeSelectorLayout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT) {
|
||||
percentRadio.setChecked(true);
|
||||
absoluteRadio.setChecked(false);
|
||||
percentLayout.setVisibility(View.VISIBLE);
|
||||
absoluteLayout.setVisibility(View.GONE);
|
||||
okButton.setOnClickListener(this);
|
||||
} else if ((pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
|
||||
percentRadio.setChecked(false);
|
||||
absoluteRadio.setChecked(true);
|
||||
percentLayout.setVisibility(View.GONE);
|
||||
absoluteLayout.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||
basalTypeRadioGroup.setOnCheckedChangeListener(this);
|
||||
return view;
|
||||
}
|
||||
|
@ -105,36 +119,32 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
@Override
|
||||
public void onClick(View view) {
|
||||
switch (view.getId()) {
|
||||
case R.id.overview_newtempbasal_okbutton:
|
||||
case R.id.ok:
|
||||
try {
|
||||
int basalPercent = 0;
|
||||
Double basalAbsolute = 0d;
|
||||
int percent = 0;
|
||||
Double absolute = 0d;
|
||||
final boolean setAsPercent = percentRadio.isChecked();
|
||||
int durationInMinutes = 30;
|
||||
if (h10Radio.isChecked()) durationInMinutes = 60;
|
||||
if (h20Radio.isChecked()) durationInMinutes = 120;
|
||||
if (h30Radio.isChecked()) durationInMinutes = 180;
|
||||
if (h40Radio.isChecked()) durationInMinutes = 240;
|
||||
int durationInMinutes = SafeParse.stringToInt(duration.getText());
|
||||
|
||||
String confirmMessage = getString(R.string.setbasalquestion);
|
||||
if (setAsPercent) {
|
||||
int basalPercentInput = SafeParse.stringToDouble(basalPercentEdit.getText().toString()).intValue();
|
||||
basalPercent = MainApp.getConfigBuilder().applyBasalConstraints(basalPercentInput);
|
||||
confirmMessage += "\n" + basalPercent + "% ";
|
||||
int basalPercentInput = SafeParse.stringToInt(basalPercent.getText());
|
||||
percent = MainApp.getConfigBuilder().applyBasalConstraints(basalPercentInput);
|
||||
confirmMessage += "\n" + percent + "% ";
|
||||
confirmMessage += "\n" + getString(R.string.duration) + " " + durationInMinutes + "min ?";
|
||||
if (basalPercent != basalPercentInput)
|
||||
if (percent != basalPercentInput)
|
||||
confirmMessage += "\n" + getString(R.string.constraintapllied);
|
||||
} else {
|
||||
Double basalAbsoluteInput = SafeParse.stringToDouble(basalAbsoluteEdit.getText().toString());
|
||||
basalAbsolute = MainApp.getConfigBuilder().applyBasalConstraints(basalAbsoluteInput);
|
||||
confirmMessage += "\n" + basalAbsolute + " U/h ";
|
||||
Double basalAbsoluteInput = SafeParse.stringToDouble(basalAbsolute.getText());
|
||||
absolute = MainApp.getConfigBuilder().applyBasalConstraints(basalAbsoluteInput);
|
||||
confirmMessage += "\n" + absolute + " U/h ";
|
||||
confirmMessage += "\n" + getString(R.string.duration) + " " + durationInMinutes + "min ?";
|
||||
if (basalAbsolute - basalAbsoluteInput != 0d)
|
||||
if (absolute - basalAbsoluteInput != 0d)
|
||||
confirmMessage += "\n" + getString(R.string.constraintapllied);
|
||||
}
|
||||
|
||||
final int finalBasalPercent = basalPercent;
|
||||
final Double finalBasal = basalAbsolute;
|
||||
final int finalBasalPercent = percent;
|
||||
final Double finalBasal = absolute;
|
||||
final int finalDurationInMinutes = durationInMinutes;
|
||||
|
||||
final Context context = getContext();
|
||||
|
@ -178,6 +188,10 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
break;
|
||||
case R.id.cancel:
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -78,26 +78,23 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
MainApp.bus().register(this);
|
||||
|
||||
pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
|
||||
pumpDescription.bolusStep = 0.05d;
|
||||
pumpDescription.isBolusCapable = true;
|
||||
pumpDescription.bolusStep = 0.1d;
|
||||
|
||||
pumpDescription.isExtendedBolusCapable = true;
|
||||
pumpDescription.extendedBolusStep = 0.05d;
|
||||
pumpDescription.extendedBolusStep = 0.1d;
|
||||
pumpDescription.extendedBolusDurationStep = 30;
|
||||
pumpDescription.extendedBolusMaxDuration = 8 * 60;
|
||||
|
||||
pumpDescription.isTempBasalCapable = true;
|
||||
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
|
||||
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||
pumpDescription.maxHighTempPercent = 200;
|
||||
pumpDescription.maxHighTempAbsolute = 0;
|
||||
pumpDescription.lowTempPercentStep = 10;
|
||||
pumpDescription.lowTempAbsoluteStep = 0;
|
||||
pumpDescription.lowTempPercentDuration = 60;
|
||||
pumpDescription.lowTempAbsoluteDuration = 60;
|
||||
pumpDescription.highTempPercentStep = 10;
|
||||
pumpDescription.highTempAbsoluteStep = 0.05d;
|
||||
pumpDescription.highTempPercentDuration = 60;
|
||||
pumpDescription.highTempAbsoluteDuration = 30;
|
||||
pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
|
||||
|
||||
pumpDescription.maxTempPercent = 200;
|
||||
pumpDescription.tempPercentStep = 10;
|
||||
|
||||
pumpDescription.tempDurationStep = 60;
|
||||
pumpDescription.tempMaxDuration = 24 * 60;
|
||||
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.basalStep = 0.01d;
|
||||
|
@ -132,8 +129,6 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
boolean previousValue = useExtendedBoluses;
|
||||
useExtendedBoluses = SP.getBoolean("danar_useextended", false);
|
||||
|
||||
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||
|
||||
if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
sExecutionService.extendedBolusStop();
|
||||
}
|
||||
|
@ -381,8 +376,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
||||
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
|
||||
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
|
||||
if (percentRate > getPumpDescription().maxHighTempPercent) {
|
||||
percentRate = getPumpDescription().maxHighTempPercent;
|
||||
if (percentRate > getPumpDescription().maxTempPercent) {
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
}
|
||||
// If extended in progress
|
||||
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {
|
||||
|
@ -499,8 +494,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
log.error("setTempBasalPercent: Invalid input");
|
||||
return result;
|
||||
}
|
||||
if (percent > getPumpDescription().maxHighTempPercent)
|
||||
percent = getPumpDescription().maxHighTempPercent;
|
||||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
|
@ -754,8 +749,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
public Integer applyBasalConstraints(Integer percentRate) {
|
||||
Integer origPercentRate = percentRate;
|
||||
if (percentRate < 0) percentRate = 0;
|
||||
if (percentRate > getPumpDescription().maxHighTempPercent)
|
||||
percentRate = getPumpDescription().maxHighTempPercent;
|
||||
if (percentRate > getPumpDescription().maxTempPercent)
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
|
||||
return percentRate;
|
||||
|
|
|
@ -81,26 +81,23 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
MainApp.bus().register(this);
|
||||
|
||||
pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
|
||||
pumpDescription.isBolusCapable = true;
|
||||
pumpDescription.bolusStep = 0.1d;
|
||||
|
||||
pumpDescription.isExtendedBolusCapable = true;
|
||||
pumpDescription.extendedBolusStep = 0.05d;
|
||||
pumpDescription.extendedBolusStep = 0.1d;
|
||||
pumpDescription.extendedBolusDurationStep = 30;
|
||||
pumpDescription.extendedBolusMaxDuration = 8 * 60;
|
||||
|
||||
pumpDescription.isTempBasalCapable = true;
|
||||
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
|
||||
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||
pumpDescription.maxHighTempPercent = 200;
|
||||
pumpDescription.maxHighTempAbsolute = 0;
|
||||
pumpDescription.lowTempPercentStep = 10;
|
||||
pumpDescription.lowTempAbsoluteStep = 0;
|
||||
pumpDescription.lowTempPercentDuration = 60;
|
||||
pumpDescription.lowTempAbsoluteDuration = 60;
|
||||
pumpDescription.highTempPercentStep = 10;
|
||||
pumpDescription.highTempAbsoluteStep = 0.05d;
|
||||
pumpDescription.highTempPercentDuration = 60;
|
||||
pumpDescription.highTempAbsoluteDuration = 30;
|
||||
pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
|
||||
|
||||
pumpDescription.maxTempPercent = 200;
|
||||
pumpDescription.tempPercentStep = 10;
|
||||
|
||||
pumpDescription.tempDurationStep = 60;
|
||||
pumpDescription.tempMaxDuration = 24 * 60;
|
||||
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.basalStep = 0.01d;
|
||||
|
@ -135,8 +132,6 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
boolean previousValue = useExtendedBoluses;
|
||||
useExtendedBoluses = SP.getBoolean("danar_useextended", false);
|
||||
|
||||
pumpDescription.highTempBasalStyle = useExtendedBoluses ? PumpDescription.EXTENDED : PumpDescription.PERCENT;
|
||||
|
||||
if (useExtendedBoluses != previousValue && MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
|
||||
sExecutionService.extendedBolusStop();
|
||||
}
|
||||
|
@ -502,8 +497,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
log.error("setTempBasalPercent: Invalid input");
|
||||
return result;
|
||||
}
|
||||
if (percent > getPumpDescription().maxHighTempPercent)
|
||||
percent = getPumpDescription().maxHighTempPercent;
|
||||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
|
@ -757,8 +752,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
public Integer applyBasalConstraints(Integer percentRate) {
|
||||
Integer origPercentRate = percentRate;
|
||||
if (percentRate < 0) percentRate = 0;
|
||||
if (percentRate > getPumpDescription().maxHighTempPercent)
|
||||
percentRate = getPumpDescription().maxHighTempPercent;
|
||||
if (percentRate > getPumpDescription().maxTempPercent)
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
|
||||
return percentRate;
|
||||
|
|
|
@ -78,26 +78,23 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
|
|||
context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);
|
||||
MainApp.bus().register(this);
|
||||
|
||||
pumpDescription.isBolusCapable = true; // TODO: use description in setTempBasalAbsolute
|
||||
pumpDescription.bolusStep = 0.05d;
|
||||
pumpDescription.isBolusCapable = true;
|
||||
pumpDescription.bolusStep = 0.1d;
|
||||
|
||||
pumpDescription.isExtendedBolusCapable = true;
|
||||
pumpDescription.extendedBolusStep = 0.05d;
|
||||
pumpDescription.extendedBolusDurationStep = 30;
|
||||
pumpDescription.extendedBolusMaxDuration = 8 * 60;
|
||||
|
||||
pumpDescription.isTempBasalCapable = true;
|
||||
pumpDescription.lowTempBasalStyle = PumpDescription.PERCENT;
|
||||
pumpDescription.highTempBasalStyle = PumpDescription.PERCENT;
|
||||
pumpDescription.maxHighTempPercent = 500;
|
||||
pumpDescription.maxHighTempAbsolute = 0;
|
||||
pumpDescription.lowTempPercentStep = 10;
|
||||
pumpDescription.lowTempAbsoluteStep = 0;
|
||||
pumpDescription.lowTempPercentDuration = 30;
|
||||
pumpDescription.lowTempAbsoluteDuration = 30;
|
||||
pumpDescription.highTempPercentStep = 10;
|
||||
pumpDescription.highTempAbsoluteStep = 0;
|
||||
pumpDescription.highTempPercentDuration = 15;
|
||||
pumpDescription.highTempAbsoluteDuration = 0;
|
||||
pumpDescription.tempBasalStyle = PumpDescription.PERCENT;
|
||||
|
||||
pumpDescription.maxTempPercent = 200;
|
||||
pumpDescription.tempPercentStep = 10;
|
||||
|
||||
pumpDescription.tempDurationStep = 60;
|
||||
pumpDescription.tempMaxDuration = 24 * 60;
|
||||
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.basalStep = 0.01d;
|
||||
|
@ -360,8 +357,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
|
|||
Integer percentRate = Double.valueOf(absoluteRate / getBaseBasalRate() * 100).intValue();
|
||||
if (percentRate < 100) percentRate = Round.ceilTo((double) percentRate, 10d).intValue();
|
||||
else percentRate = Round.floorTo((double) percentRate, 10d).intValue();
|
||||
if (percentRate > getPumpDescription().maxHighTempPercent)
|
||||
percentRate = getPumpDescription().maxHighTempPercent;
|
||||
if (percentRate > getPumpDescription().maxTempPercent)
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
// Check if some temp is already in progress
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
// Correct basal already set ?
|
||||
|
@ -412,8 +409,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
|
|||
log.error("setTempBasalPercent: Invalid input");
|
||||
return result;
|
||||
}
|
||||
if (percent > getPumpDescription().maxHighTempPercent)
|
||||
percent = getPumpDescription().maxHighTempPercent;
|
||||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
if (pump.isTempBasalInProgress && pump.tempBasalPercent == percent) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
|
@ -674,8 +671,8 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, ConstraintsInte
|
|||
public Integer applyBasalConstraints(Integer percentRate) {
|
||||
Integer origPercentRate = percentRate;
|
||||
if (percentRate < 0) percentRate = 0;
|
||||
if (percentRate > getPumpDescription().maxHighTempPercent)
|
||||
percentRate = getPumpDescription().maxHighTempPercent;
|
||||
if (percentRate > getPumpDescription().maxTempPercent)
|
||||
percentRate = getPumpDescription().maxTempPercent;
|
||||
if (!Objects.equals(percentRate, origPercentRate) && Config.logConstraintsChanges && !Objects.equals(origPercentRate, Constants.basalPercentOnlyForCheckLimit))
|
||||
log.debug("Limiting percent rate " + origPercentRate + "% to " + percentRate + "%");
|
||||
return percentRate;
|
||||
|
|
|
@ -54,22 +54,19 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
pumpDescription.bolusStep = 0.1d;
|
||||
|
||||
pumpDescription.isExtendedBolusCapable = true;
|
||||
pumpDescription.extendedBolusStep = 0.2d;
|
||||
pumpDescription.extendedBolusStep = 0.05d;
|
||||
pumpDescription.extendedBolusDurationStep = 30;
|
||||
pumpDescription.extendedBolusMaxDuration = 8 * 60;
|
||||
|
||||
pumpDescription.isTempBasalCapable = true;
|
||||
pumpDescription.lowTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
|
||||
pumpDescription.highTempBasalStyle = PumpDescription.ABSOLUTE | PumpDescription.PERCENT;
|
||||
pumpDescription.maxHighTempPercent = 600;
|
||||
pumpDescription.maxHighTempAbsolute = 10;
|
||||
pumpDescription.lowTempPercentStep = 5;
|
||||
pumpDescription.lowTempAbsoluteStep = 0.1;
|
||||
pumpDescription.lowTempPercentDuration = 30;
|
||||
pumpDescription.lowTempAbsoluteDuration = 30;
|
||||
pumpDescription.highTempPercentStep = 10;
|
||||
pumpDescription.highTempAbsoluteStep = 0.05d;
|
||||
pumpDescription.highTempPercentDuration = 30;
|
||||
pumpDescription.highTempAbsoluteDuration = 30;
|
||||
pumpDescription.tempBasalStyle = PumpDescription.PERCENT | PumpDescription.ABSOLUTE;
|
||||
|
||||
pumpDescription.maxTempPercent = 500;
|
||||
pumpDescription.tempPercentStep = 10;
|
||||
|
||||
pumpDescription.tempDurationStep = 30;
|
||||
pumpDescription.tempMaxDuration = 24 * 60;
|
||||
|
||||
|
||||
pumpDescription.isSetBasalProfileCapable = true;
|
||||
pumpDescription.basalStep = 0.01d;
|
||||
|
|
|
@ -17,37 +17,56 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
<RelativeLayout
|
||||
android:id="@+id/overview_newtempbasal_typeselector_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/overview_newtempbasal_basaltype_label"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/overview_newtempbasal_radiogroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_percent_radio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="20dp"
|
||||
android:checked="true"
|
||||
android:text="@string/overview_newtempbasal_percent_label" />
|
||||
android:text="@string/overview_newtempbasal_percent_label"
|
||||
/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_absolute_radio"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:text="U/h" />
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/listdelimiter" />
|
||||
|
||||
<LinearLayout
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
@ -55,16 +74,18 @@
|
|||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:padding="10dp"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/overview_newtempbasal_basal_label"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/overview_newtempbasal_percent_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
@ -103,6 +124,16 @@
|
|||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="%"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
@ -110,7 +141,8 @@
|
|||
android:id="@+id/overview_newtempbasal_absolute_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
|
||||
|
@ -149,59 +181,101 @@
|
|||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="U/h"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="2dip"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:layout_paddingBottom="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:background="@color/listdelimiter" />
|
||||
|
||||
</LinearLayout>
|
||||
</RelativeLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_05h"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="0.5 h" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_1h"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="1 h" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_2h"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="2 h" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_3h"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="3 h" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/overview_newtempbasal_4h"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="4 h" />
|
||||
</RadioGroup>
|
||||
|
||||
<Button
|
||||
android:id="@+id/overview_newtempbasal_okbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
<RelativeLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="10dp"
|
||||
android:text="OK"
|
||||
android:textSize="20sp" />
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_marginTop="5dp"
|
||||
android:text="@string/careportal_newnstreatment_duration_label"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Small"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginTop="30dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/overview_newtempbasal_duration_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/overview_newtempbasal_duration"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:minWidth="100dp"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/overview_newtempbasal_duration_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/careportal_newnstreatment_minutes"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<include layout="@layout/mdtp_done_button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</FrameLayout>
|
|
@ -619,4 +619,5 @@
|
|||
<string name="careportal_canulaage_label">Canula age</string>
|
||||
<string name="careportal_insulinage_label">Insulin age</string>
|
||||
<string name="hours">hours</string>
|
||||
<string name="overview_newtempbasal_basaltype_label">Basal type</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue