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