Changes requested after review.

- added additional parameter for extended_note
- changed how extended_note is set
- created positional formatting
This commit is contained in:
Andy Rozman 2018-08-01 16:19:57 +01:00
parent bf34a3b41f
commit 5d4dc7ea61
3 changed files with 9 additions and 6 deletions

View file

@ -4,6 +4,8 @@ package info.nightscout.androidaps.plugins.PumpCommon.defs;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.plugins.PumpCommon.data.DoseSettings; 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 ? "%" : ""; String unit = getPumpTempBasalType()==PumpTempBasalType.Percent ? "%" : "";
DoseSettings eb = getExtendedBolusSettings(); DoseSettings eb = getExtendedBolusSettings();
DoseSettings tbr = getTbrSettings(); DoseSettings tbr = getTbrSettings();
String extendedNote = hasExtendedBasals ? MainApp.gs(R.string.virtualpump_pump_def_extended_note) : "";
return String.format(i18nTemplate, // return String.format(i18nTemplate, //
getStep("" + getBolusSize(), getSpecialBolusSize()), // getStep("" + getBolusSize(), getSpecialBolusSize()), //
eb.getStep(), eb.getDurationStep(), eb.getMaxDuration()/60, // eb.getStep(), eb.getDurationStep(), eb.getMaxDuration()/60, //
getStep(getBaseBasalRange(), getBaseBasalSpecialSteps()), // 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);
} }

View file

@ -113,10 +113,8 @@ public class VirtualPumpFragment extends SubscriberFragment {
String template = MainApp.gs(R.string.virtualpump_pump_def); 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()));
} }
}); });

View file

@ -1087,7 +1087,7 @@
<string name="value_unavailable_short">n/a</string> <string name="value_unavailable_short">n/a</string>
<string name="virtualpump_type">Virtual Pump Type</string> <string name="virtualpump_type">Virtual Pump Type</string>
<string name="virtualpump_definition">Pump Definition</string> <string name="virtualpump_definition">Pump Definition</string>
<string name="virtualpump_pump_def" formated="false">Bolus: Step=%s\nExtended Bolus: [Step=%s, Duration=%smin-%sh]\nBasal: Step=%s\nTBR: %s (by %s), Duration=%smin-%sh\nEXTENDED_NOTE</string> <string name="virtualpump_pump_def" formated="false">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</string>
<string name="virtualpump_pump_def_extended_note">* Ranged basal/bolus values are not supported by Virtual Pump.</string> <string name="virtualpump_pump_def_extended_note">* Ranged basal/bolus values are not supported by Virtual Pump.</string>
<string name="ns_autobackfill_title">Autobackfill BG</string> <string name="ns_autobackfill_title">Autobackfill BG</string>
<string name="ga_lang" translatable="false">Irish</string> <string name="ga_lang" translatable="false">Irish</string>