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 1508b003f5..45b73762c5 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 @@ -18,6 +18,7 @@ import android.view.WindowManager; import android.widget.Button; import android.widget.CheckBox; import android.widget.EditText; +import android.widget.RadioButton; import android.widget.TextView; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; @@ -71,8 +72,8 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D private static final double FAV2_DEFAULT = 10; private static final double FAV3_DEFAULT = 20; private CheckBox suspendLoopCheckbox; - private CheckBox startActivityTTCheckbox; - private CheckBox ESMCheckbox; + private RadioButton startActivityTTCheckbox; + private RadioButton ESMCheckbox; private Integer maxCarbs; @@ -212,6 +213,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D + SP.getDouble(MainApp.gs(R.string.key_carbs_button_increment_3), FAV3_DEFAULT)); validateInputs(); break; + } } @@ -246,7 +248,7 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D double tt = 140d; double esTT = 90d; Profile currentProfile = MainApp.getConfigBuilder().getProfile(); - if(currentProfile.equals(null)) + if(currentProfile == null) return; if(currentProfile.getUnits().equals(Constants.MMOL)) { esTT = eatingSoonTT > 0 ? eatingSoonTT*Constants.MMOLL_TO_MGDL : 90d; @@ -257,12 +259,15 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, D if (startActivityTTCheckbox.isChecked() ||(startActivityTTCheckbox.isChecked() && ESMCheckbox.isChecked()) ) { + ESMCheckbox.setChecked(true); 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 (ESMCheckbox.isChecked()) { + startActivityTTCheckbox.setChecked(true); if(currentProfile.getUnits().equals(Constants.MMOL)) { confirmMessage += "
" + "TT: " + "" + Profile.toMmol(esTT,Constants.MGDL) + " mmol/l for " + ((int) esDuration) + " min "; } else diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java index d9f9dcebfa..356c3a9b3d 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/NewInsulinDialog.java @@ -247,12 +247,12 @@ public class NewInsulinDialog extends DialogFragment implements OnClickListener, double prefTT = SP.getDouble(R.string.key_eatingsoon_target, 80d); double tt = prefTT > 0 ? prefTT : 80d; Profile currentProfile = MainApp.getConfigBuilder().getProfile(); - if(currentProfile.equals(null)) + if(currentProfile == null) return; - if(currentProfile.getUnits().equals(Constants.MMOL)) { + if(currentProfile.getUnits().equals(Constants.MMOL)) tt = prefTT > 0 ? Profile.toMgdl(prefTT, Constants.MGDL) : 80d; - } else - tt = prefTT > 0 ? prefTT : 80d; + else + tt = prefTT > 0 ? prefTT : 80d; final double finalTT = tt; if (startESMCheckbox.isChecked()) { if(currentProfile.getUnits().equals("mmol")){