Merge pull request #1316 from jotomo/fixingthefix

TT context menu fixes
This commit is contained in:
Milos Kozak 2018-08-07 19:46:46 +02:00 committed by GitHub
commit 9dde50f93f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -586,36 +586,36 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
pvd.show(manager, "ProfileViewDialog"); pvd.show(manager, "ProfileViewDialog");
} else if (item.getTitle().equals(MainApp.gs(R.string.eatingsoon))) { } else if (item.getTitle().equals(MainApp.gs(R.string.eatingsoon))) {
DefaultValueHelper defHelper = new DefaultValueHelper(); DefaultValueHelper defHelper = new DefaultValueHelper();
double target = defHelper.determineEatingSoonTT(Constants.MGDL); double target = defHelper.determineEatingSoonTT(profile.getUnits());
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(System.currentTimeMillis()) .date(System.currentTimeMillis())
.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();
double target = defHelper.determineActivityTT(Constants.MGDL); double target = defHelper.determineActivityTT(profile.getUnits());
TempTarget tempTarget = new TempTarget() TempTarget tempTarget = new TempTarget()
.date(now()) .date(now())
.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();
double target = defHelper.determineHypoTT(Constants.MGDL); double target = defHelper.determineHypoTT(profile.getUnits());
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();