From c6a46129df7b98fb5da7f1b8e348c8528cd655c3 Mon Sep 17 00:00:00 2001 From: PoweRGbg Date: Thu, 1 Mar 2018 18:38:56 +0200 Subject: [PATCH] format using the Profile class method and Constants --- .../plugins/Overview/Dialogs/NewCarbsDialog.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) 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 1d028bf051..1508b003f5 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,23 +248,23 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D Profile currentProfile = MainApp.getConfigBuilder().getProfile(); if(currentProfile.equals(null)) return; - if(currentProfile.getUnits().equals("mmol")) { - esTT = eatingSoonTT > 0 ? eatingSoonTT*18 : 90d; - tt = prefTT > 0 ? prefTT*18 : 140d; + if(currentProfile.getUnits().equals(Constants.MMOL)) { + esTT = eatingSoonTT > 0 ? eatingSoonTT*Constants.MMOLL_TO_MGDL : 90d; + tt = prefTT > 0 ? prefTT*Constants.MMOLL_TO_MGDL : 140d; } else esTT = eatingSoonTT > 0 ? eatingSoonTT : 90d; tt = prefTT > 0 ? prefTT : 140d; if (startActivityTTCheckbox.isChecked() ||(startActivityTTCheckbox.isChecked() && ESMCheckbox.isChecked()) ) { - if(currentProfile.getUnits().equals("mmol")) { - confirmMessage += "
" + "TT: " + "" + tt/18 + " mmol/l for " + ((int) ttDuration) + " min "; + if(currentProfile.getUnits().equals(Constants.MMOL)) { + confirmMessage += "
" + "TT: " + "" + Profile.toMmol(tt,Constants.MGDL) + " mmol/l for " + ((int) ttDuration) + " min "; } else confirmMessage += "
" + "TT: " + "" + ((int) tt) + " mg/dl for " + ((int) ttDuration) + " min "; }else if (ESMCheckbox.isChecked()) { - if(currentProfile.getUnits().equals("mmol")) { - confirmMessage += "
" + "TT: " + "" + esTT/18 + " mmol/l for " + ((int) esDuration) + " min "; + if(currentProfile.getUnits().equals(Constants.MMOL)) { + confirmMessage += "
" + "TT: " + "" + Profile.toMmol(esTT,Constants.MGDL) + " mmol/l for " + ((int) esDuration) + " min "; } else confirmMessage += "
" + "TT: " + "" + ((int) esTT) + " mg/dl for " + ((int) esDuration) + " min ";