From f5ecb9811e2f1a7d0475dbb5c14ee045820fdd11 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sun, 1 Jul 2018 16:56:07 +0200 Subject: [PATCH] fix #1173,newcarbsdialog: activate hypo tt if bg < 72mgdl/4mmol/l. --- .../plugins/Overview/Dialogs/NewCarbsDialog.java | 9 +++++++++ 1 file changed, 9 insertions(+) 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 0324bed601..0e7390c303 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 @@ -33,7 +33,9 @@ import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.data.Profile; +import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.db.CareportalEvent; +import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.interfaces.Constraint; @@ -154,6 +156,13 @@ public class NewCarbsDialog extends DialogFragment implements OnClickListener, C notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE); notesEdit = view.findViewById(R.id.newcarbs_notes); + BgReading bgReading = DatabaseHelper.actualBg(); + if (bgReading != null && bgReading.value < 72) { + startHypoTTCheckbox.setOnCheckedChangeListener(null); + startHypoTTCheckbox.setChecked(true); + startHypoTTCheckbox.setOnClickListener(this); + } + setCancelable(true); getDialog().setCanceledOnTouchOutside(false); return view;