From 4cadec78e54ec1a7d3e3056e892a951a4c15dfc5 Mon Sep 17 00:00:00 2001 From: Philoul Date: Thu, 13 May 2021 14:38:04 +0200 Subject: [PATCH 1/2] Improvement Action String (TT) --- core/src/main/res/values/strings.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 0c7d888f47..58a5795f1f 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -413,7 +413,7 @@ CARBS EXTENDED CARBS TEMP BASAL - TT + TEMP TARGET NEW PROFILE CLONE PROFILE STORE PROFILE @@ -434,7 +434,7 @@ CANCEL TEMP BASAL CANCEL BOLUS CANCEL EXTENDED BOLUS - CANCEL TT + CANCEL TEMP TARGET CAREPORTAL SITE CHANGE RESERVOIR CHANGE @@ -444,7 +444,7 @@ CAREPORTAL NS REFRESH PROFILE SWITCH NS REFRESH TREATMENTS NS REFRESH - TT NS REFRESH + TEMP TARGET NS REFRESH AUTOMATION REMOVED BG REMOVED CAREPORTAL REMOVED @@ -458,7 +458,7 @@ PROFILE SWITCH REMOVED RESTART EVENTS REMOVED TREATMENT REMOVED - TT REMOVED + TEMP TARGET REMOVED NS PAUSED NS RESUME NS QUEUE CLEARED From 98aac56c1c7891bcba6f89834084168abade4b48 Mon Sep 17 00:00:00 2001 From: Philoul Date: Thu, 13 May 2021 15:10:53 +0200 Subject: [PATCH 2/2] UserEntryPresentationHelper / csv improvement --- .../userEntry/UserEntryPresentationHelper.kt | 30 +++++++++---------- core/src/main/res/values/strings.xml | 2 +- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt index 0211fcf550..0faf232c17 100644 --- a/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt +++ b/core/src/main/java/info/nightscout/androidaps/utils/userEntry/UserEntryPresentationHelper.kt @@ -152,7 +152,7 @@ class UserEntryPresentationHelper @Inject constructor( csvString(R.string.eventtype), csvString(R.string.ue_source), csvString(R.string.careportal_note), - csvString(R.string.ue_formated_string), + csvString(R.string.ue_string), csvString(R.string.event_time_label), csvString(if (profileFunction.getUnits() == GlucoseUnit.MGDL) R.string.mgdl else R.string.mmol), csvString(R.string.shortgram), @@ -165,15 +165,15 @@ class UserEntryPresentationHelper @Inject constructor( ) + "\n" private fun getCsvEntry(entry: UserEntry): String { - val fullvalueWithUnitList = ArrayList(entry.values) - var timestampRec = "" + entry.timestamp - var dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp) - var utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt()) - var action = csvString(entry.action) + val fullvalueWithUnitList = ArrayList(entry.values) + val timestampRec = entry.timestamp.toString() + val dateTimestampRev = dateUtil.dateAndTimeAndSecondsString(entry.timestamp) + val utcOffset = dateUtil.timeStringFromSeconds((entry.utcOffset/1000).toInt()) + val action = csvString(entry.action) var therapyEvent = "" - var source = translator.translate(entry.source) - var note = csvString(entry.note) - var stringResource = "" + val source = translator.translate(entry.source) + val note = csvString(entry.note) + var simpleString = "" var timestamp = "" var bg = "" var gram = "" @@ -182,7 +182,7 @@ class UserEntryPresentationHelper @Inject constructor( var percent = "" var hour = "" var minute = "" - var other = "" + var noUnit = "" for (valueWithUnit in fullvalueWithUnitList.filterNotNull()) { when (valueWithUnit) { @@ -192,8 +192,8 @@ class UserEntryPresentationHelper @Inject constructor( is ValueWithUnit.Percent -> percent = valueWithUnit.value.toString() is ValueWithUnit.Insulin -> insulin = DecimalFormatter.to2Decimal(valueWithUnit.value) is ValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value) - is ValueWithUnit.SimpleInt -> other = other.addWithSeparator(valueWithUnit.value) - is ValueWithUnit.SimpleString -> other = other.addWithSeparator(valueWithUnit.value) + is ValueWithUnit.SimpleInt -> noUnit = noUnit.addWithSeparator(valueWithUnit.value) + is ValueWithUnit.SimpleString -> simpleString = simpleString.addWithSeparator(valueWithUnit.value) is ValueWithUnit.TherapyEventMeterType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value)) is ValueWithUnit.TherapyEventTTReason -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value)) is ValueWithUnit.TherapyEventType -> therapyEvent = therapyEvent.addWithSeparator(translator.translate(valueWithUnit.value)) @@ -210,9 +210,9 @@ class UserEntryPresentationHelper @Inject constructor( } therapyEvent = csvString(therapyEvent) - stringResource = csvString(stringResource) - other = csvString(other) - return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$stringResource;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$other" + simpleString = csvString(simpleString) + noUnit = csvString(noUnit) + return "$timestampRec;$dateTimestampRev;$utcOffset;$action;$therapyEvent;$source;$note;$simpleString;$timestamp;$bg;$gram;$insulin;$unitPerHour;$percent;$hour;$minute;$noUnit" } private fun csvString(action: Action): String = "\"" + translator.translate(action).replace("\"", "\"\"").replace("\n"," / ") + "\"" diff --git a/core/src/main/res/values/strings.xml b/core/src/main/res/values/strings.xml index 58a5795f1f..8742f92523 100644 --- a/core/src/main/res/values/strings.xml +++ b/core/src/main/res/values/strings.xml @@ -486,7 +486,7 @@ PLUGIN ENABLED PLUGIN DISABLED UNKNOWN - Formated string + String Source UTC Offset Action