simply interfaces module

This commit is contained in:
Milos Kozak 2023-09-18 01:06:16 +02:00
parent af8f2d8124
commit caad075310
26 changed files with 93 additions and 93 deletions

View file

@ -1,8 +1,6 @@
package info.nightscout.interfaces.pump.defs package info.nightscout.interfaces.pump.defs
import info.nightscout.interfaces.R
import info.nightscout.interfaces.utils.Round import info.nightscout.interfaces.utils.Round
import info.nightscout.shared.interfaces.ResourceHelper
import kotlin.math.min import kotlin.math.min
@Suppress("unused") @Suppress("unused")
@ -447,7 +445,7 @@ enum class PumpType {
private set private set
var bolusSize = 0.0 var bolusSize = 0.0
get() = parent?.bolusSize ?: field get() = parent?.bolusSize ?: field
private var specialBolusSize: DoseStepSize? = null var specialBolusSize: DoseStepSize? = null
get() = parent?.specialBolusSize ?: field get() = parent?.specialBolusSize ?: field
var extendedBolusSettings: DoseSettings? = null var extendedBolusSettings: DoseSettings? = null
get() = parent?.extendedBolusSettings ?: field get() = parent?.extendedBolusSettings ?: field
@ -470,7 +468,7 @@ enum class PumpType {
var baseBasalStep = 1.0 var baseBasalStep = 1.0
get() = parent?.baseBasalStep ?: field get() = parent?.baseBasalStep ?: field
private set private set
private var baseBasalSpecialSteps: DoseStepSize? = null var baseBasalSpecialSteps: DoseStepSize? = null
get() = parent?.baseBasalSpecialSteps ?: field get() = parent?.baseBasalSpecialSteps ?: field
var pumpCapability: PumpCapability? = null var pumpCapability: PumpCapability? = null
get() = parent?.pumpCapability ?: field get() = parent?.pumpCapability ?: field
@ -570,29 +568,10 @@ enum class PumpType {
this.source = source this.source = source
} }
fun getFullDescription(i18nTemplate: String, hasExtendedBasals: Boolean, rh: ResourceHelper): String { fun baseBasalRange(): 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 =
if (baseBasalMaxValue == null) baseBasalMinValue.toString() if (baseBasalMaxValue == null) baseBasalMinValue.toString()
else baseBasalMinValue.toString() + "-" + baseBasalMaxValue.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 hasExtendedBasals(): Boolean = baseBasalSpecialSteps != null || specialBolusSize != null
fun determineCorrectBolusSize(bolusAmount: Double): Double = fun determineCorrectBolusSize(bolusAmount: Double): Double =

View file

@ -12,14 +12,7 @@
<string name="metadata_format_debug">New debug format (unencrypted)</string> <string name="metadata_format_debug">New debug format (unencrypted)</string>
<string name="metadata_format_other">Unknown export format</string> <string name="metadata_format_other">Unknown export format</string>
<!-- PumpType-->
<string name="def_extended_note">* Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump.</string>
<!-- PumpPluginBase --> <!-- PumpPluginBase -->
<string name="pump_driver_changed" comment="26 characters max for translation">Pump driver changed.</string> <string name="pump_driver_changed" comment="26 characters max for translation">Pump driver changed.</string>
<!-- DecimalFormatter-->
<string name="format_insulin_units1">%1$.1f U</string>
<string name="format_insulin_units">%1$.2f U</string>
</resources> </resources>

View file

@ -321,7 +321,7 @@ class BolusWizard @Inject constructor(
if (insulinAfterConstraints > 0) { if (insulinAfterConstraints > 0) {
val pct = if (percentageCorrection != 100) " ($percentageCorrection%)" else "" val pct = if (percentageCorrection != 100) " ($percentageCorrection%)" else ""
actions.add( 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 (context, rh, info.nightscout.core.ui.R.attr.bolusColor) + pct
) )
} }

View file

@ -648,5 +648,8 @@
<string name="saturday_short">S</string> <string name="saturday_short">S</string>
<string name="sunday_short">S</string> <string name="sunday_short">S</string>
<!-- DecimalFormatterImpl -->
<string name="format_insulin_units1">%1$.1f U</string>
<string name="format_insulin_units">%1$.2f U</string>
</resources> </resources>

View file

@ -245,12 +245,12 @@ class OverviewDataImpl @Inject constructor(
} }
override fun iobText(iobCobCalculator: IobCobCalculator): String = 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 = 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.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.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.interfaces.R.string.format_insulin_units, basalIob(iobCobCalculator).basaliob) 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 * TEMP TARGET

