SMB: clean up APSResult.toSpanned a bit.
(cherry picked from commit 10d7c79)
This commit is contained in:
parent
b4d13c727e
commit
0655e4e676
|
@ -42,14 +42,24 @@ public class APSResult {
|
|||
public String toString() {
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
if (changeRequested) {
|
||||
String ret;
|
||||
// rate
|
||||
if (rate == 0 && duration == 0)
|
||||
return MainApp.sResources.getString(R.string.canceltemp);
|
||||
ret = MainApp.sResources.getString(R.string.canceltemp) + "\n";
|
||||
else if (rate == -1)
|
||||
ret = MainApp.sResources.getString(R.string.let_tbr_run) + "\n";
|
||||
else
|
||||
return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%)\n" +
|
||||
MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to0Decimal(duration) + " min\n" +
|
||||
(smb != 0 ? ("SMB: " + DecimalFormatter.to2Decimal(smb) + " U\n") : "") +
|
||||
MainApp.sResources.getString(R.string.reason) + ": " + reason;
|
||||
ret = MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) \n" +
|
||||
MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to2Decimal(duration) + " min\n";
|
||||
|
||||
// smb
|
||||
if (smb != 0)
|
||||
ret += ("SMB: " + DecimalFormatter.to2Decimal(smb) + " U\n");
|
||||
|
||||
// reason
|
||||
ret += MainApp.sResources.getString(R.string.reason) + ": " + reason;
|
||||
return ret;
|
||||
} else
|
||||
return MainApp.sResources.getString(R.string.nochangerequested);
|
||||
}
|
||||
|
@ -57,14 +67,23 @@ public class APSResult {
|
|||
public Spanned toSpanned() {
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
if (changeRequested) {
|
||||
String ret = "";
|
||||
if (rate == 0 && duration == 0) ret = MainApp.sResources.getString(R.string.canceltemp);
|
||||
String ret;
|
||||
// rate
|
||||
if (rate == 0 && duration == 0)
|
||||
ret = MainApp.sResources.getString(R.string.canceltemp) + "<br>";
|
||||
else if (rate == -1)
|
||||
ret = MainApp.sResources.getString(R.string.let_tbr_run) + "<br>";
|
||||
else
|
||||
ret = "<b>" + MainApp.sResources.getString(R.string.rate) + "</b>: " + DecimalFormatter.to2Decimal(rate) + " U/h " +
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" +
|
||||
"<b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>" +
|
||||
(smb != 0 ? ("<b>" + "SMB" + "</b>: " + DecimalFormatter.to2Decimal(smb) + " U<br>") : "") +
|
||||
"<b>" + MainApp.sResources.getString(R.string.reason) + "</b>: " + reason.replace("<", "<").replace(">", ">");
|
||||
"(" + DecimalFormatter.to2Decimal(rate / pump.getBaseBasalRate() * 100) + "%) <br>" +
|
||||
"<b>" + MainApp.sResources.getString(R.string.duration) + "</b>: " + DecimalFormatter.to2Decimal(duration) + " min<br>";
|
||||
|
||||
// smb
|
||||
if (smb != 0)
|
||||
ret += ("<b>" + "SMB" + "</b>: " + DecimalFormatter.to2Decimal(smb) + " U<br>");
|
||||
|
||||
// reason
|
||||
ret += "<b>" + MainApp.sResources.getString(R.string.reason) + "</b>: " + reason.replace("<", "<").replace(">", ">");
|
||||
return Html.fromHtml(ret);
|
||||
} else
|
||||
return Html.fromHtml(MainApp.sResources.getString(R.string.nochangerequested));
|
||||
|
|
|
@ -887,5 +887,6 @@
|
|||
<string name="enablesmbwithtemptarget_summary">Enable SMB when there is temp target active (eating soon, exercise)</string>
|
||||
<string name="enablesmbwithhightemptarget">Enable SMB with high temp targets</string>
|
||||
<string name="enablesmbwithhightemptarget_summary">Enable SMB when there is high temp target active (exercise)</string>
|
||||
<string name="let_tbr_run">Let current temp run</string>
|
||||
</resources>
|
||||
|
||||
|
|
Loading…
Reference in a new issue