From 5d4dc7ea6107dbe9ad7d63e70a957973710b5b01 Mon Sep 17 00:00:00 2001 From: Andy Rozman Date: Wed, 1 Aug 2018 16:19:57 +0100 Subject: [PATCH] Changes requested after review. - added additional parameter for extended_note - changed how extended_note is set - created positional formatting --- .../androidaps/plugins/PumpCommon/defs/PumpType.java | 9 +++++++-- .../plugins/PumpVirtual/VirtualPumpFragment.java | 4 +--- app/src/main/res/values/strings.xml | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCommon/defs/PumpType.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCommon/defs/PumpType.java index f22c07fa8a..55a7ee98f4 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpCommon/defs/PumpType.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpCommon/defs/PumpType.java @@ -4,6 +4,8 @@ package info.nightscout.androidaps.plugins.PumpCommon.defs; import java.util.HashMap; import java.util.Map; +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; import info.nightscout.androidaps.plugins.PumpCommon.data.DoseSettings; @@ -273,18 +275,21 @@ public enum PumpType { } - public String getFullDescription(String i18nTemplate) { + public String getFullDescription(String i18nTemplate, boolean hasExtendedBasals) { String unit = getPumpTempBasalType()==PumpTempBasalType.Percent ? "%" : ""; DoseSettings eb = getExtendedBolusSettings(); DoseSettings tbr = getTbrSettings(); + String extendedNote = hasExtendedBasals ? MainApp.gs(R.string.virtualpump_pump_def_extended_note) : ""; + return String.format(i18nTemplate, // getStep("" + getBolusSize(), getSpecialBolusSize()), // eb.getStep(), eb.getDurationStep(), eb.getMaxDuration()/60, // getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), // - tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit, tbr.getDurationStep(), tbr.getMaxDuration()/60); + tbr.getMinDose() + unit + "-" + tbr.getMaxDose() + unit, tbr.getStep() + unit, + tbr.getDurationStep(), tbr.getMaxDuration()/60, extendedNote); } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java index f01fb0f379..ef4c85e0a7 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/PumpVirtual/VirtualPumpFragment.java @@ -113,10 +113,8 @@ public class VirtualPumpFragment extends SubscriberFragment { String template = MainApp.gs(R.string.virtualpump_pump_def); - template = template.replace("EXTENDED_NOTE", pumpType.hasExtendedBasals() ? // - MainApp.gs(R.string.virtualpump_pump_def_extended_note) : ""); - pumpSettingsView.setText(pumpType.getFullDescription(template)); + pumpSettingsView.setText(pumpType.getFullDescription(template, pumpType.hasExtendedBasals())); } }); diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b26344179f..93ef50cd36 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1087,7 +1087,7 @@ n/a Virtual Pump Type Pump Definition - Bolus: Step=%s\nExtended Bolus: [Step=%s, Duration=%smin-%sh]\nBasal: Step=%s\nTBR: %s (by %s), Duration=%smin-%sh\nEXTENDED_NOTE + Bolus: Step=%1$s\nExtended Bolus: [Step=%2$s, Duration=%3$smin-%4$sh]\nBasal: Step=%5$s\nTBR: %6$s (by %7$s), Duration=%8$smin-%9$sh\n%10$s * Ranged basal/bolus values are not supported by Virtual Pump. Autobackfill BG Irish