From 27cf03f39ac17bf4f2c8626ed81d454bddaa768e Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Tue, 7 Aug 2018 18:50:09 +0200 Subject: [PATCH] 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. --- .../plugins/Overview/OverviewFragment.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 084935c6c1..d393b6f5ab 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -592,8 +592,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, .duration(defHelper.determineEatingSoonTTDuration()) .reason(MainApp.gs(R.string.eatingsoon)) .source(Source.USER) - .low(target) - .high(target); + .low(Profile.toMgdl(target, profile.getUnits())) + .high(Profile.toMgdl(target, profile.getUnits())); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); } else if (item.getTitle().equals(MainApp.gs(R.string.activity))) { DefaultValueHelper defHelper = new DefaultValueHelper(); @@ -603,8 +603,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, .duration(defHelper.determineActivityTTDuration()) .reason(MainApp.gs(R.string.activity)) .source(Source.USER) - .low(target) - .high(target); + .low(Profile.toMgdl(target, profile.getUnits())) + .high(Profile.toMgdl(target, profile.getUnits())); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); } else if (item.getTitle().equals(MainApp.gs(R.string.hypo))) { DefaultValueHelper defHelper = new DefaultValueHelper(); @@ -612,10 +612,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener, TempTarget tempTarget = new TempTarget() .date(now()) .duration(defHelper.determineHypoTTDuration()) - .reason(MainApp.gs(R.string.activity)) + .reason(MainApp.gs(R.string.hypo)) .source(Source.USER) - .low(target) - .high(target); + .low(Profile.toMgdl(target, profile.getUnits())) + .high(Profile.toMgdl(target, profile.getUnits())); TreatmentsPlugin.getPlugin().addToHistoryTempTarget(tempTarget); } else if (item.getTitle().equals(MainApp.gs(R.string.custom))) { NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();