Merge pull request #1264 from Andries-Smit/feat/status-light-icon
feat: show patch pump icon instead of cannula
This commit is contained in:
commit
fa2029b9ca
9 changed files with 47 additions and 12 deletions
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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_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)
|
||||
|
|
13
app/src/main/res/drawable/ic_patch_pump_outline.xml
Normal file
13
app/src/main/res/drawable/ic_patch_pump_outline.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="48dp"
|
||||
android:height="48dp"
|
||||
android:viewportWidth="80"
|
||||
android:viewportHeight="80">
|
||||
|
||||
<path
|
||||
android:fillAlpha="0.5"
|
||||
android:fillColor="#FFFFFF"
|
||||
android:pathData="M 18 54 a 3 3 0 0 0 3 3 L 45 57 A 19 19 0 0 0 62 40 A 19 19 0 0 0 45 24 L 21 24 a 3 3 0 0 0 -3 3 Z M 67 40 A 22 22 0 0 1 45 62 L 19 62 a 6 6 0 0 1 -6 -6 L 13 25 a 6 6 0 0 1 6 -6 L 45 19 A 22 22 0 0 1 67 40"
|
||||
android:strokeAlpha="0.5" />
|
||||
|
||||
</vector>
|
|
@ -161,6 +161,7 @@
|
|||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cannula_or_patch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="25dp"
|
||||
android:gravity="center_vertical"
|
||||
|
|
|
@ -12,15 +12,16 @@
|
|||
android:paddingBottom="4dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/cannula_or_patch"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:scaleType="centerInside"
|
||||
android:scaleX = "2"
|
||||
android:scaleY = "2"
|
||||
android:gravity="center_vertical"
|
||||
android:scaleType="centerInside"
|
||||
app:srcCompat="@drawable/ic_cp_age_cannula"
|
||||
android:contentDescription="@string/cannula" />
|
||||
android:contentDescription="@string/statuslights_cannula_age" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/cannula_age"
|
||||
|
@ -37,8 +38,8 @@
|
|||
android:layout_weight="1"
|
||||
android:gravity="center_vertical"
|
||||
android:scaleType="centerInside"
|
||||
android:scaleX="1.8"
|
||||
android:scaleY="1.8"
|
||||
android:scaleX="1.6"
|
||||
android:scaleY="1.6"
|
||||
app:srcCompat="@drawable/ic_cp_age_insulin"
|
||||
android:contentDescription="@string/insulin_label" />
|
||||
|
||||
|
|
|
@ -1133,6 +1133,9 @@
|
|||
<string name="errors">Errors</string>
|
||||
<string name="ns_sync_slow">Slow down uploads</string>
|
||||
<string name="data_status">BG data status</string>
|
||||
<string name="statuslights_cannula_age">cannula 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="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>
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue