From 39dc914c2c5fc0edc57acccd87529c0a589edf1c Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 24 Jul 2018 12:48:50 +0200 Subject: [PATCH] NewCarbsDialog: correct situation where Hypo TT can't be unchecked. --- .../androidaps/plugins/Overview/Dialogs/NewCarbsDialog.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 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 912580352c..b51270938d 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 @@ -157,10 +157,12 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C BgReading bgReading = DatabaseHelper.actualBg(); if (bgReading != null && bgReading.value < 72) { - startHypoTTCheckbox.setOnCheckedChangeListener(null); startHypoTTCheckbox.setChecked(true); + // see #onCheckedChanged why listeners are registered like this + startHypoTTCheckbox.setOnClickListener(this); + } else { + startHypoTTCheckbox.setOnCheckedChangeListener(this); } - startHypoTTCheckbox.setOnCheckedChangeListener(this); setCancelable(true); getDialog().setCanceledOnTouchOutside(false);