From caad075310ab58f8a79eefe828d2b39596f9f2a6 Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Mon, 18 Sep 2023 01:06:16 +0200 Subject: [PATCH] simply interfaces module --- .../interfaces/pump/defs/PumpType.kt | 27 +++---------------- .../src/main/res/values/strings.xml | 7 ----- .../nightscout/core/wizard/BolusWizard.kt | 2 +- core/ui/src/main/res/values/strings.xml | 3 +++ .../overview/OverviewDataImpl.kt | 8 +++--- .../queue/commands/CommandBolus.kt | 2 +- .../queue/commands/CommandSMBBolus.kt | 2 +- .../stats/TotalDailyDoseExtension.kt | 12 ++++----- .../utils/DecimalFormatterImpl.kt | 2 +- .../queue/CommandQueueImplementationTest.kt | 2 +- .../general/overview/OverviewFragment.kt | 2 +- .../info/nightscout/pump/dana/DanaFragment.kt | 2 +- .../dana/activities/DanaHistoryActivity.kt | 6 ++--- .../pump/diaconn/DiaconnG8Fragment.kt | 2 +- .../activities/DiaconnG8HistoryActivity.kt | 6 ++--- .../ui/viewmodel/MedtrumOverviewViewModel.kt | 6 ++--- .../pump/virtual/VirtualPumpFragment.kt | 24 ++++++++++++++++- pump/virtual/src/main/res/values/strings.xml | 3 +++ .../ui/activities/TDDStatsActivity.kt | 14 +++++----- .../fragments/TreatmentsBolusCarbsFragment.kt | 8 +++--- .../TreatmentsExtendedBolusesFragment.kt | 4 +-- .../TreatmentsTemporaryBasalsFragment.kt | 2 +- .../ui/dialogs/ExtendedBolusDialog.kt | 2 +- .../ui/dialogs/ProfileViewerDialog.kt | 2 +- .../nightscout/ui/dialogs/WizardDialog.kt | 18 ++++++------- .../nightscout/ui/dialogs/WizardInfoDialog.kt | 18 ++++++------- 26 files changed, 93 insertions(+), 93 deletions(-) diff --git a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt index b6d7400e3e..994ed2b84a 100644 --- a/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt +++ b/core/interfaces/src/main/java/info/nightscout/interfaces/pump/defs/PumpType.kt @@ -1,8 +1,6 @@ package info.nightscout.interfaces.pump.defs -import info.nightscout.interfaces.R import info.nightscout.interfaces.utils.Round -import info.nightscout.shared.interfaces.ResourceHelper import kotlin.math.min @Suppress("unused") @@ -447,7 +445,7 @@ enum class PumpType { private set var bolusSize = 0.0 get() = parent?.bolusSize ?: field - private var specialBolusSize: DoseStepSize? = null + var specialBolusSize: DoseStepSize? = null get() = parent?.specialBolusSize ?: field var extendedBolusSettings: DoseSettings? = null get() = parent?.extendedBolusSettings ?: field @@ -470,7 +468,7 @@ enum class PumpType { var baseBasalStep = 1.0 get() = parent?.baseBasalStep ?: field private set - private var baseBasalSpecialSteps: DoseStepSize? = null + var baseBasalSpecialSteps: DoseStepSize? = null get() = parent?.baseBasalSpecialSteps ?: field var pumpCapability: PumpCapability? = null get() = parent?.pumpCapability ?: field @@ -570,29 +568,10 @@ enum class PumpType { this.source = source } - fun getFullDescription(i18nTemplate: String, hasExtendedBasals: Boolean, rh: ResourceHelper): String { - val unit = if (pumpTempBasalType == PumpTempBasalType.Percent) "%" else "" - val eb = extendedBolusSettings ?: return "INVALID" - val tbr = tbrSettings ?: return "INVALID" - val extendedNote = if (hasExtendedBasals) rh.gs(R.string.def_extended_note) else "" - return String.format( - i18nTemplate, - getStep("" + bolusSize, specialBolusSize), - eb.step, eb.durationStep, eb.maxDuration / 60, - getStep(baseBasalRange(), baseBasalSpecialSteps), - tbr.minDose.toString() + unit + "-" + tbr.maxDose + unit, tbr.step.toString() + unit, - tbr.durationStep, tbr.maxDuration / 60, extendedNote - ) - } - - private fun baseBasalRange(): String = + fun baseBasalRange(): String = if (baseBasalMaxValue == null) baseBasalMinValue.toString() else baseBasalMinValue.toString() + "-" + baseBasalMaxValue.toString() - private fun getStep(step: String, stepSize: DoseStepSize?): String = - if (stepSize != null) step + " [" + stepSize.description + "] *" - else step - fun hasExtendedBasals(): Boolean = baseBasalSpecialSteps != null || specialBolusSize != null fun determineCorrectBolusSize(bolusAmount: Double): Double = diff --git a/core/interfaces/src/main/res/values/strings.xml b/core/interfaces/src/main/res/values/strings.xml index 306c12f87d..bc7e2675d6 100644 --- a/core/interfaces/src/main/res/values/strings.xml +++ b/core/interfaces/src/main/res/values/strings.xml @@ -12,14 +12,7 @@ New debug format (unencrypted) Unknown export format - - * Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump. - Pump driver changed. - - %1$.1f U - %1$.2f U - diff --git a/core/main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt b/core/main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt index 7bf6c1f716..be814c2ea3 100644 --- a/core/main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt +++ b/core/main/src/main/java/info/nightscout/core/wizard/BolusWizard.kt @@ -321,7 +321,7 @@ class BolusWizard @Inject constructor( if (insulinAfterConstraints > 0) { val pct = if (percentageCorrection != 100) " ($percentageCorrection%)" else "" actions.add( - rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, insulinAfterConstraints).formatColor + rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, insulinAfterConstraints).formatColor (context, rh, info.nightscout.core.ui.R.attr.bolusColor) + pct ) } diff --git a/core/ui/src/main/res/values/strings.xml b/core/ui/src/main/res/values/strings.xml index 5965f8ec64..dffde23751 100644 --- a/core/ui/src/main/res/values/strings.xml +++ b/core/ui/src/main/res/values/strings.xml @@ -648,5 +648,8 @@ S S + + %1$.1f U + %1$.2f U diff --git a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt index 1aedfc003e..8dabf9b375 100644 --- a/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/overview/OverviewDataImpl.kt @@ -245,12 +245,12 @@ class OverviewDataImpl @Inject constructor( } override fun iobText(iobCobCalculator: IobCobCalculator): String = - rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) override fun iobDialogText(iobCobCalculator: IobCobCalculator): String = - rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) + "\n" + - rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob) + "\n" + - rh.gs(info.nightscout.core.ui.R.string.basal) + ": " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, basalIob(iobCobCalculator).basaliob) + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob + basalIob(iobCobCalculator).basaliob) + "\n" + + rh.gs(info.nightscout.core.ui.R.string.bolus) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusIob(iobCobCalculator).iob) + "\n" + + rh.gs(info.nightscout.core.ui.R.string.basal) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, basalIob(iobCobCalculator).basaliob) /* * TEMP TARGET diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt index 9645df6318..d73072cbb8 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandBolus.kt @@ -38,7 +38,7 @@ class CommandBolus( } override fun log(): String { - return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, detailedBolusInfo.insulin) else "") + + return (if (detailedBolusInfo.insulin > 0) "BOLUS " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin) else "") + if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(info.nightscout.core.main.R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else "" } diff --git a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt index 32e00d4f70..b834ada838 100644 --- a/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt +++ b/implementation/src/main/java/info/nightscout/implementation/queue/commands/CommandSMBBolus.kt @@ -41,7 +41,7 @@ class CommandSMBBolus( override fun status(): String = rh.gs(info.nightscout.core.ui.R.string.smb_bolus_u, detailedBolusInfo.insulin) - override fun log(): String = "SMB BOLUS ${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, detailedBolusInfo.insulin)}" + override fun log(): String = "SMB BOLUS ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, detailedBolusInfo.insulin)}" override fun cancel() { aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() diff --git a/implementation/src/main/java/info/nightscout/implementation/stats/TotalDailyDoseExtension.kt b/implementation/src/main/java/info/nightscout/implementation/stats/TotalDailyDoseExtension.kt index 6ca8875275..85f711a224 100644 --- a/implementation/src/main/java/info/nightscout/implementation/stats/TotalDailyDoseExtension.kt +++ b/implementation/src/main/java/info/nightscout/implementation/stats/TotalDailyDoseExtension.kt @@ -37,9 +37,9 @@ fun TotalDailyDose.toTableRow(context: Context, rh: ResourceHelper, dateUtil: Da row.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT) row.gravity = Gravity.CENTER_HORIZONTAL row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = dateUtil.dateStringShort(timestamp) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, total) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, bolusAmount) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, basalAmount) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, total) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, bolusAmount) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, basalAmount) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(info.nightscout.core.ui.R.string.formatPercent, basalPct) }) if (includeCarbs) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs(info.nightscout.core.main.R.string.format_carbs, carbs @@ -55,9 +55,9 @@ fun TotalDailyDose.toTableRow(context: Context, rh: ResourceHelper, days: Int, i row.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT) row.gravity = Gravity.CENTER_HORIZONTAL row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 0 }; text = "%02d".format(days) + " " + rh.gs(info.nightscout.shared.R.string.days) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, total) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, bolusAmount) }) - row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units1, basalAmount) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 1 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, total) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 2 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, bolusAmount) }) + row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 3 }; text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, basalAmount) }) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 4 }; text = rh.gs(info.nightscout.core.ui.R.string.formatPercent, basalPct) }) if (includeCarbs) row.addView(TextView(context).apply { gravity = Gravity.CENTER_HORIZONTAL; layoutParams = lp.apply { column = 5 }; text = rh.gs(info.nightscout.core.main.R.string.format_carbs, carbs diff --git a/implementation/src/main/java/info/nightscout/implementation/utils/DecimalFormatterImpl.kt b/implementation/src/main/java/info/nightscout/implementation/utils/DecimalFormatterImpl.kt index db9e78da6e..f627734e9a 100644 --- a/implementation/src/main/java/info/nightscout/implementation/utils/DecimalFormatterImpl.kt +++ b/implementation/src/main/java/info/nightscout/implementation/utils/DecimalFormatterImpl.kt @@ -27,7 +27,7 @@ class DecimalFormatterImpl @Inject constructor( override fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit override fun toPumpSupportedBolus(value: Double, bolusStep: Double): String = if (bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value) override fun toPumpSupportedBolusWithUnits(value: Double, bolusStep: Double): String = - if (bolusStep <= 0.051) rh.gs(R.string.format_insulin_units, value) else rh.gs(R.string.format_insulin_units1, value) + if (bolusStep <= 0.051) rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, value) else rh.gs(info.nightscout.core.ui.R.string.format_insulin_units1, value) override fun pumpSupportedBolusFormat(bolusStep: Double): DecimalFormat = if (bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0") } \ No newline at end of file diff --git a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt index 0645630ab0..f77ea1b704 100644 --- a/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt +++ b/implementation/src/test/java/info/nightscout/implementation/queue/CommandQueueImplementationTest.kt @@ -150,7 +150,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() { val percentageConstraint = Constraint(0) `when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint) `when`(rh.gs(info.nightscout.core.ui.R.string.connectiontimedout)).thenReturn("Connection timed out") - `when`(rh.gs(info.nightscout.interfaces.R.string.format_insulin_units)).thenReturn("%1\$.2f U") + `when`(rh.gs(info.nightscout.core.ui.R.string.format_insulin_units)).thenReturn("%1\$.2f U") `when`(rh.gs(info.nightscout.core.ui.R.string.goingtodeliver)).thenReturn("Going to deliver %1\$.2f U") } diff --git a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt index 81dd5a1174..3b4ae53379 100644 --- a/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt +++ b/plugins/main/src/main/java/info/nightscout/plugins/general/overview/OverviewFragment.kt @@ -544,7 +544,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList binding.buttonsLayout.quickWizardButton.visibility = View.VISIBLE val wizard = quickWizardEntry.doCalc(profile, profileName, lastBG) binding.buttonsLayout.quickWizardButton.text = quickWizardEntry.buttonText() + "\n" + rh.gs(info.nightscout.core.main.R.string.format_carbs, quickWizardEntry.carbs()) + - " " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.calculatedTotalInsulin) + " " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.calculatedTotalInsulin) if (wizard.calculatedTotalInsulin <= 0) binding.buttonsLayout.quickWizardButton.visibility = View.GONE } else binding.buttonsLayout.quickWizardButton.visibility = View.GONE } diff --git a/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt b/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt index 32c807106b..acd4e7b830 100644 --- a/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt +++ b/pump/dana/src/main/java/info/nightscout/pump/dana/DanaFragment.kt @@ -215,7 +215,7 @@ class DanaFragment : DaggerFragment() { val agoHours = agoMilliseconds.toDouble() / 60.0 / 60.0 / 1000.0 if (agoHours < 6) // max 6h back - binding.lastBolus.text = dateUtil.timeString(pump.lastBolusTime) + " " + dateUtil.sinceString(pump.lastBolusTime, rh) + " " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, pump.lastBolusAmount) + binding.lastBolus.text = dateUtil.timeString(pump.lastBolusTime) + " " + dateUtil.sinceString(pump.lastBolusTime, rh) + " " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, pump.lastBolusAmount) else binding.lastBolus.text = "" } diff --git a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaHistoryActivity.kt b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaHistoryActivity.kt index e5e0c75bcb..c279e44935 100644 --- a/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaHistoryActivity.kt +++ b/pump/dana/src/main/java/info/nightscout/pump/dana/activities/DanaHistoryActivity.kt @@ -179,9 +179,9 @@ class DanaHistoryActivity : TranslatedDaggerAppCompatActivity() { } RecordTypes.RECORD_TYPE_DAILY -> { - holder.binding.dailyBasal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBasal) - holder.binding.dailyBolus.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBolus) - holder.binding.dailyTotal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBolus + record.dailyBasal) + holder.binding.dailyBasal.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBasal) + holder.binding.dailyBolus.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBolus) + holder.binding.dailyTotal.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBolus + record.dailyBasal) holder.binding.time.text = dateUtil.dateString(record.timestamp) holder.binding.time.visibility = View.VISIBLE holder.binding.value.visibility = View.GONE diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt index cae3f34270..eab7ce0a82 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/DiaconnG8Fragment.kt @@ -168,7 +168,7 @@ class DiaconnG8Fragment : DaggerFragment() { val agoHours = agoMsec.toDouble() / 60.0 / 60.0 / 1000.0 if (agoHours < 6) // max 6h back - binding.lastbolus.text = dateUtil.timeString(pump.lastBolusTime) + " " + dateUtil.sinceString(pump.lastBolusTime, rh) + " " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, pump.lastBolusAmount) + binding.lastbolus.text = dateUtil.timeString(pump.lastBolusTime) + " " + dateUtil.sinceString(pump.lastBolusTime, rh) + " " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, pump.lastBolusAmount) else binding.lastbolus.text = "" } diff --git a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8HistoryActivity.kt b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8HistoryActivity.kt index d611ee3d6e..9ce2560536 100644 --- a/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8HistoryActivity.kt +++ b/pump/diaconn/src/main/java/info/nightscout/pump/diaconn/activities/DiaconnG8HistoryActivity.kt @@ -158,9 +158,9 @@ class DiaconnG8HistoryActivity : TranslatedDaggerAppCompatActivity() { } RecordTypes.RECORD_TYPE_DAILY -> { - holder.dailyBasal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBasal) - holder.dailyBolus.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBolus) - holder.dailyTotal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.dailyBolus + record.dailyBasal) + holder.dailyBasal.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBasal) + holder.dailyBolus.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBolus) + holder.dailyTotal.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.dailyBolus + record.dailyBasal) holder.time.text = dateUtil.dateString(record.timestamp) holder.time.visibility = View.VISIBLE holder.value.visibility = View.GONE diff --git a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/ui/viewmodel/MedtrumOverviewViewModel.kt b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/ui/viewmodel/MedtrumOverviewViewModel.kt index 13392125bf..8291983817 100644 --- a/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/ui/viewmodel/MedtrumOverviewViewModel.kt +++ b/pump/medtrum/src/main/java/info/nightscout/pump/medtrum/ui/viewmodel/MedtrumOverviewViewModel.kt @@ -131,8 +131,8 @@ class MedtrumOverviewViewModel @Inject constructor( if (!medtrumPump.bolusDone && medtrumPlugin.isInitialized()) { _activeBolusStatus.postValue( dateUtil.timeString(medtrumPump.bolusStartTime) + " " + dateUtil.sinceString(medtrumPump.bolusStartTime, rh) - + " " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolusAmount) + " / " + rh.gs( - info.nightscout.interfaces.R.string.format_insulin_units, medtrumPump.bolusAmountToBeDelivered + + " " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusAmount) + " / " + rh.gs( + info.nightscout.core.ui.R.string.format_insulin_units, medtrumPump.bolusAmountToBeDelivered ) ) } @@ -186,7 +186,7 @@ class MedtrumOverviewViewModel @Inject constructor( // max 6h back _lastBolus.postValue( dateUtil.timeString(medtrumPump.lastBolusTime) + " " + dateUtil.sinceString(medtrumPump.lastBolusTime, rh) + " " + rh.gs( - info.nightscout.interfaces.R.string.format_insulin_units, medtrumPump.lastBolusAmount + info.nightscout.core.ui.R.string.format_insulin_units, medtrumPump.lastBolusAmount ) ) else _lastBolus.postValue("") diff --git a/pump/virtual/src/main/java/info/nightscout/pump/virtual/VirtualPumpFragment.kt b/pump/virtual/src/main/java/info/nightscout/pump/virtual/VirtualPumpFragment.kt index 64f8eab66e..bd0a99f0bf 100644 --- a/pump/virtual/src/main/java/info/nightscout/pump/virtual/VirtualPumpFragment.kt +++ b/pump/virtual/src/main/java/info/nightscout/pump/virtual/VirtualPumpFragment.kt @@ -11,6 +11,9 @@ import info.nightscout.core.extensions.toStringFull import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.profile.ProfileFunction +import info.nightscout.interfaces.pump.defs.DoseStepSize +import info.nightscout.interfaces.pump.defs.PumpTempBasalType +import info.nightscout.interfaces.pump.defs.PumpType import info.nightscout.interfaces.utils.DecimalFormatter import info.nightscout.pump.virtual.databinding.VirtualPumpFragmentBinding import info.nightscout.pump.virtual.events.EventVirtualPumpUpdateGui @@ -97,7 +100,7 @@ class VirtualPumpFragment : DaggerFragment() { binding.extendedbolus.text = iobCobCalculator.getExtendedBolus(dateUtil.now())?.toStringFull(dateUtil, decimalFormatter) ?: "" binding.battery.text = rh.gs(info.nightscout.core.ui.R.string.format_percent, virtualPumpPlugin.batteryPercent) - binding.reservoir.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, virtualPumpPlugin.reservoirInUnits.toDouble()) + binding.reservoir.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, virtualPumpPlugin.reservoirInUnits.toDouble()) virtualPumpPlugin.refreshConfiguration() val pumpType = virtualPumpPlugin.pumpType @@ -106,4 +109,23 @@ class VirtualPumpFragment : DaggerFragment() { binding.typeDef.text = pumpType?.getFullDescription(rh.gs(R.string.virtual_pump_pump_def), pumpType.hasExtendedBasals(), rh) binding.serialNumber.text = virtualPumpPlugin.serialNumber() } + + private fun getStep(step: String, stepSize: DoseStepSize?): String = + if (stepSize != null) step + " [" + stepSize.description + "] *" + else step + + private fun PumpType.getFullDescription(i18nTemplate: String, hasExtendedBasals: Boolean, rh: ResourceHelper): String { + val unit = if (pumpTempBasalType == PumpTempBasalType.Percent) "%" else "" + val eb = extendedBolusSettings ?: return "INVALID" + val tbr = tbrSettings ?: return "INVALID" + val extendedNote = if (hasExtendedBasals) rh.gs(R.string.def_extended_note) else "" + return String.format( + i18nTemplate, + getStep(bolusSize.toString(), specialBolusSize), + eb.step, eb.durationStep, eb.maxDuration / 60, + getStep(baseBasalRange(), baseBasalSpecialSteps), + tbr.minDose.toString() + unit + "-" + tbr.maxDose + unit, tbr.step.toString() + unit, + tbr.durationStep, tbr.maxDuration / 60, extendedNote + ) + } } diff --git a/pump/virtual/src/main/res/values/strings.xml b/pump/virtual/src/main/res/values/strings.xml index 3535a191cc..7d4db35bc2 100644 --- a/pump/virtual/src/main/res/values/strings.xml +++ b/pump/virtual/src/main/res/values/strings.xml @@ -10,4 +10,7 @@ VIRTUAL PUMP Virtual pump settings + + * Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump. + diff --git a/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt b/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt index 11558479bf..5de99168bb 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/TDDStatsActivity.kt @@ -313,17 +313,17 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() { }) tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL -> labelBASAL.id = 300 + i - labelBASAL.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.basalAmount) + labelBASAL.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.basalAmount) labelBASAL.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS -> labelBOLUS.id = 400 + i - labelBOLUS.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, record.bolusAmount) + labelBOLUS.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, record.bolusAmount) labelBOLUS.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelTDD -> labelTDD.id = 500 + i - labelTDD.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, tdd) + labelTDD.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, tdd) labelTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) }) tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO -> @@ -361,7 +361,7 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() { ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD -> labelCUMTDD.id = 900 + i - labelCUMTDD.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, sum / i) + labelCUMTDD.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, sum / i) labelCUMTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) }) @@ -413,9 +413,9 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() { etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD -> labelEXPTDD.id = 1300 + i labelEXPTDD.text = """ - ${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, weighted03)} - ${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, weighted05)} - ${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, weighted07)} + ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, weighted03)} + ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, weighted05)} + ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, weighted07)} """.trimIndent() labelEXPTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) }) diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt index 47accd2bec..7798ae3208 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsBolusCarbsFragment.kt @@ -218,18 +218,18 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider { holder.binding.bolusLayout.visibility = (ml.bolus != null && (ml.bolus.isValid || showInvalidated)).toVisibility() ml.bolus?.let { bolus -> holder.binding.bolusTime.text = dateUtil.timeString(bolus.timestamp) - holder.binding.insulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolus.amount) + holder.binding.insulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolus.amount) holder.binding.bolusNs.visibility = (bolus.interfaceIDs.nightscoutId != null).toVisibility() holder.binding.bolusPump.visibility = bolus.interfaceIDs.isPumpHistory().toVisibility() holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility() val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia) if (iob.iobContrib > 0.01) { holder.binding.iob.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.activeColor)) - holder.binding.iob.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, iob.iobContrib) + holder.binding.iob.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, iob.iobContrib) holder.binding.iobLabel.visibility = View.VISIBLE holder.binding.iob.visibility = View.VISIBLE } else { - holder.binding.iob.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, 0.0) + holder.binding.iob.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, 0.0) holder.binding.iob.setTextColor(holder.binding.insulin.currentTextColor) holder.binding.iobLabel.visibility = View.GONE holder.binding.iob.visibility = View.GONE @@ -438,7 +438,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider { val mealLink = selectedItems.valueAt(0) val bolus = mealLink.bolus if (bolus != null) - return rh.gs(info.nightscout.core.ui.R.string.configbuilder_insulin) + ": " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolus.amount) + "\n" + + return rh.gs(info.nightscout.core.ui.R.string.configbuilder_insulin) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolus.amount) + "\n" + rh.gs(info.nightscout.core.ui.R.string.date) + ": " + dateUtil.dateAndTimeString(bolus.timestamp) val carbs = mealLink.carbs if (carbs != null) diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt index 2e3f03c340..6b4a9b7698 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsExtendedBolusesFragment.kt @@ -154,9 +154,9 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider { } val profile = profileFunction.getProfile(extendedBolus.timestamp) ?: return holder.binding.duration.text = rh.gs(info.nightscout.core.ui.R.string.format_mins, T.msecs(extendedBolus.duration).mins()) - holder.binding.insulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, extendedBolus.amount) + holder.binding.insulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, extendedBolus.amount) val iob = extendedBolus.iobCalc(System.currentTimeMillis(), profile, activePlugin.activeInsulin) - holder.binding.iob.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, iob.iob) + holder.binding.iob.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, iob.iob) holder.binding.ratio.text = rh.gs(info.nightscout.core.ui.R.string.pump_base_basal_rate, extendedBolus.rate) if (iob.iob != 0.0) holder.binding.iob.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.activeColor)) else holder.binding.iob.setTextColor(holder.binding.insulin.currentTextColor) holder.binding.cbRemove.visibility = (extendedBolus.isValid && actionHelper.isRemoving).toVisibility() diff --git a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt index 0e3053eb41..561b854ad2 100644 --- a/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt +++ b/ui/src/main/java/info/nightscout/ui/activities/fragments/TreatmentsTemporaryBasalsFragment.kt @@ -196,7 +196,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider { var iob = IobTotal(now) val profile = profileFunction.getProfile(now) if (profile != null) iob = tempBasal.iobCalc(now, profile, activePlugin.activeInsulin) - holder.binding.iob.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, iob.basaliob) + holder.binding.iob.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, iob.basaliob) holder.binding.extendedFlag.visibility = (tempBasal.type == TemporaryBasal.Type.FAKE_EXTENDED).toVisibility() holder.binding.suspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.PUMP_SUSPEND).toVisibility() holder.binding.emulatedSuspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.EMULATED_PUMP_SUSPEND).toVisibility() diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt index c0eac568c1..bc124586a0 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/ExtendedBolusDialog.kt @@ -95,7 +95,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() { val durationInMinutes = binding.duration.value.toInt() val actions: LinkedList = LinkedList() val insulinAfterConstraint = constraintChecker.applyExtendedBolusConstraints(Constraint(insulin)).value() - actions.add(rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, insulinAfterConstraint)) + actions.add(rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, insulinAfterConstraint)) actions.add(rh.gs(info.nightscout.core.ui.R.string.duration) + ": " + rh.gs(info.nightscout.core.ui.R.string.format_mins, durationInMinutes)) if (abs(insulinAfterConstraint - insulin) > 0.01) actions.add(rh.gs(info.nightscout.core.ui.R.string.constraint_applied).formatColor(context, rh, info.nightscout.core.ui.R.attr.warningColor)) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt index 288a9adfed..0bd001a4d9 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/ProfileViewerDialog.kt @@ -165,7 +165,7 @@ class ProfileViewerDialog : DaggerDialogFragment() { binding.date.text = date binding.ic.text = it.getIcList(rh, dateUtil) binding.isf.text = it.getIsfList(rh, dateUtil) - binding.basal.text = "∑ " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, it.baseBasalSum()) + "\n" + it.getBasalList(rh, dateUtil) + binding.basal.text = "∑ " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, it.baseBasalSum()) + "\n" + it.getBasalList(rh, dateUtil) binding.target.text = it.getTargetList(rh, dateUtil) binding.basalGraph.show(it) binding.isfGraph.show(it) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/WizardDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/WizardDialog.kt index f7aec305ff..319db875e9 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/WizardDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/WizardDialog.kt @@ -407,7 +407,7 @@ class WizardDialog : DaggerDialogFragment() { binding.ttCheckbox.isEnabled = tempTarget is ValueWrapper.Existing binding.ttCheckboxIcon.visibility = binding.ttCheckbox.isEnabled.toVisibility() - binding.iobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, -bolusIob.iob - basalIob.basaliob) + binding.iobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, -bolusIob.iob - basalIob.basaliob) calculateInsulin() } @@ -482,18 +482,18 @@ class WizardDialog : DaggerDialogFragment() { wizard?.let { wizard -> binding.bg.text = rh.gs(R.string.format_bg_isf, valueToUnitsToString(profileUtil.convertToMgdl(bg, profileFunction.getUnits()), profileFunction.getUnits().asText), wizard.sens) - binding.bgInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromBG) + binding.bgInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromBG) binding.carbs.text = rh.gs(R.string.format_carbs_ic, carbs.toDouble(), wizard.ic) - binding.carbsInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromCarbs) + binding.carbsInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromCarbs) - binding.iobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromBolusIOB + wizard.insulinFromBasalIOB) + binding.iobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromBolusIOB + wizard.insulinFromBasalIOB) - binding.correctionInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromCorrection) + binding.correctionInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromCorrection) // Superbolus binding.sb.text = if (binding.sbCheckbox.isChecked) rh.gs(R.string.two_hours) else "" - binding.sbInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromSuperBolus) + binding.sbInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromSuperBolus) // Trend if (binding.bgTrendCheckbox.isChecked && wizard.glucoseStatus != null) { @@ -503,19 +503,19 @@ class WizardDialog : DaggerDialogFragment() { } else { binding.bgTrend.text = "" } - binding.bgTrendInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromTrend) + binding.bgTrendInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromTrend) // COB if (binding.cobCheckbox.isChecked) { binding.cob.text = rh.gs(R.string.format_cob_ic, cob, wizard.ic) - binding.cobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.insulinFromCOB) + binding.cobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.insulinFromCOB) } else { binding.cob.text = "" binding.cobInsulin.text = "" } if (wizard.calculatedTotalInsulin > 0.0 || carbsAfterConstraint > 0.0) { - val insulinText = if (wizard.calculatedTotalInsulin > 0.0) rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, wizard.calculatedTotalInsulin).formatColor(context, rh, info.nightscout.core.ui.R.attr.bolusColor) else "" + val insulinText = if (wizard.calculatedTotalInsulin > 0.0) rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, wizard.calculatedTotalInsulin).formatColor(context, rh, info.nightscout.core.ui.R.attr.bolusColor) else "" val carbsText = if (carbsAfterConstraint > 0.0) rh.gs(info.nightscout.core.main.R.string.format_carbs, carbsAfterConstraint).formatColor(context, rh, info.nightscout.core.ui.R.attr .carbsColor) else "" binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.result_insulin_carbs, insulinText, carbsText)) diff --git a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt index 90cf8bcc14..1a22c0291e 100644 --- a/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt +++ b/ui/src/main/java/info/nightscout/ui/dialogs/WizardInfoDialog.kt @@ -60,31 +60,31 @@ class WizardInfoDialog : DaggerDialogFragment() { val trend = profileUtil.fromMgdlToStringInUnits(data.glucoseTrend * 3) // BG binding.bg.text = rh.gs(R.string.format_bg_isf, bgString, isf) - binding.bgInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.glucoseInsulin) + binding.bgInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.glucoseInsulin) binding.bgCheckbox.isChecked = data.wasGlucoseUsed binding.ttCheckbox.isChecked = data.wasTempTargetUsed // Trend binding.bgTrend.text = trend - binding.bgTrendInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.trendInsulin) + binding.bgTrendInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.trendInsulin) binding.bgTrendCheckbox.isChecked = data.wasTrendUsed // COB binding.cob.text = rh.gs(R.string.format_cob_ic, data.cob, data.ic) - binding.cobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.cobInsulin) + binding.cobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.cobInsulin) binding.cobCheckbox.isChecked = data.wasCOBUsed // Bolus IOB - binding.bolusIobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.bolusIOB) + binding.bolusIobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.bolusIOB) binding.bolusIobCheckbox.isChecked = data.wasBolusIOBUsed // Basal IOB - binding.basalIobInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.basalIOB) + binding.basalIobInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.basalIOB) binding.basalIobCheckbox.isChecked = data.wasBasalIOBUsed // Superbolus - binding.sbInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.superbolusInsulin) + binding.sbInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.superbolusInsulin) binding.sbCheckbox.isChecked = data.wasSuperbolusUsed // Carbs binding.carbs.text = rh.gs(R.string.format_carbs_ic, data.carbs, data.ic) - binding.carbsInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.carbsInsulin) + binding.carbsInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.carbsInsulin) // Correction - binding.correctionInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.otherCorrection) + binding.correctionInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.otherCorrection) // Profile binding.profile.text = data.profileName // Notes @@ -92,7 +92,7 @@ class WizardInfoDialog : DaggerDialogFragment() { // Percentage binding.percentUsed.text = rh.gs(info.nightscout.core.ui.R.string.format_percent, data.percentageCorrection) // Total - binding.totalInsulin.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, data.totalInsulin) + binding.totalInsulin.text = rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, data.totalInsulin) } override fun onStart() {