View file

@ -38,7 +38,7 @@ class CommandBolus(
} }
override fun log(): String { 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 "" if (detailedBolusInfo.carbs > 0) "CARBS " + rh.gs(info.nightscout.core.main.R.string.format_carbs, detailedBolusInfo.carbs.toInt()) else ""
} }

View file

@ -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 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() { override fun cancel() {
aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel") aapsLogger.debug(LTag.PUMPQUEUE, "Result cancel")
callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run() callback?.result(PumpEnactResult(injector).success(false).comment(info.nightscout.core.ui.R.string.connectiontimedout))?.run()

View file

@ -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.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)
row.gravity = Gravity.CENTER_HORIZONTAL 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 = 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 = 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.interfaces.R.string.format_insulin_units1, bolusAmount) }) 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.interfaces.R.string.format_insulin_units1, basalAmount) }) 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) }) 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) 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 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.layoutParams = TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.WRAP_CONTENT)
row.gravity = Gravity.CENTER_HORIZONTAL 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 = 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 = 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.interfaces.R.string.format_insulin_units1, bolusAmount) }) 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.interfaces.R.string.format_insulin_units1, basalAmount) }) 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) }) 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) 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 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

View file

@ -27,7 +27,7 @@ class DecimalFormatterImpl @Inject constructor(
override fun to3Decimal(value: Double, unit: String): String = format3dec.format(value) + unit 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 toPumpSupportedBolus(value: Double, bolusStep: Double): String = if (bolusStep <= 0.051) to2Decimal(value) else to1Decimal(value)
override fun toPumpSupportedBolusWithUnits(value: Double, bolusStep: Double): String = 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") override fun pumpSupportedBolusFormat(bolusStep: Double): DecimalFormat = if (bolusStep <= 0.051) DecimalFormat("0.00") else DecimalFormat("0.0")
} }

View file

