fix #1173,newcarbsdialog: activate hypo tt if bg < 72mgdl/4mmol/l.

This commit is contained in:
Johannes Mockenhaupt 2018-07-01 16:56:07 +02:00
parent 86ef6a155c
commit 780a4dda36
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -32,7 +32,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;
@ -153,6 +155,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;