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..57f3351ac0 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 cannulaOrAge: 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) + cannulaOrAge = view.findViewById(R.id.cannula_or_pod) 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() + cannulaOrAge?.text = if (statusLightHandler.isOmnipod) rh.gs(R.string.omnipod_eros_name_short) else rh.gs(R.string.cannula) + val imageResource = if (statusLightHandler.isOmnipod) R.drawable.ic_pod_outline else R.drawable.ic_cp_age_cannula + cannulaOrAge?.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..ac12860fc6 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 isPod = statusLightHandler.isOmnipod + binding.statusLightsLayout.apply { + cannulaOrPod.setImageResource(if (isPod) R.drawable.ic_pod_outline else R.drawable.ic_cp_age_cannula) + cannulaOrPod.contentDescription = rh.gs(if (isPod) R.string.statuslights_pod_age else R.string.statuslights_cannula_age) + cannulaOrPod.scaleX = if (isPod) 1.4f else 2f + cannulaOrPod.scaleY = cannulaOrPod.scaleX + insulinAge.visibility = (!isPod).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..156fbf15b5 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) @@ -77,6 +72,8 @@ class StatusLightHandler @Inject constructor( } } + val isOmnipod: Boolean get() = activePlugin.activePump.model() == PumpType.OMNIPOD_EROS || activePlugin.activePump.model() == PumpType.OMNIPOD_DASH + private fun handleAge(view: TextView?, type: TherapyEvent.Type, @StringRes warnSettings: Int, defaultWarnThreshold: Double, @StringRes urgentSettings: Int, defaultUrgentThreshold: Double) { val warn = sp.getDouble(warnSettings, defaultWarnThreshold) val urgent = sp.getDouble(urgentSettings, defaultUrgentThreshold) diff --git a/app/src/main/res/drawable/ic_pod_outline.xml b/app/src/main/res/drawable/ic_pod_outline.xml new file mode 100644 index 0000000000..6e95a27545 --- /dev/null +++ b/app/src/main/res/drawable/ic_pod_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..d59a4e98e9 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..9c959b3cd7 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1133,6 +1133,8 @@ Errors Slow down uploads BG data status + cannula age + pod age Recalculated data used BG too close:\n%1$s\n%2$s last_processed_glunovo_timestamp