Merge branch 'dialogmmol' into dev
This commit is contained in:
commit
8a197f41dc
|
@ -38,6 +38,14 @@ public class Constants {
|
||||||
//DanaR
|
//DanaR
|
||||||
public static final double dailyLimitWarning = 0.95d;
|
public static final double dailyLimitWarning = 0.95d;
|
||||||
|
|
||||||
|
// Temp targets
|
||||||
|
public static final int defaultActivityTTDuration = 90; // min
|
||||||
|
public static final double defaultActivityTTmgdl = 90d;
|
||||||
|
public static final double defaultActivityTTmmol = 5d;
|
||||||
|
public static final int defaultEatingSoonTTDuration = 45; // min
|
||||||
|
public static final double defaultEatingSoonTTmgdl = 140d;
|
||||||
|
public static final double defaultEatingSoonTTmmol = 8d;
|
||||||
|
|
||||||
//NSClientInternal
|
//NSClientInternal
|
||||||
public static final int MAX_LOG_LINES = 100;
|
public static final int MAX_LOG_LINES = 100;
|
||||||
|
|
||||||
|
|
|
@ -247,6 +247,10 @@ public class MainApp extends Application {
|
||||||
return sResources.getString(id, args);
|
return sResources.getString(id, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static int gc(int id) {
|
||||||
|
return sResources.getColor(id);
|
||||||
|
}
|
||||||
|
|
||||||
public static MainApp instance() {
|
public static MainApp instance() {
|
||||||
return sInstance;
|
return sInstance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,15 +36,15 @@ import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
import info.nightscout.androidaps.data.DetailedBolusInfo;
|
||||||
|
import info.nightscout.androidaps.data.Profile;
|
||||||
import info.nightscout.androidaps.db.CareportalEvent;
|
import info.nightscout.androidaps.db.CareportalEvent;
|
||||||
import info.nightscout.androidaps.db.Source;
|
import info.nightscout.androidaps.db.Source;
|
||||||
import info.nightscout.androidaps.db.TempTarget;
|
import info.nightscout.androidaps.db.TempTarget;
|
||||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
|
||||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||||
import info.nightscout.androidaps.plugins.OpenAPSSMB.DetermineBasalResultSMB;
|
|
||||||
import info.nightscout.androidaps.queue.Callback;
|
import info.nightscout.androidaps.queue.Callback;
|
||||||
import info.nightscout.utils.DateUtil;
|
import info.nightscout.utils.DateUtil;
|
||||||
|
import info.nightscout.utils.DecimalFormatter;
|
||||||
import info.nightscout.utils.NumberPicker;
|
import info.nightscout.utils.NumberPicker;
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
import info.nightscout.utils.SafeParse;
|
import info.nightscout.utils.SafeParse;
|
||||||
|
@ -69,9 +69,9 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
private static final double FAV1_DEFAULT = 5;
|
private static final double FAV1_DEFAULT = 5;
|
||||||
private static final double FAV2_DEFAULT = 10;
|
private static final double FAV2_DEFAULT = 10;
|
||||||
private static final double FAV3_DEFAULT = 20;
|
private static final double FAV3_DEFAULT = 20;
|
||||||
|
|
||||||
private CheckBox suspendLoopCheckbox;
|
private CheckBox suspendLoopCheckbox;
|
||||||
private CheckBox startActivityTTCheckbox;
|
private CheckBox startActivityTTCheckbox;
|
||||||
|
private CheckBox startEatingSoonTTCheckbox;
|
||||||
|
|
||||||
private Integer maxCarbs;
|
private Integer maxCarbs;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
Integer carbs = SafeParse.stringToInt(editCarbs.getText());
|
Integer carbs = SafeParse.stringToInt(editCarbs.getText());
|
||||||
if (carbs > maxCarbs) {
|
if (carbs > maxCarbs) {
|
||||||
editCarbs.setValue(0d);
|
editCarbs.setValue(0d);
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), getString(R.string.carbsconstraintapplied));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.carbsconstraintapplied));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,6 +127,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||||
|
|
||||||
startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt);
|
startActivityTTCheckbox = view.findViewById(R.id.newcarbs_activity_tt);
|
||||||
|
startEatingSoonTTCheckbox = view.findViewById(R.id.carbs_eating_soon_tt);
|
||||||
|
|
||||||
dateButton = view.findViewById(R.id.newcarbs_eventdate);
|
dateButton = view.findViewById(R.id.newcarbs_eventdate);
|
||||||
timeButton = view.findViewById(R.id.newcarb_eventtime);
|
timeButton = view.findViewById(R.id.newcarb_eventtime);
|
||||||
|
@ -138,6 +139,10 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
dateButton.setOnClickListener(this);
|
dateButton.setOnClickListener(this);
|
||||||
timeButton.setOnClickListener(this);
|
timeButton.setOnClickListener(this);
|
||||||
|
|
||||||
|
//To be able to select only one TT at a time
|
||||||
|
startEatingSoonTTCheckbox.setOnClickListener(this);
|
||||||
|
startActivityTTCheckbox.setOnClickListener(this);
|
||||||
|
|
||||||
// TODO prefilling carbs, maybe
|
// TODO prefilling carbs, maybe
|
||||||
// TODO maybe update suggested carbs to target TT when checked
|
// TODO maybe update suggested carbs to target TT when checked
|
||||||
// APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
|
// APSResult lastAPSResult = ConfigBuilderPlugin.getActiveAPS().getLastAPSResult();
|
||||||
|
@ -147,13 +152,13 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
|
|
||||||
fav1Button = view.findViewById(R.id.newcarbs_plus1);
|
fav1Button = view.findViewById(R.id.newcarbs_plus1);
|
||||||
fav1Button.setOnClickListener(this);
|
fav1Button.setOnClickListener(this);
|
||||||
fav1Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_1), String.valueOf(FAV1_DEFAULT)));
|
fav1Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_1, String.valueOf(FAV1_DEFAULT)));
|
||||||
fav2Button = view.findViewById(R.id.newcarbs_plus2);
|
fav2Button = view.findViewById(R.id.newcarbs_plus2);
|
||||||
fav2Button.setOnClickListener(this);
|
fav2Button.setOnClickListener(this);
|
||||||
fav2Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_2), String.valueOf(FAV2_DEFAULT)));
|
fav2Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_2, String.valueOf(FAV2_DEFAULT)));
|
||||||
fav3Button = view.findViewById(R.id.newcarbs_plus3);
|
fav3Button = view.findViewById(R.id.newcarbs_plus3);
|
||||||
fav3Button.setOnClickListener(this);
|
fav3Button.setOnClickListener(this);
|
||||||
fav3Button.setText("+" + SP.getString(MainApp.gs(R.string.key_carbs_button_increment_3), String.valueOf(FAV3_DEFAULT)));
|
fav3Button.setText("+" + SP.getString(R.string.key_carbs_button_increment_3, String.valueOf(FAV3_DEFAULT)));
|
||||||
|
|
||||||
suspendLoopCheckbox = view.findViewById(R.id.newcarbs_suspend_loop);
|
suspendLoopCheckbox = view.findViewById(R.id.newcarbs_suspend_loop);
|
||||||
|
|
||||||
|
@ -197,19 +202,26 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
break;
|
break;
|
||||||
case R.id.newcarbs_plus1:
|
case R.id.newcarbs_plus1:
|
||||||
editCarbs.setValue(editCarbs.getValue()
|
editCarbs.setValue(editCarbs.getValue()
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_1), FAV1_DEFAULT));
|
+ SP.getDouble(R.string.key_carbs_button_increment_1, FAV1_DEFAULT));
|
||||||
validateInputs();
|
validateInputs();
|
||||||
break;
|
break;
|
||||||
case R.id.newcarbs_plus2:
|
case R.id.newcarbs_plus2:
|
||||||
editCarbs.setValue(editCarbs.getValue()
|
editCarbs.setValue(editCarbs.getValue()
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_2), FAV2_DEFAULT));
|
+ SP.getDouble(R.string.key_carbs_button_increment_2, FAV2_DEFAULT));
|
||||||
validateInputs();
|
validateInputs();
|
||||||
break;
|
break;
|
||||||
case R.id.newcarbs_plus3:
|
case R.id.newcarbs_plus3:
|
||||||
editCarbs.setValue(editCarbs.getValue()
|
editCarbs.setValue(editCarbs.getValue()
|
||||||
+ SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_3), FAV3_DEFAULT));
|
+ SP.getDouble(R.string.key_carbs_button_increment_3, FAV3_DEFAULT));
|
||||||
validateInputs();
|
validateInputs();
|
||||||
break;
|
break;
|
||||||
|
case R.id.newcarbs_activity_tt:
|
||||||
|
startEatingSoonTTCheckbox.setChecked(false);
|
||||||
|
break;
|
||||||
|
case R.id.carbs_eating_soon_tt:
|
||||||
|
startActivityTTCheckbox.setChecked(false);
|
||||||
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,20 +239,46 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
|
|
||||||
String confirmMessage = "";
|
String confirmMessage = "";
|
||||||
if (carbs > 0)
|
if (carbs > 0)
|
||||||
confirmMessage += getString(R.string.carbs) + ": " + "<font color='" + MainApp.sResources.getColor(R.color.colorCarbsButton) + "'>" + carbsAfterConstraints + "g" + "</font>";
|
confirmMessage += MainApp.gs(R.string.carbs) + ": " + "<font color='" + MainApp.gc(R.color.colorCarbsButton) + "'>" + carbsAfterConstraints + "g" + "</font>";
|
||||||
if (!carbsAfterConstraints.equals(carbs))
|
if (!carbsAfterConstraints.equals(carbs))
|
||||||
confirmMessage += "<br/><font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + getString(R.string.carbsconstraintapplied) + "</font>";
|
confirmMessage += "<br/><font color='" + MainApp.gc(R.color.low) + "'>" + MainApp.gs(R.string.carbsconstraintapplied) + "</font>";
|
||||||
if (suspendLoopCheckbox.isChecked()) {
|
if (suspendLoopCheckbox.isChecked()) {
|
||||||
confirmMessage += "<br/>" + "Loop: " + "<font color='" + MainApp.sResources.getColor(R.color.low) + "'>" + "Suspend for 30 min</font>";
|
confirmMessage += "<br/>" + MainApp.gs(R.string.loop) + ": " + "<font color='" + MainApp.gc(R.color.low) + "'>" + MainApp.gs(R.string.suspendloopfor30min) + "</font>";
|
||||||
}
|
}
|
||||||
|
|
||||||
double prefTTDuration = SP.getDouble(R.string.key_activity_duration, 90d);
|
final Profile currentProfile = MainApp.getConfigBuilder().getProfile();
|
||||||
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 90d;
|
if (currentProfile == null)
|
||||||
double prefTT = SP.getDouble(R.string.key_activity_target, 140d);
|
return;
|
||||||
double tt = prefTT > 0 ? prefTT : 140d;
|
|
||||||
|
int activityTTDuration = SP.getInt(R.string.key_activity_duration, Constants.defaultActivityTTDuration);
|
||||||
|
activityTTDuration = activityTTDuration > 0 ? activityTTDuration : Constants.defaultActivityTTDuration;
|
||||||
|
double activityTT = SP.getDouble(R.string.key_activity_target, currentProfile.getUnits().equals(Constants.MMOL) ? Constants.defaultActivityTTmmol : Constants.defaultActivityTTmgdl);
|
||||||
|
activityTT = activityTT > 0 ? activityTT : currentProfile.getUnits().equals(Constants.MMOL) ? Constants.defaultActivityTTmmol : Constants.defaultActivityTTmgdl;
|
||||||
|
|
||||||
|
int eatingSoonTTDuration = SP.getInt(R.string.key_eatingsoon_duration, Constants.defaultEatingSoonTTDuration);
|
||||||
|
eatingSoonTTDuration = eatingSoonTTDuration > 0 ? eatingSoonTTDuration : Constants.defaultEatingSoonTTDuration;
|
||||||
|
double eatingSoonTT = SP.getDouble(R.string.key_eatingsoon_target, currentProfile.getUnits().equals(Constants.MMOL) ? Constants.defaultEatingSoonTTmmol : Constants.defaultEatingSoonTTmgdl);
|
||||||
|
eatingSoonTT = eatingSoonTT > 0 ? Profile.toMgdl(eatingSoonTT, currentProfile.getUnits()) : currentProfile.getUnits().equals(Constants.MMOL) ? Constants.defaultEatingSoonTTmmol : Constants.defaultEatingSoonTTmgdl;
|
||||||
|
|
||||||
|
|
||||||
if (startActivityTTCheckbox.isChecked()) {
|
if (startActivityTTCheckbox.isChecked()) {
|
||||||
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + ((int) tt) + "mg/dl for " + ((int) ttDuration) + " min </font>";
|
if (currentProfile.getUnits().equals(Constants.MMOL)) {
|
||||||
|
confirmMessage += "<br/>" + MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(activityTT) + " mmol/l (" + ((int) activityTTDuration) + " min)</font>";
|
||||||
|
} else
|
||||||
|
confirmMessage += "<br/>" + MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(activityTT) + " mg/dl (" + ((int) activityTTDuration) + " min)</font>";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
if (startEatingSoonTTCheckbox.isChecked() && !startActivityTTCheckbox.isChecked()) {
|
||||||
|
if (currentProfile.getUnits().equals(Constants.MMOL)) {
|
||||||
|
confirmMessage += "<br/>" + MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to1Decimal(eatingSoonTT) + " mmol/l (" + eatingSoonTTDuration + " min)</font>";
|
||||||
|
} else
|
||||||
|
confirmMessage += "<br/>" + MainApp.gs(R.string.temptargetshort) + ": " + "<font color='" + MainApp.gc(R.color.high) + "'>" + DecimalFormatter.to0Decimal(eatingSoonTT) + " mg/dl (" + eatingSoonTTDuration + " min)</font>";
|
||||||
|
|
||||||
|
}
|
||||||
|
final double finalActivityTT = activityTT;
|
||||||
|
final double finalEatigSoonTT = eatingSoonTT;
|
||||||
|
final int finalActivityTTDuration = activityTTDuration;
|
||||||
|
final int finalEatingSoonTTDuration = eatingSoonTTDuration;
|
||||||
|
|
||||||
if (StringUtils.isNoneEmpty(food)) {
|
if (StringUtils.isNoneEmpty(food)) {
|
||||||
confirmMessage += "<br/>" + "Food: " + food;
|
confirmMessage += "<br/>" + "Food: " + food;
|
||||||
|
@ -249,17 +287,19 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
if (!initialEventTime.equals(eventTime)) {
|
if (!initialEventTime.equals(eventTime)) {
|
||||||
confirmMessage += "<br/> Time: " + DateUtil.dateAndTimeString(eventTime);
|
confirmMessage += "<br/> Time: " + DateUtil.dateAndTimeString(eventTime);
|
||||||
}
|
}
|
||||||
|
if (confirmMessage.length() > 0) {
|
||||||
|
|
||||||
final int finalCarbsAfterConstraints = carbsAfterConstraints;
|
final int finalCarbsAfterConstraints = carbsAfterConstraints;
|
||||||
|
|
||||||
final Context context = getContext();
|
final Context context = getContext();
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
|
|
||||||
builder.setTitle(this.getContext().getString(R.string.confirmation));
|
builder.setTitle(MainApp.gs(R.string.confirmation));
|
||||||
if (confirmMessage.startsWith("<br/>"))
|
if (confirmMessage.startsWith("<br/>"))
|
||||||
confirmMessage = confirmMessage.substring("<br/>".length());
|
confirmMessage = confirmMessage.substring("<br/>".length());
|
||||||
|
|
||||||
builder.setMessage(Html.fromHtml(confirmMessage));
|
builder.setMessage(Html.fromHtml(confirmMessage));
|
||||||
builder.setPositiveButton(getString(R.string.ok), (dialog, id) -> {
|
builder.setPositiveButton(MainApp.gs(R.string.ok), (dialog, id) -> {
|
||||||
synchronized (builder) {
|
synchronized (builder) {
|
||||||
if (accepted) {
|
if (accepted) {
|
||||||
log.debug("guarding: already accepted");
|
log.debug("guarding: already accepted");
|
||||||
|
@ -274,7 +314,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (!result.success) {
|
if (!result.success) {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.tempbasaldeliveryerror));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -283,11 +323,20 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
if (startActivityTTCheckbox.isChecked()) {
|
if (startActivityTTCheckbox.isChecked()) {
|
||||||
TempTarget tempTarget = new TempTarget();
|
TempTarget tempTarget = new TempTarget();
|
||||||
tempTarget.date = System.currentTimeMillis();
|
tempTarget.date = System.currentTimeMillis();
|
||||||
tempTarget.durationInMinutes = (int) ttDuration;
|
tempTarget.durationInMinutes = finalActivityTTDuration;
|
||||||
tempTarget.reason = "Activity";
|
tempTarget.reason = MainApp.gs(R.string.activity);
|
||||||
tempTarget.source = Source.USER;
|
tempTarget.source = Source.USER;
|
||||||
tempTarget.low = (int) tt;
|
tempTarget.low = Profile.toMgdl(finalActivityTT, currentProfile.getUnits());
|
||||||
tempTarget.high = (int) tt;
|
tempTarget.high = Profile.toMgdl(finalActivityTT, currentProfile.getUnits());
|
||||||
|
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
||||||
|
} else if (startEatingSoonTTCheckbox.isChecked()) {
|
||||||
|
TempTarget tempTarget = new TempTarget();
|
||||||
|
tempTarget.date = System.currentTimeMillis();
|
||||||
|
tempTarget.durationInMinutes = finalEatingSoonTTDuration;
|
||||||
|
tempTarget.reason = MainApp.gs(R.string.eatingsoon);
|
||||||
|
tempTarget.source = Source.USER;
|
||||||
|
tempTarget.low = Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits());
|
||||||
|
tempTarget.high = Profile.toMgdl(finalEatigSoonTT, currentProfile.getUnits());
|
||||||
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,12 +352,15 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setNegativeButton(getString(R.string.cancel), null);
|
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||||
builder.show();
|
builder.show();
|
||||||
dismiss();
|
dismiss();
|
||||||
|
} else
|
||||||
|
dismiss();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -246,7 +246,18 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
||||||
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 45d;
|
double ttDuration = prefTTDuration > 0 ? prefTTDuration : 45d;
|
||||||
double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d);
|
double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d);
|
||||||
double tt = prefTT > 0 ? prefTT : 80d;
|
double tt = prefTT > 0 ? prefTT : 80d;
|
||||||
|
Profile currentProfile = MainApp.getConfigBuilder().getProfile();
|
||||||
|
if(currentProfile == null)
|
||||||
|
return;
|
||||||
|
if(currentProfile.getUnits().equals(Constants.MMOL))
|
||||||
|
tt = prefTT > 0 ? Profile.toMgdl(prefTT, Constants.MMOL) : 80d;
|
||||||
|
else
|
||||||
|
tt = prefTT > 0 ? prefTT : 80d;
|
||||||
|
final double finalTT = tt;
|
||||||
if (startESMCheckbox.isChecked()) {
|
if (startESMCheckbox.isChecked()) {
|
||||||
|
if(currentProfile.getUnits().equals("mmol")){
|
||||||
|
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + Profile.toMmol(tt, Constants.MGDL) + " mmol for " + ((int) ttDuration) + " min </font>";
|
||||||
|
} else
|
||||||
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + ((int) tt) + "mg/dl for " + ((int) ttDuration) + " min </font>";
|
confirmMessage += "<br/>" + "TT: " + "<font color='" + MainApp.sResources.getColor(R.color.high) + "'>" + ((int) tt) + "mg/dl for " + ((int) ttDuration) + " min </font>";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,8 +288,8 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener,
|
||||||
tempTarget.durationInMinutes = (int) ttDuration;
|
tempTarget.durationInMinutes = (int) ttDuration;
|
||||||
tempTarget.reason = "Eating soon";
|
tempTarget.reason = "Eating soon";
|
||||||
tempTarget.source = Source.USER;
|
tempTarget.source = Source.USER;
|
||||||
tempTarget.low = (int) tt;
|
tempTarget.low = (int) finalTT;
|
||||||
tempTarget.high = (int) tt;
|
tempTarget.high = (int) finalTT;
|
||||||
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
MainApp.getDbHelper().createOrUpdate(tempTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,20 +37,27 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:text="Start activity TT" />
|
android:text="@string/start_activity_tt" />
|
||||||
|
|
||||||
|
<CheckBox
|
||||||
|
android:id="@+id/carbs_eating_soon_tt"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:text="@string/start_eating_soon_tt" />
|
||||||
|
|
||||||
<CheckBox
|
<CheckBox
|
||||||
android:id="@+id/newcarbs_suspend_loop"
|
android:id="@+id/newcarbs_suspend_loop"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_marginBottom="5dp"
|
android:layout_marginBottom="5dp"
|
||||||
android:text="Suspend loop for 30 min" />
|
android:text="@string/suspendloopfor30min" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:padding="5dp"
|
android:layout_gravity="center_horizontal"
|
||||||
android:layout_gravity="center_horizontal">
|
android:padding="5dp">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/newcarbs_eventdate"
|
android:id="@+id/newcarbs_eventdate"
|
||||||
|
@ -91,8 +98,8 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="horizontal"
|
android:layout_marginBottom="5dp"
|
||||||
android:layout_marginBottom="5dp">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/newcarbs_plus1"
|
android:id="@+id/newcarbs_plus1"
|
||||||
|
|
|
@ -971,5 +971,9 @@
|
||||||
<string name="fabric_upload">Fabric Upload</string>
|
<string name="fabric_upload">Fabric Upload</string>
|
||||||
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</string>
|
<string name="allow_automated_crash_reporting">Allow automated crash reporting and feature usage data to be sent to the developers via the fabric.io service.</string>
|
||||||
<string name="g5appnotdetected">Please update your G5 app to supported version</string>
|
<string name="g5appnotdetected">Please update your G5 app to supported version</string>
|
||||||
|
<string name="suspendloopfor30min">Suspend for 30 min</string>
|
||||||
|
<string name="start_activity_tt">Start Activity TT</string>
|
||||||
|
<string name="start_eating_soon_tt">Start Eating soon TT</string>
|
||||||
|
<string name="temptargetshort">TT</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue