Skip to content

Commit

Permalink
Merge pull request #3636 from olorinmaia/add_strings_APSresult
Browse files Browse the repository at this point in the history
Add complete strings to APS result
  • Loading branch information
MilosKozak authored Dec 19, 2024
2 parents 3e6235f + 108a729 commit 2232218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,9 @@ class DetermineBasalResult @Inject constructor(val injector: HasAndroidInjector)
// rate
var ret: String = if (rate == 0.0 && duration == 0) "${rh.gs(R.string.cancel_temp)} "
else if (rate == -1.0) "${rh.gs(R.string.let_temp_basal_run)}\n"
else if (usePercent) "${rh.gs(R.string.rate)}: ${decimalFormatter.to2Decimal(percent.toDouble())}% (${decimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0)} U/h) " +
"${rh.gs(R.string.duration)}: ${decimalFormatter.to2Decimal(duration.toDouble())} min "
else "${rh.gs(R.string.rate)}: ${decimalFormatter.to2Decimal(rate)} U/h (${decimalFormatter.to2Decimal(rate / pump.baseBasalRate * 100)}%) " +
"${rh.gs(R.string.duration)}: ${decimalFormatter.to2Decimal(duration.toDouble())} min "
else if (usePercent) "${rh.gs(R.string.percent_rate_duration, percent.toDouble(), percent * pump.baseBasalRate / 100.0, duration.toDouble())} "
else "${rh.gs(R.string.rate_percent_duration, rate, rate / pump.baseBasalRate * 100.0, duration.toDouble())} "

// smb
if (smb != 0.0) ret += "SMB: ${decimalFormatter.toPumpSupportedBolus(smb, activePlugin.activePump.pumpDescription.bolusStep)} "
if (isCarbsRequired) {
Expand All @@ -150,12 +149,8 @@ class DetermineBasalResult @Inject constructor(val injector: HasAndroidInjector)
var ret: String =
if (rate == 0.0 && duration == 0) rh.gs(R.string.cancel_temp) + "<br>"
else if (rate == -1.0) rh.gs(R.string.let_temp_basal_run) + "<br>"
else if (usePercent) "<b>" + rh.gs(R.string.rate) + "</b>: " + decimalFormatter.to2Decimal(percent.toDouble()) + "% " +
"(" + decimalFormatter.to2Decimal(percent * pump.baseBasalRate / 100.0) + " U/h)<br>" +
"<b>" + rh.gs(R.string.duration) + "</b>: " + decimalFormatter.to2Decimal(duration.toDouble()) + " min<br>"
else "<b>" + rh.gs(R.string.rate) + "</b>: " + decimalFormatter.to2Decimal(rate) + " U/h " +
"(" + decimalFormatter.to2Decimal(rate / pump.baseBasalRate * 100.0) + "%) <br>" +
"<b>" + rh.gs(R.string.duration) + "</b>: " + decimalFormatter.to2Decimal(duration.toDouble()) + " min<br>"
else if (usePercent) rh.gs(R.string.percent_rate_duration_formatted, percent.toDouble(), percent * pump.baseBasalRate / 100.0, duration.toDouble())
else rh.gs(R.string.rate_percent_duration_formatted, rate, rate / pump.baseBasalRate * 100.0, duration.toDouble())

// smb
if (smb != 0.0) ret += "<b>" + "SMB" + "</b>: " + decimalFormatter.toPumpSupportedBolus(smb, activePlugin.activePump.pumpDescription.bolusStep) + "<br>"
Expand Down
5 changes: 4 additions & 1 deletion core/ui/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -631,5 +631,8 @@
<!-- DecimalFormatterImpl -->
<string name="format_insulin_units1">%1$.1f U</string>
<string name="format_insulin_units">%1$.2f U</string>

<string name="percent_rate_duration">Rate: %1$.2f%% (%2$.2f U/h) Duration: %3$.2f min</string>
<string name="rate_percent_duration">Rate: %1$.2f U/h (%2$.2f%%) Duration: %3$.2f min</string>
<string name="percent_rate_duration_formatted"><![CDATA[<b>Rate</b>: %1$.2f%% (%2$.2f U/h)<br><b>Duration</b>: %3$.2f min<br>]]></string>
<string name="rate_percent_duration_formatted"><![CDATA[<b>Rate</b>: %1$.2f U/h (%2$.2f%%) <br><b>Duration</b>: %3$.2f min<br>]]></string>
</resources>

0 comments on commit 2232218

Please sign in to comment.