NewNSTreatmentDialog: add Hypo TT preset.
This commit is contained in:
parent
3d5203b56f
commit
49a836eda9
|
@ -21,6 +21,7 @@ import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import com.crashlytics.android.answers.CustomEvent;
|
import com.crashlytics.android.answers.CustomEvent;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||||
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
||||||
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
|
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);
|
final Double bg = Profile.fromMgdlToUnits(GlucoseStatus.getGlucoseStatusData() != null ? GlucoseStatus.getGlucoseStatusData().glucose : 0d, units);
|
||||||
|
|
||||||
// temp target
|
// temp target
|
||||||
final ArrayList<CharSequence> reasonList = new ArrayList<>();
|
final List<String> reasonList = Lists.newArrayList(
|
||||||
reasonList.add(MainApp.gs(R.string.manual));
|
MainApp.gs(R.string.manual),
|
||||||
reasonList.add(MainApp.gs(R.string.eatingsoon));
|
MainApp.gs(R.string.eatingsoon),
|
||||||
reasonList.add(MainApp.gs(R.string.activity));
|
MainApp.gs(R.string.activity),
|
||||||
ArrayAdapter<CharSequence> adapterReason = new ArrayAdapter<>(getContext(),
|
MainApp.gs(R.string.hypo));
|
||||||
|
ArrayAdapter<String> adapterReason = new ArrayAdapter<>(getContext(),
|
||||||
R.layout.spinner_centered, reasonList);
|
R.layout.spinner_centered, reasonList);
|
||||||
reasonSpinner.setAdapter(adapterReason);
|
reasonSpinner.setAdapter(adapterReason);
|
||||||
reasonSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
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))) {
|
} else if (MainApp.gs(R.string.activity).equals(reasonList.get(position))) {
|
||||||
defaultDuration = SP.getDouble(R.string.key_activity_duration, 0d);
|
defaultDuration = SP.getDouble(R.string.key_activity_duration, 0d);
|
||||||
defaultTarget = SP.getDouble(R.string.key_activity_target, 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 {
|
} else {
|
||||||
defaultDuration = 0;
|
defaultDuration = 0;
|
||||||
erase = true;
|
erase = true;
|
||||||
|
|
Loading…
Reference in a new issue