From 49a836eda9d297c49c56d988366284e7c71286e3 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Wed, 18 Apr 2018 15:51:29 +0200 Subject: [PATCH] NewNSTreatmentDialog: add Hypo TT preset. --- .../Careportal/Dialogs/NewNSTreatmentDialog.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java index 5a57b62869..68d844739b 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Careportal/Dialogs/NewNSTreatmentDialog.java @@ -21,6 +21,7 @@ import android.widget.Spinner; import android.widget.TextView; import com.crashlytics.android.answers.CustomEvent; +import com.google.common.collect.Lists; import com.wdullaer.materialdatetimepicker.date.DatePickerDialog; import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout; import com.wdullaer.materialdatetimepicker.time.TimePickerDialog; @@ -191,11 +192,12 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick final Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units); // temp target - final ArrayList reasonList = new ArrayList<>(); - reasonList.add(MainApp.gs(R.string.manual)); - reasonList.add(MainApp.gs(R.string.eatingsoon)); - reasonList.add(MainApp.gs(R.string.activity)); - ArrayAdapter adapterReason = new ArrayAdapter<>(getContext(), + final List reasonList = Lists.newArrayList( + MainApp.gs(R.string.manual), + MainApp.gs(R.string.eatingsoon), + MainApp.gs(R.string.activity), + MainApp.gs(R.string.hypo)); + ArrayAdapter adapterReason = new ArrayAdapter<>(getContext(), R.layout.spinner_centered, reasonList); reasonSpinner.setAdapter(adapterReason); reasonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -214,6 +216,9 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick } else if (MainApp.gs(R.string.activity).equals(reasonList.get(position))) { defaultDuration = SP.getDouble(R.string.key_activity_duration, 0d); defaultTarget = SP.getDouble(R.string.key_activity_target, 0d); + } else if (MainApp.gs(R.string.hypo).equals(reasonList.get(position))) { + defaultDuration = SP.getDouble(R.string.key_hypo_duration, 0d); + defaultTarget = SP.getDouble(R.string.key_hypo_target, 0d); } else { defaultDuration = 0; erase = true;