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 8f641f994f
commit f5ecb9811e
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -33,7 +33,9 @@ import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R; import info.nightscout.androidaps.R;
import info.nightscout.androidaps.data.Profile; import info.nightscout.androidaps.data.Profile;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.CareportalEvent; import info.nightscout.androidaps.db.CareportalEvent;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.Source; import info.nightscout.androidaps.db.Source;
import info.nightscout.androidaps.db.TempTarget; import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.Constraint; 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); notesLayout.setVisibility(SP.getBoolean(R.string.key_show_notes_entry_dialogs, false) ? View.VISIBLE : View.GONE);
notesEdit = view.findViewById(R.id.newcarbs_notes); 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); setCancelable(true);
getDialog().setCanceledOnTouchOutside(false); getDialog().setCanceledOnTouchOutside(false);
return view; return view;