diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt index 8b2be42563..111df21369 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/actions/ActionsFragment.kt @@ -107,6 +107,7 @@ class ActionsFragment : DaggerFragment() { private var sensorLevelLabel: TextView? = null private var insulinLevelLabel: TextView? = null private var pbLevelLabel: TextView? = null + private var cannulaOrPatch: TextView? = null override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, @@ -153,6 +154,7 @@ class ActionsFragment : DaggerFragment() { sensorLevelLabel = view.findViewById(R.id.sensor_level_label) insulinLevelLabel = view.findViewById(R.id.insulin_level_label) pbLevelLabel = view.findViewById(R.id.pb_level_label) + cannulaOrPatch = view.findViewById(R.id.cannula_or_patch) profileSwitch?.setOnClickListener { ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog") @@ -319,6 +321,10 @@ class ActionsFragment : DaggerFragment() { tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility() tddStats?.visibility = pump.pumpDescription.supportsTDDs.toVisibility() + cannulaOrPatch?.text = if (pump.pumpDescription.isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula) + val imageResource = if (pump.pumpDescription.isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula + cannulaOrPatch?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0) + if (!config.NSCLIENT) { statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel) sensorLevelLabel?.text = if (activeBgSource.sensorBatteryLevel == -1) "" else rh.gs(R.string.careportal_level_label) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt index 50ce24891a..d82e315359 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/OverviewFragment.kt @@ -823,7 +823,15 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList fun updateTime(from: String) { binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now()) // Status lights - binding.statusLightsLayout.statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility() + val isPatchPump = activePlugin.activePump.pumpDescription.isPatchPump + binding.statusLightsLayout.apply { + cannulaOrPatch.setImageResource(if (isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula) + cannulaOrPatch.contentDescription = rh.gs(if (isPatchPump) R.string.statuslights_patch_pump_age else R.string.statuslights_cannula_age) + cannulaOrPatch.scaleX = if (isPatchPump) 1.4f else 2f + cannulaOrPatch.scaleY = cannulaOrPatch.scaleX + insulinAge.visibility = isPatchPump.not().toVisibility() + statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility() + } statusLightHandler.updateStatusLights( binding.statusLightsLayout.cannulaAge, binding.statusLightsLayout.insulinAge, diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt index 61e632306b..ba73fab429 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt +++ b/app/src/main/java/info/nightscout/androidaps/plugins/general/overview/StatusLightHandler.kt @@ -40,12 +40,7 @@ class StatusLightHandler @Inject constructor( val pump = activePlugin.activePump val bgSource = activePlugin.activeBgSource handleAge(careportal_cannula_age, TherapyEvent.Type.CANNULA_CHANGE, R.string.key_statuslights_cage_warning, 48.0, R.string.key_statuslights_cage_critical, 72.0) - if (pump.model() == PumpType.OMNIPOD_EROS || pump.model() == PumpType.OMNIPOD_DASH) { - careportal_insulin_age?.visibility = View.GONE - } else { - careportal_insulin_age?.visibility = View.VISIBLE - handleAge(careportal_insulin_age, TherapyEvent.Type.INSULIN_CHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0) - } + handleAge(careportal_insulin_age, TherapyEvent.Type.INSULIN_CHANGE, R.string.key_statuslights_iage_warning, 72.0, R.string.key_statuslights_iage_critical, 144.0) handleAge(careportal_sensor_age, TherapyEvent.Type.SENSOR_CHANGE, R.string.key_statuslights_sage_warning, 216.0, R.string.key_statuslights_sage_critical, 240.0) if (pump.pumpDescription.isBatteryReplaceable || (pump is OmnipodErosPumpPlugin && pump.isUseRileyLinkBatteryLevel && pump.isBatteryChangeLoggingEnabled)) { handleAge(careportal_pb_age, TherapyEvent.Type.PUMP_BATTERY_CHANGE, R.string.key_statuslights_bage_warning, 216.0, R.string.key_statuslights_bage_critical, 240.0) diff --git a/app/src/main/res/drawable/ic_patch_pump_outline.xml b/app/src/main/res/drawable/ic_patch_pump_outline.xml new file mode 100644 index 0000000000..6e95a27545 --- /dev/null +++ b/app/src/main/res/drawable/ic_patch_pump_outline.xml @@ -0,0 +1,13 @@ + + + + + diff --git a/app/src/main/res/layout/careportal_stats_fragment.xml b/app/src/main/res/layout/careportal_stats_fragment.xml index b42553aa31..548396e9aa 100644 --- a/app/src/main/res/layout/careportal_stats_fragment.xml +++ b/app/src/main/res/layout/careportal_stats_fragment.xml @@ -161,6 +161,7 @@ android:layout_height="wrap_content"> + android:contentDescription="@string/statuslights_cannula_age" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a34eb64e49..0bbd58db3b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1133,6 +1133,9 @@ Errors Slow down uploads BG data status + cannula age + patch pump age + Patch pump Recalculated data used BG too close:\n%1$s\n%2$s last_processed_glunovo_timestamp diff --git a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt index 003d8f569e..6651791efa 100644 --- a/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt +++ b/core/src/main/java/info/nightscout/androidaps/interfaces/PumpDescription.kt @@ -38,6 +38,7 @@ class PumpDescription() { var supportsTDDs = false var needsManualTDDLoad = false var hasCustomUnreachableAlertCheck = false + var isPatchPump = false fun resetSettings() { isBolusCapable = true @@ -103,6 +104,7 @@ class PumpDescription() { needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad) is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min) hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck + isPatchPump = pumpType.isPatchPump } companion object { diff --git a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt index a36883adae..575fd2a536 100644 --- a/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt +++ b/core/src/main/java/info/nightscout/androidaps/plugins/pump/common/defs/PumpType.kt @@ -184,6 +184,7 @@ enum class PumpType { baseBasalSpecialSteps = null, pumpCapability = PumpCapability.OmnipodCapabilities, hasCustomUnreachableAlertCheck = true, + isPatchPump = true, source = Sources.OmnipodEros), OMNIPOD_DASH(description = "Omnipod Dash", manufacturer = ManufacturerType.Insulet, @@ -198,6 +199,7 @@ enum class PumpType { baseBasalMaxValue = null, baseBasalStep = 0.05, baseBasalSpecialSteps = null, + isPatchPump = true, pumpCapability = PumpCapability.OmnipodCapabilities, hasCustomUnreachableAlertCheck = false), MEDTRONIC_512_712(description = "Medtronic 512/712", @@ -352,6 +354,8 @@ enum class PumpType { private set var hasCustomUnreachableAlertCheck = false private set + var isPatchPump = false + private set private var parent: PumpType? = null val source: Sources @@ -419,6 +423,7 @@ enum class PumpType { baseBasalSpecialSteps: DoseStepSize? = null, pumpCapability: PumpCapability, hasCustomUnreachableAlertCheck: Boolean = false, + isPatchPump: Boolean = false, source: Sources = Sources.VirtualPump) { this.description = description this.manufacturer = manufacturer @@ -435,6 +440,7 @@ enum class PumpType { this.baseBasalSpecialSteps = baseBasalSpecialSteps this.pumpCapability = pumpCapability this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck + this.isPatchPump = isPatchPump this.source = source }