diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java index d6254fd443..ab0cd8dde0 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java @@ -248,41 +248,41 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D confirmMessage += "
" + "Loop: " + "" + "Suspend for 30 min"; } - double prefTTDuration = SP.getDouble(R.string.key_activity_duration, 90d); + double activityTTDurationSettings = SP.getDouble(R.string.key_activity_duration, 90d); double eatingSoonTTDuration = SP.getDouble(R.string.key_eatingsoon_duration, 45d); double eatingSoonTT = SP.getDouble(R.string.key_eatingsoon_target, 90d); - double ttDuration = prefTTDuration > 0 ? prefTTDuration : 90d; - final double esDuration = eatingSoonTTDuration > 0 ? eatingSoonTTDuration : 45d; + double activityTTDuration = activityTTDurationSettings > 0 ? activityTTDurationSettings : 90d; + final double esTTDuration = eatingSoonTTDuration > 0 ? eatingSoonTTDuration : 45d; double prefTT = SP.getDouble(R.string.key_activity_target, 140d); - double tt = 140d; + double activityTT = 140d; double esTT = 90d; Profile currentProfile = MainApp.getConfigBuilder().getProfile(); if(currentProfile == null) return; if(currentProfile.getUnits().equals(Constants.MMOL)) { esTT = eatingSoonTT > 0 ? Profile.toMgdl(eatingSoonTT,Constants.MGDL) : 90d; - tt = prefTT > 0 ? Profile.toMgdl(prefTT,Constants.MGDL) : 140d; + activityTT = prefTT > 0 ? Profile.toMgdl(prefTT,Constants.MGDL) : 140d; } else { esTT = eatingSoonTT > 0 ? eatingSoonTT : 90d; - tt = prefTT > 0 ? prefTT : 140d; + activityTT = prefTT > 0 ? prefTT : 140d; } if (startActivityTTCheckbox.isChecked()) { if(currentProfile.getUnits().equals(Constants.MMOL)) { - confirmMessage += "
" + "TT: " + "" + Profile.toMmol(tt,Constants.MGDL) + " mmol/l for " + ((int) ttDuration) + " min "; + confirmMessage += "
" + "TT: " + "" + Profile.toMmol(activityTT,Constants.MGDL) + " mmol/l for " + ((int) activityTTDuration) + " min "; } else - confirmMessage += "
" + "TT: " + "" + ((int) tt) + " mg/dl for " + ((int) ttDuration) + " min "; + confirmMessage += "
" + "TT: " + "" + ((int) activityTT) + " mg/dl for " + ((int) activityTTDuration) + " min "; } if (startEsTTCheckbox.isChecked() && !startActivityTTCheckbox.isChecked()) { if(currentProfile.getUnits().equals(Constants.MMOL)) { - confirmMessage += "
" + "TT: " + "" + Profile.toMmol(esTT,Constants.MGDL) + " mmol/l for " + ((int) esDuration) + " min "; + confirmMessage += "
" + "TT: " + "" + Profile.toMmol(esTT,Constants.MGDL) + " mmol/l for " + ((int) esTTDuration) + " min "; } else - confirmMessage += "
" + "TT: " + "" + ((int) esTT) + " mg/dl for " + ((int) esDuration) + " min "; + confirmMessage += "
" + "TT: " + "" + ((int) esTT) + " mg/dl for " + ((int) esTTDuration) + " min "; } - final double finalTT = tt; + final double finalTT = activityTT; final double finalEsTT = esTT; if (StringUtils.isNoneEmpty(food)) { confirmMessage += "
" + "Food: " + food; @@ -327,7 +327,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D if (startActivityTTCheckbox.isChecked() || (startActivityTTCheckbox.isChecked() && startEsTTCheckbox.isChecked())) { TempTarget tempTarget = new TempTarget(); tempTarget.date = System.currentTimeMillis(); - tempTarget.durationInMinutes = (int) ttDuration; + tempTarget.durationInMinutes = (int) activityTTDuration; tempTarget.reason = "Activity"; tempTarget.source = Source.USER; tempTarget.low = (double) finalTT; @@ -336,7 +336,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D } else if (startEsTTCheckbox.isChecked()) { TempTarget tempTarget = new TempTarget(); tempTarget.date = System.currentTimeMillis(); - tempTarget.durationInMinutes = (int) esDuration; + tempTarget.durationInMinutes = (int) esTTDuration; tempTarget.reason = "Eating soon"; tempTarget.source = Source.USER; tempTarget.low = (double) finalEsTT;