@ -150,7 +150,7 @@ class CommandQueueImplementationTest : TestBaseWithProfile() {
val percentageConstraint = Constraint(0) val percentageConstraint = Constraint(0)
`when`(constraintChecker.applyBasalPercentConstraints(anyObject(), anyObject())).thenReturn(percentageConstraint) `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.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") `when`(rh.gs(info.nightscout.core.ui.R.string.goingtodeliver)).thenReturn("Going to deliver %1\$.2f U")
} }

View file

@ -544,7 +544,7 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
binding.buttonsLayout.quickWizardButton.visibility = View.VISIBLE binding.buttonsLayout.quickWizardButton.visibility = View.VISIBLE
val wizard = quickWizardEntry.doCalc(profile, profileName, lastBG) 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()) + 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 if (wizard.calculatedTotalInsulin <= 0) binding.buttonsLayout.quickWizardButton.visibility = View.GONE
} else binding.buttonsLayout.quickWizardButton.visibility = View.GONE } else binding.buttonsLayout.quickWizardButton.visibility = View.GONE
} }

View file

@ -215,7 +215,7 @@ class DanaFragment : DaggerFragment() {
val agoHours = agoMilliseconds.toDouble() / 60.0 / 60.0 / 1000.0 val agoHours = agoMilliseconds.toDouble() / 60.0 / 60.0 / 1000.0
if (agoHours < 6) if (agoHours < 6)
// max 6h back // 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 else
binding.lastBolus.text = "" binding.lastBolus.text = ""
} }

View file

@ -179,9 +179,9 @@ class DanaHistoryActivity : TranslatedDaggerAppCompatActivity() {
} }
RecordTypes.RECORD_TYPE_DAILY -> { RecordTypes.RECORD_TYPE_DAILY -> {
holder.binding.dailyBasal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, 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.interfaces.R.string.format_insulin_units, record.dailyBolus) 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.interfaces.R.string.format_insulin_units, record.dailyBolus + record.dailyBasal) 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.text = dateUtil.dateString(record.timestamp)
holder.binding.time.visibility = View.VISIBLE holder.binding.time.visibility = View.VISIBLE
holder.binding.value.visibility = View.GONE holder.binding.value.visibility = View.GONE

View file

@ -168,7 +168,7 @@ class DiaconnG8Fragment : DaggerFragment() {
val agoHours = agoMsec.toDouble() / 60.0 / 60.0 / 1000.0 val agoHours = agoMsec.toDouble() / 60.0 / 60.0 / 1000.0
if (agoHours < 6) if (agoHours < 6)
// max 6h back // 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 else
binding.lastbolus.text = "" binding.lastbolus.text = ""
} }

View file

@ -158,9 +158,9 @@ class DiaconnG8HistoryActivity : TranslatedDaggerAppCompatActivity() {
} }
RecordTypes.RECORD_TYPE_DAILY -> { RecordTypes.RECORD_TYPE_DAILY -> {
holder.dailyBasal.text = rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, 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.interfaces.R.string.format_insulin_units, record.dailyBolus) holder.dailyBolus.text = rh.gs(info.nightscout.core.ui.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.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.text = dateUtil.dateString(record.timestamp)
holder.time.visibility = View.VISIBLE holder.time.visibility = View.VISIBLE
holder.value.visibility = View.GONE holder.value.visibility = View.GONE

View file

@ -131,8 +131,8 @@ class MedtrumOverviewViewModel @Inject constructor(
if (!medtrumPump.bolusDone && medtrumPlugin.isInitialized()) { if (!medtrumPump.bolusDone && medtrumPlugin.isInitialized()) {
_activeBolusStatus.postValue( _activeBolusStatus.postValue(
dateUtil.timeString(medtrumPump.bolusStartTime) + " " + dateUtil.sinceString(medtrumPump.bolusStartTime, rh) dateUtil.timeString(medtrumPump.bolusStartTime) + " " + dateUtil.sinceString(medtrumPump.bolusStartTime, rh)
+ " " + rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, bolusAmount) + " / " + rh.gs( + " " + rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, bolusAmount) + " / " + rh.gs(
info.nightscout.interfaces.R.string.format_insulin_units, medtrumPump.bolusAmountToBeDelivered info.nightscout.core.ui.R.string.format_insulin_units, medtrumPump.bolusAmountToBeDelivered
) )
) )
} }
@ -186,7 +186,7 @@ class MedtrumOverviewViewModel @Inject constructor(
// max 6h back // max 6h back
_lastBolus.postValue( _lastBolus.postValue(
dateUtil.timeString(medtrumPump.lastBolusTime) + " " + dateUtil.sinceString(medtrumPump.lastBolusTime, rh) + " " + rh.gs( 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("") else _lastBolus.postValue("")

View file

@ -11,6 +11,9 @@ import info.nightscout.core.extensions.toStringFull
import info.nightscout.core.utils.fabric.FabricPrivacy import info.nightscout.core.utils.fabric.FabricPrivacy
import info.nightscout.interfaces.iob.IobCobCalculator import info.nightscout.interfaces.iob.IobCobCalculator
import info.nightscout.interfaces.profile.ProfileFunction 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.interfaces.utils.DecimalFormatter
import info.nightscout.pump.virtual.databinding.VirtualPumpFragmentBinding import info.nightscout.pump.virtual.databinding.VirtualPumpFragmentBinding
import info.nightscout.pump.virtual.events.EventVirtualPumpUpdateGui 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.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.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() virtualPumpPlugin.refreshConfiguration()
val pumpType = virtualPumpPlugin.pumpType 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.typeDef.text = pumpType?.getFullDescription(rh.gs(R.string.virtual_pump_pump_def), pumpType.hasExtendedBasals(), rh)
binding.serialNumber.text = virtualPumpPlugin.serialNumber() 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
)
}
} }

View file

@ -10,4 +10,7 @@
<string name="virtual_pump_label">VIRTUAL PUMP</string> <string name="virtual_pump_label">VIRTUAL PUMP</string>
<string name="virtualpump_settings">Virtual pump settings</string> <string name="virtualpump_settings">Virtual pump settings</string>
<!-- PumpType-->
<string name="def_extended_note">* Only discrete values no ranges are supported as granularity for basal/bolus in virtual pump.</string>
</resources> </resources>

View file

@ -313,17 +313,17 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() {
}) })
tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL -> tr.addView(TextView(this@TDDStatsActivity).also { labelBASAL ->
labelBASAL.id = 300 + i 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)) labelBASAL.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor))
}) })
tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS -> tr.addView(TextView(this@TDDStatsActivity).also { labelBOLUS ->
labelBOLUS.id = 400 + i 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)) labelBOLUS.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor))
}) })
tr.addView(TextView(this@TDDStatsActivity).also { labelTDD -> tr.addView(TextView(this@TDDStatsActivity).also { labelTDD ->
labelTDD.id = 500 + i 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)) labelTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor))
}) })
tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO -> tr.addView(TextView(this@TDDStatsActivity).also { labelRATIO ->
@ -361,7 +361,7 @@ class TDDStatsActivity : TranslatedDaggerAppCompatActivity() {
ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD -> ctr.addView(TextView(this@TDDStatsActivity).also { labelCUMTDD ->
labelCUMTDD.id = 900 + i 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)) 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 -> etr.addView(TextView(this@TDDStatsActivity).also { labelEXPTDD ->
labelEXPTDD.id = 1300 + i labelEXPTDD.id = 1300 + i
labelEXPTDD.text = """ labelEXPTDD.text = """
${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, weighted03)} ${rh.gs(info.nightscout.core.ui.R.string.format_insulin_units, weighted03)}
${rh.gs(info.nightscout.interfaces.R.string.format_insulin_units, weighted05)} ${rh.gs(info.nightscout.core.ui.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, weighted07)}
""".trimIndent() """.trimIndent()
labelEXPTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor)) labelEXPTDD.setTextColor(rh.gac(this, info.nightscout.core.ui.R.attr.defaultTextColor))
}) })

View file

@ -218,18 +218,18 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
holder.binding.bolusLayout.visibility = (ml.bolus != null && (ml.bolus.isValid || showInvalidated)).toVisibility() holder.binding.bolusLayout.visibility = (ml.bolus != null && (ml.bolus.isValid || showInvalidated)).toVisibility()
ml.bolus?.let { bolus -> ml.bolus?.let { bolus ->
holder.binding.bolusTime.text = dateUtil.timeString(bolus.timestamp) 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.bolusNs.visibility = (bolus.interfaceIDs.nightscoutId != null).toVisibility()
holder.binding.bolusPump.visibility = bolus.interfaceIDs.isPumpHistory().toVisibility() holder.binding.bolusPump.visibility = bolus.interfaceIDs.isPumpHistory().toVisibility()
holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility() holder.binding.bolusInvalid.visibility = bolus.isValid.not().toVisibility()
val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia) val iob = bolus.iobCalc(activePlugin, System.currentTimeMillis(), profile.dia)
if (iob.iobContrib > 0.01) { if (iob.iobContrib > 0.01) {
holder.binding.iob.setTextColor(rh.gac(context, info.nightscout.core.ui.R.attr.activeColor)) 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.iobLabel.visibility = View.VISIBLE
holder.binding.iob.visibility = View.VISIBLE holder.binding.iob.visibility = View.VISIBLE
} else { } 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.iob.setTextColor(holder.binding.insulin.currentTextColor)
holder.binding.iobLabel.visibility = View.GONE holder.binding.iobLabel.visibility = View.GONE
holder.binding.iob.visibility = View.GONE holder.binding.iob.visibility = View.GONE
@ -438,7 +438,7 @@ class TreatmentsBolusCarbsFragment : DaggerFragment(), MenuProvider {
val mealLink = selectedItems.valueAt(0) val mealLink = selectedItems.valueAt(0)
val bolus = mealLink.bolus val bolus = mealLink.bolus
if (bolus != null) 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) rh.gs(info.nightscout.core.ui.R.string.date) + ": " + dateUtil.dateAndTimeString(bolus.timestamp)
val carbs = mealLink.carbs val carbs = mealLink.carbs
if (carbs != null) if (carbs != null)

View file

@ -154,9 +154,9 @@ class TreatmentsExtendedBolusesFragment : DaggerFragment(), MenuProvider {
} }
val profile = profileFunction.getProfile(extendedBolus.timestamp) ?: return 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.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) 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) 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) 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() holder.binding.cbRemove.visibility = (extendedBolus.isValid && actionHelper.isRemoving).toVisibility()

View file

@ -196,7 +196,7 @@ class TreatmentsTemporaryBasalsFragment : DaggerFragment(), MenuProvider {
var iob = IobTotal(now) var iob = IobTotal(now)
val profile = profileFunction.getProfile(now) val profile = profileFunction.getProfile(now)
if (profile != null) iob = tempBasal.iobCalc(now, profile, activePlugin.activeInsulin) 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.extendedFlag.visibility = (tempBasal.type == TemporaryBasal.Type.FAKE_EXTENDED).toVisibility()
holder.binding.suspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.PUMP_SUSPEND).toVisibility() holder.binding.suspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.PUMP_SUSPEND).toVisibility()
holder.binding.emulatedSuspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.EMULATED_PUMP_SUSPEND).toVisibility() holder.binding.emulatedSuspendFlag.visibility = (tempBasal.type == TemporaryBasal.Type.EMULATED_PUMP_SUSPEND).toVisibility()

View file

@ -95,7 +95,7 @@ class ExtendedBolusDialog : DialogFragmentWithDate() {
val durationInMinutes = binding.duration.value.toInt() val durationInMinutes = binding.duration.value.toInt()
val actions: LinkedList<String> = LinkedList() val actions: LinkedList<String> = LinkedList()
val insulinAfterConstraint = constraintChecker.applyExtendedBolusConstraints(Constraint(insulin)).value() 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)) 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) 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)) actions.add(rh.gs(info.nightscout.core.ui.R.string.constraint_applied).formatColor(context, rh, info.nightscout.core.ui.R.attr.warningColor))

View file

@ -165,7 +165,7 @@ class ProfileViewerDialog : DaggerDialogFragment() {
binding.date.text = date binding.date.text = date
binding.ic.text = it.getIcList(rh, dateUtil) binding.ic.text = it.getIcList(rh, dateUtil)
binding.isf.text = it.getIsfList(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.target.text = it.getTargetList(rh, dateUtil)
binding.basalGraph.show(it) binding.basalGraph.show(it)
binding.isfGraph.show(it) binding.isfGraph.show(it)

View file

@ -407,7 +407,7 @@ class WizardDialog : DaggerDialogFragment() {
binding.ttCheckbox.isEnabled = tempTarget is ValueWrapper.Existing binding.ttCheckbox.isEnabled = tempTarget is ValueWrapper.Existing
binding.ttCheckboxIcon.visibility = binding.ttCheckbox.isEnabled.toVisibility() 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() calculateInsulin()
} }
@ -482,18 +482,18 @@ class WizardDialog : DaggerDialogFragment() {
wizard?.let { wizard -> 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.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.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 // Superbolus
binding.sb.text = if (binding.sbCheckbox.isChecked) rh.gs(R.string.two_hours) else "" 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 // Trend
if (binding.bgTrendCheckbox.isChecked && wizard.glucoseStatus != null) { if (binding.bgTrendCheckbox.isChecked && wizard.glucoseStatus != null) {
@ -503,19 +503,19 @@ class WizardDialog : DaggerDialogFragment() {
} else { } else {
binding.bgTrend.text = "" 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 // COB
if (binding.cobCheckbox.isChecked) { if (binding.cobCheckbox.isChecked) {
binding.cob.text = rh.gs(R.string.format_cob_ic, cob, wizard.ic) 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 { } else {
binding.cob.text = "" binding.cob.text = ""
binding.cobInsulin.text = "" binding.cobInsulin.text = ""
} }
if (wizard.calculatedTotalInsulin > 0.0 || carbsAfterConstraint > 0.0) { 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 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 "" .carbsColor) else ""
binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.result_insulin_carbs, insulinText, carbsText)) binding.total.text = HtmlHelper.fromHtml(rh.gs(R.string.result_insulin_carbs, insulinText, carbsText))

View file

@ -60,31 +60,31 @@ class WizardInfoDialog : DaggerDialogFragment() {
val trend = profileUtil.fromMgdlToStringInUnits(data.glucoseTrend * 3) val trend = profileUtil.fromMgdlToStringInUnits(data.glucoseTrend * 3)
// BG // BG
binding.bg.text = rh.gs(R.string.format_bg_isf, bgString, isf) 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.bgCheckbox.isChecked = data.wasGlucoseUsed
binding.ttCheckbox.isChecked = data.wasTempTargetUsed binding.ttCheckbox.isChecked = data.wasTempTargetUsed
// Trend // Trend
binding.bgTrend.text = 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 binding.bgTrendCheckbox.isChecked = data.wasTrendUsed
// COB // COB
binding.cob.text = rh.gs(R.string.format_cob_ic, data.cob, data.ic) 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 binding.cobCheckbox.isChecked = data.wasCOBUsed
// Bolus IOB // 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 binding.bolusIobCheckbox.isChecked = data.wasBolusIOBUsed
// Basal IOB // 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 binding.basalIobCheckbox.isChecked = data.wasBasalIOBUsed
// Superbolus // 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 binding.sbCheckbox.isChecked = data.wasSuperbolusUsed
// Carbs // Carbs
binding.carbs.text = rh.gs(R.string.format_carbs_ic, data.carbs, data.ic) 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 // 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 // Profile
binding.profile.text = data.profileName binding.profile.text = data.profileName
// Notes // Notes
@ -92,7 +92,7 @@ class WizardInfoDialog : DaggerDialogFragment() {
// Percentage // Percentage
binding.percentUsed.text = rh.gs(info.nightscout.core.ui.R.string.format_percent, data.percentageCorrection) binding.percentUsed.text = rh.gs(info.nightscout.core.ui.R.string.format_percent, data.percentageCorrection)
// Total // 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() { override fun onStart() {