Context TT menu fixes.

Default values where previously correctly converted for mmol/l,
but user-defined settings in the prefs (in mmol/l) where not.
This works for default settings and user-defined preference
for both mg/dl as well as mmol/l.
This commit is contained in:
Johannes Mockenhaupt 2018-08-07 18:50:09 +02:00
parent 1c7777e5eb
commit 27cf03f39a
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1

View file

@ -592,8 +592,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
.duration(defHelper.determineEatingSoonTTDuration()) .duration(defHelper.determineEatingSoonTTDuration())
.reason(MainApp.gs(R.string.eatingsoon)) .reason(MainApp.gs(R.string.eatingsoon))
.source(Source.USER) .source(Source.USER)
.low(target) .low(Profile.toMgdl(target, profile.getUnits()))
.high(target); .high(Profile.toMgdl(target, profile.getUnits()));
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.activity))) { } else if (item.getTitle().equals(MainApp.gs(R.string.activity))) {
DefaultValueHelper defHelper = new DefaultValueHelper(); DefaultValueHelper defHelper = new DefaultValueHelper();
@ -603,8 +603,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
.duration(defHelper.determineActivityTTDuration()) .duration(defHelper.determineActivityTTDuration())
.reason(MainApp.gs(R.string.activity)) .reason(MainApp.gs(R.string.activity))
.source(Source.USER) .source(Source.USER)
.low(target) .low(Profile.toMgdl(target, profile.getUnits()))
.high(target); .high(Profile.toMgdl(target, profile.getUnits()));
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) { } else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) {
DefaultValueHelper defHelper = new DefaultValueHelper(); DefaultValueHelper defHelper = new DefaultValueHelper();
@ -612,10 +612,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(now()) .date(now())
.duration(defHelper.determineHypoTTDuration()) .duration(defHelper.determineHypoTTDuration())
.reason(MainApp.gs(R.string.activity)) .reason(MainApp.gs(R.string.hypo))
.source(Source.USER) .source(Source.USER)
.low(target) .low(Profile.toMgdl(target, profile.getUnits()))
.high(target); .high(Profile.toMgdl(target, profile.getUnits()));
TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget);
} else if (item.getTitle().equals(MainApp.gs(R.string.custom))) { } else if (item.getTitle().equals(MainApp.gs(R.string.custom))) {
NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog(); NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();