Merge pull request #1253 from jotomo/hypo-tt-correction

NewCarbsDialog: correct situation where Hypo TT can't be unchecked.
This commit is contained in:
Milos Kozak 2018-07-25 10:30:19 +02:00 committed by GitHub
commit 088c423208
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -157,10 +157,12 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C
BgReading bgReading = DatabaseHelper.actualBg(); BgReading bgReading = DatabaseHelper.actualBg();
if (bgReading != null && bgReading.value < 72) { if (bgReading != null && bgReading.value < 72) {
startHypoTTCheckbox.setOnCheckedChangeListener(null);
startHypoTTCheckbox.setChecked(true); startHypoTTCheckbox.setChecked(true);
// see #onCheckedChanged why listeners are registered like this
startHypoTTCheckbox.setOnClickListener(this);
} else {
startHypoTTCheckbox.setOnCheckedChangeListener(this);
} }
startHypoTTCheckbox.setOnCheckedChangeListener(this);
setCancelable(true); setCancelable(true);
getDialog().setCanceledOnTouchOutside(false); getDialog().setCanceledOnTouchOutside(false);