Add isPatchPump to pump description for Omnipod

This commit is contained in:
Andries Smit 2022-02-09 09:06:31 +01:00
parent 58f418cd6c
commit f51df08c1f
9 changed files with 23 additions and 16 deletions

View file

@ -107,7 +107,7 @@ class ActionsFragment : DaggerFragment() {
private var sensorLevelLabel: TextView? = null private var sensorLevelLabel: TextView? = null
private var insulinLevelLabel: TextView? = null private var insulinLevelLabel: TextView? = null
private var pbLevelLabel: TextView? = null private var pbLevelLabel: TextView? = null
private var cannulaOrAge: TextView? = null private var cannulaOrPatch: TextView? = null
override fun onCreateView( override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?, inflater: LayoutInflater, container: ViewGroup?,
@ -154,7 +154,7 @@ class ActionsFragment : DaggerFragment() {
sensorLevelLabel = view.findViewById(R.id.sensor_level_label) sensorLevelLabel = view.findViewById(R.id.sensor_level_label)
insulinLevelLabel = view.findViewById(R.id.insulin_level_label) insulinLevelLabel = view.findViewById(R.id.insulin_level_label)
pbLevelLabel = view.findViewById(R.id.pb_level_label) pbLevelLabel = view.findViewById(R.id.pb_level_label)
cannulaOrAge = view.findViewById(R.id.cannula_or_pod) cannulaOrPatch = view.findViewById(R.id.cannula_or_patch)
profileSwitch?.setOnClickListener { profileSwitch?.setOnClickListener {
ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog") ProfileSwitchDialog().show(childFragmentManager, "ProfileSwitchDialog")
@ -321,9 +321,9 @@ class ActionsFragment : DaggerFragment() {
tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility() tempTarget?.visibility = (profile != null && !loop.isDisconnected).toVisibility()
tddStats?.visibility = pump.pumpDescription.supportsTDDs.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) cannulaOrPatch?.text = if (pump.pumpDescription.isPatchPump) rh.gs(R.string.patch_pump) else rh.gs(R.string.cannula)
val imageResource = if (statusLightHandler.isOmnipod) R.drawable.ic_pod_outline else R.drawable.ic_cp_age_cannula val imageResource = if (pump.pumpDescription.isPatchPump) R.drawable.ic_patch_pump_outline else R.drawable.ic_cp_age_cannula
cannulaOrAge?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0) cannulaOrPatch?.setCompoundDrawablesWithIntrinsicBounds(imageResource, 0, 0, 0)
if (!config.NSCLIENT) { if (!config.NSCLIENT) {
statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel) statusLightHandler.updateStatusLights(cannulaAge, insulinAge, reservoirLevel, sensorAge, sensorLevel, pbAge, batteryLevel)

View file

@ -823,13 +823,13 @@ class OverviewFragment : DaggerFragment(), View.OnClickListener, OnLongClickList
fun updateTime(from: String) { fun updateTime(from: String) {
binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now()) binding.infoLayout.time.text = dateUtil.timeString(dateUtil.now())
// Status lights // Status lights
val isPod = statusLightHandler.isOmnipod val isPatchPump = activePlugin.activePump.pumpDescription.isPatchPump
binding.statusLightsLayout.apply { binding.statusLightsLayout.apply {
cannulaOrPod.setImageResource(if (isPod) R.drawable.ic_pod_outline else R.drawable.ic_cp_age_cannula) cannulaOrPatch.setImageResource(if (isPatchPump) R.drawable.ic_patch_pump_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) cannulaOrPatch.contentDescription = rh.gs(if (isPatchPump) R.string.statuslights_patch_pump_age else R.string.statuslights_cannula_age)
cannulaOrPod.scaleX = if (isPod) 1.4f else 2f cannulaOrPatch.scaleX = if (isPatchPump) 1.4f else 2f
cannulaOrPod.scaleY = cannulaOrPod.scaleX cannulaOrPatch.scaleY = cannulaOrPatch.scaleX
insulinAge.visibility = (!isPod).toVisibility() insulinAge.visibility = (!isPatchPump).toVisibility()
statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility() statusLights.visibility = (sp.getBoolean(R.string.key_show_statuslights, true) || config.NSCLIENT).toVisibility()
} }
statusLightHandler.updateStatusLights( statusLightHandler.updateStatusLights(

View file

@ -72,8 +72,6 @@ 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) { 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 warn = sp.getDouble(warnSettings, defaultWarnThreshold)
val urgent = sp.getDouble(urgentSettings, defaultUrgentThreshold) val urgent = sp.getDouble(urgentSettings, defaultUrgentThreshold)

View file

@ -161,7 +161,7 @@
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<TextView <TextView
android:id="@+id/cannula_or_pod" android:id="@+id/cannula_or_patch"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="25dp" android:layout_height="25dp"
android:gravity="center_vertical" android:gravity="center_vertical"

View file

@ -12,7 +12,7 @@
android:paddingBottom="4dp"> android:paddingBottom="4dp">
<ImageView <ImageView
android:id="@+id/cannula_or_pod" android:id="@+id/cannula_or_patch"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_weight="1" android:layout_weight="1"

View file

@ -1134,7 +1134,8 @@
<string name="ns_sync_slow">Slow down uploads</string> <string name="ns_sync_slow">Slow down uploads</string>
<string name="data_status">BG data status</string> <string name="data_status">BG data status</string>
<string name="statuslights_cannula_age">cannula age</string> <string name="statuslights_cannula_age">cannula age</string>
<string name="statuslights_pod_age">pod age</string> <string name="statuslights_patch_pump_age">patch pump age</string>
<string name="patch_pump">Patch pump</string>
<string name="recalculated_data_used">Recalculated data used</string> <string name="recalculated_data_used">Recalculated data used</string>
<string name="bg_too_close">BG too close:\n%1$s\n%2$s</string> <string name="bg_too_close">BG too close:\n%1$s\n%2$s</string>
<string name="key_last_processed_glunovo_timestamp" translatable="false">last_processed_glunovo_timestamp</string> <string name="key_last_processed_glunovo_timestamp" translatable="false">last_processed_glunovo_timestamp</string>

View file

@ -38,6 +38,7 @@ class PumpDescription() {
var supportsTDDs = false var supportsTDDs = false
var needsManualTDDLoad = false var needsManualTDDLoad = false
var hasCustomUnreachableAlertCheck = false var hasCustomUnreachableAlertCheck = false
var isPatchPump = false
fun resetSettings() { fun resetSettings() {
isBolusCapable = true isBolusCapable = true
@ -103,6 +104,7 @@ class PumpDescription() {
needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad) needsManualTDDLoad = pumpCapability.hasCapability(PumpCapability.ManualTDDLoad)
is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min) is30minBasalRatesCapable = pumpCapability.hasCapability(PumpCapability.BasalRate30min)
hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck hasCustomUnreachableAlertCheck = pumpType.hasCustomUnreachableAlertCheck
isPatchPump = pumpType.isPatchPump
} }
companion object { companion object {

View file

@ -184,6 +184,7 @@ enum class PumpType {
baseBasalSpecialSteps = null, baseBasalSpecialSteps = null,
pumpCapability = PumpCapability.OmnipodCapabilities, pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = true, hasCustomUnreachableAlertCheck = true,
isPatchPump = true,
source = Sources.OmnipodEros), source = Sources.OmnipodEros),
OMNIPOD_DASH(description = "Omnipod Dash", OMNIPOD_DASH(description = "Omnipod Dash",
manufacturer = ManufacturerType.Insulet, manufacturer = ManufacturerType.Insulet,
@ -198,6 +199,7 @@ enum class PumpType {
baseBasalMaxValue = null, baseBasalMaxValue = null,
baseBasalStep = 0.05, baseBasalStep = 0.05,
baseBasalSpecialSteps = null, baseBasalSpecialSteps = null,
isPatchPump = true,
pumpCapability = PumpCapability.OmnipodCapabilities, pumpCapability = PumpCapability.OmnipodCapabilities,
hasCustomUnreachableAlertCheck = false), hasCustomUnreachableAlertCheck = false),
MEDTRONIC_512_712(description = "Medtronic 512/712", MEDTRONIC_512_712(description = "Medtronic 512/712",
@ -352,6 +354,8 @@ enum class PumpType {
private set private set
var hasCustomUnreachableAlertCheck = false var hasCustomUnreachableAlertCheck = false
private set private set
var isPatchPump = false
private set
private var parent: PumpType? = null private var parent: PumpType? = null
val source: Sources val source: Sources
@ -419,6 +423,7 @@ enum class PumpType {
baseBasalSpecialSteps: DoseStepSize? = null, baseBasalSpecialSteps: DoseStepSize? = null,
pumpCapability: PumpCapability, pumpCapability: PumpCapability,
hasCustomUnreachableAlertCheck: Boolean = false, hasCustomUnreachableAlertCheck: Boolean = false,
isPatchPump: Boolean = false,
source: Sources = Sources.VirtualPump) { source: Sources = Sources.VirtualPump) {
this.description = description this.description = description
this.manufacturer = manufacturer this.manufacturer = manufacturer
@ -435,6 +440,7 @@ enum class PumpType {
this.baseBasalSpecialSteps = baseBasalSpecialSteps this.baseBasalSpecialSteps = baseBasalSpecialSteps
this.pumpCapability = pumpCapability this.pumpCapability = pumpCapability
this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck this.hasCustomUnreachableAlertCheck = hasCustomUnreachableAlertCheck
this.isPatchPump = isPatchPump
this.source = source this.source = source
} }