Remove presentation of StringResource with Param to avoid crash
Move String used in uel.log to core
This commit is contained in:
parent
1f4b75a30d
commit
2a03d1d7ca
4 changed files with 6 additions and 5 deletions
|
@ -43,8 +43,7 @@ class ActionProfileSwitchPercent(injector: HasAndroidInjector) : Action(injector
|
|||
|
||||
override fun doAction(callback: Callback) {
|
||||
uel.log(UserEntry.Action.PROFILE_SWITCH, Sources.Automation, title,
|
||||
if (duration.value == 0) XXXValueWithUnit.StringResource( R.string.startprofileforever, listOf(XXXValueWithUnit.Percent(pct.value.toInt())))
|
||||
else XXXValueWithUnit.StringResource( R.string.startprofile, listOf(XXXValueWithUnit.Percent(pct.value.toInt()), XXXValueWithUnit.Minute(duration.value))))
|
||||
XXXValueWithUnit.StringResource( R.string.startprofile, listOf(XXXValueWithUnit.Percent(pct.value.toInt()), XXXValueWithUnit.Minute(duration.value))))
|
||||
activePlugin.activeTreatments.doProfileSwitch(duration.value, pct.value.toInt(), 0)
|
||||
callback.result(PumpEnactResult(injector).success(true).comment(R.string.ok))?.run()
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
<string name="alreadyset">Already set</string>
|
||||
<string name="profilepercentage">Profile percentage</string>
|
||||
<string name="startprofileforever">Start profile %1$d%%</string>
|
||||
<string name="startprofile">Start profile %1$d%% for %2$d min</string>
|
||||
<string name="percent_u">Percent [%]:</string>
|
||||
<string name="sendsmsactionlabel">Send SMS: %1$s</string>
|
||||
<string name="sendsmsactiondescription">Send SMS to all numbers</string>
|
||||
|
|
|
@ -93,7 +93,8 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
is XXXValueWithUnit.UnitPerHour -> DecimalFormatter.to2Decimal(valueWithUnit.value) + translator.translate(UserEntry.Units.U_H)
|
||||
is XXXValueWithUnit.SimpleInt -> valueWithUnit.value.toString()
|
||||
is XXXValueWithUnit.SimpleString -> valueWithUnit.value
|
||||
is XXXValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value /*, valueWithUnit.params.map { it.value() }*/) //Todo Fix StringResource with Param
|
||||
// is XXXValueWithUnit.StringResource -> resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map{ it.value() }.toTypedArray()) //Todo Fix StringResource with Param
|
||||
is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size > 0 ) valueWithUnit.params.joinToString(separator = " ") { value -> toPresentationString(value) } else resourceHelper.gs(valueWithUnit.value) //To help debugging
|
||||
is XXXValueWithUnit.TherapyEventMeterType -> translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventTTReason -> translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventType -> translator.translate(valueWithUnit.value)
|
||||
|
@ -170,7 +171,8 @@ class UserEntryPresentationHelper @Inject constructor(
|
|||
is XXXValueWithUnit.UnitPerHour -> unitPerHour = DecimalFormatter.to2Decimal(valueWithUnit.value)
|
||||
is XXXValueWithUnit.SimpleInt -> other = if (other == "") valueWithUnit.value.toString() else other + " / " + valueWithUnit.value.toString()
|
||||
is XXXValueWithUnit.SimpleString -> other = if (other == "") valueWithUnit.value else other + " / " + valueWithUnit.value
|
||||
is XXXValueWithUnit.StringResource -> stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value, valueWithUnit.params) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value, valueWithUnit.params)
|
||||
// is XXXValueWithUnit.StringResource -> stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map { it.value() }.toTypedArray()) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value, valueWithUnit.params.map { it.value() }.toTypedArray())
|
||||
is XXXValueWithUnit.StringResource -> if (valueWithUnit.params.size == 0) { stringResource = if (stringResource == "") resourceHelper.gs(valueWithUnit.value) else stringResource + " / " + resourceHelper.gs(valueWithUnit.value)}
|
||||
is XXXValueWithUnit.TherapyEventMeterType -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventTTReason -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
|
||||
is XXXValueWithUnit.TherapyEventType -> therapyEvent = if (therapyEvent == "") translator.translate(valueWithUnit.value) else therapyEvent + " / " + translator.translate(valueWithUnit.value)
|
||||
|
|
|
@ -217,6 +217,7 @@
|
|||
|
||||
<!-- ProfileFunction-->
|
||||
<string name="noprofileselected">No profile selected</string>
|
||||
<string name="startprofile">Start profile %1$d%% for %2$d min</string>
|
||||
|
||||
<!-- PumpType-->
|
||||
<string name="def_extended_note">* Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump.</string>
|
||||
|
|
Loading…
Reference in a new issue