From db5ee7067a3b5c858fad16cca7b2acc4be16d642 Mon Sep 17 00:00:00 2001 From: Johannes Mockenhaupt Date: Sat, 27 Jan 2018 19:51:35 +0100 Subject: [PATCH] PumpEnactResult.toSpanned: add SMBs, handle SMB-only enact. --- .../nightscout/androidaps/data/PumpEnactResult.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java b/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java index c50166d5a4..d19b3316ac 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java +++ b/app/src/main/java/info/nightscout/androidaps/data/PumpEnactResult.java @@ -57,6 +57,10 @@ public class PumpEnactResult extends Object { return this; } + public PumpEnactResult percent(Integer percent) { + this.percent = percent; + return this; + } public PumpEnactResult isPercent(boolean isPercent) { this.isPercent = isPercent; return this; @@ -111,7 +115,7 @@ public class PumpEnactResult extends Object { } public Spanned toSpanned() { - String ret = MainApp.sResources.getString(R.string.success) + ": " + success; + String ret = "" + MainApp.sResources.getString(R.string.success) + ": " + success; if (queued) { ret = MainApp.sResources.getString(R.string.waitingforpumpresult); } else if (enacted) { @@ -119,17 +123,20 @@ public class PumpEnactResult extends Object { ret += "
" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "
" + MainApp.sResources.getString(R.string.comment) + ": " + comment + "
" + MainApp.sResources.getString(R.string.canceltemp); - } else if (isPercent) { + } else if (isPercent && percent != -1) { ret += "
" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "
" + MainApp.sResources.getString(R.string.comment) + ": " + comment; ret += "
" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min"; ret += "
" + MainApp.sResources.getString(R.string.percent) + ": " + percent + "%"; - } else { + } else if (absolute != -1) { ret += "
" + MainApp.sResources.getString(R.string.enacted) + ": " + enacted; ret += "
" + MainApp.sResources.getString(R.string.comment) + ": " + comment; ret += "
" + MainApp.sResources.getString(R.string.duration) + ": " + duration + " min"; ret += "
" + MainApp.sResources.getString(R.string.absolute) + ": " + DecimalFormatter.to2Decimal(absolute) + " U/h"; } + if (bolusDelivered > 0) { + ret += "
" + MainApp.sResources.getString(R.string.bolus) + ": " + DecimalFormatter.to2Decimal(bolusDelivered) + " U"; + } } else { ret += "
" + MainApp.sResources.getString(R.string.comment) + ": " + comment; }