From 274a94d1f3dd5aa60aafdea822fc8f596c6de599 Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Fri, 24 Sep 2021 23:41:47 +0200 Subject: [PATCH 1/3] expiry: color yellow 4h before expiration do not display lot number and unique id --- .../layout/omnipod_common_overview_pod_info.xml | 2 ++ .../omnipod/dash/ui/OmnipodDashOverviewFragment.kt | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/omnipod-common/src/main/res/layout/omnipod_common_overview_pod_info.xml b/omnipod-common/src/main/res/layout/omnipod_common_overview_pod_info.xml index 350b59a645..06e800f044 100644 --- a/omnipod-common/src/main/res/layout/omnipod_common_overview_pod_info.xml +++ b/omnipod-common/src/main/res/layout/omnipod_common_overview_pod_info.xml @@ -6,6 +6,7 @@ @@ -45,6 +46,7 @@ diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 34915dce52..d0267f0589 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -173,6 +173,8 @@ class OmnipodDashOverviewFragment : DaggerFragment() { bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE } + podInfoBinding.omnipodCommonOverviewLotNumberLayout.visibility = View.GONE + podInfoBinding.omnipodCommonOverviewPodUniqueIdLayout.visibility = View.GONE } override fun onResume() { @@ -333,10 +335,14 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } ?: PLACEHOLDER podInfoBinding.podExpiryDate.setTextColor( - if (expiresAt != null && ZonedDateTime.now().isAfter(expiresAt)) - Color.RED - else - Color.WHITE + when { + expiresAt != null && ZonedDateTime.now().isAfter(expiresAt) -> + Color.RED + expiresAt != null && ZonedDateTime.now().isAfter(expiresAt.minusHours(4)) -> + Color.YELLOW + else -> + Color.WHITE + } ) podStateManager.alarmType?.let { From e4e1af3829ece266ef2429b3af26d214d3e725ee Mon Sep 17 00:00:00 2001 From: Andrei Vereha Date: Sat, 25 Sep 2021 11:02:18 +0200 Subject: [PATCH 2/3] remove connection quality --- .../dash/ui/OmnipodDashOverviewFragment.kt | 16 -------- ...omnipod_dash_overview_bluetooth_status.xml | 40 ------------------- 2 files changed, 56 deletions(-) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index d0267f0589..60556e60da 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -171,7 +171,6 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } if (buildHelper.isEngineeringMode()) { bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE - bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE } podInfoBinding.omnipodCommonOverviewLotNumberLayout.visibility = View.GONE podInfoBinding.omnipodCommonOverviewPodUniqueIdLayout.visibility = View.GONE @@ -252,21 +251,6 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun updateBluetoothStatus() { bluetoothStatusBinding.omnipodDashBluetoothAddress.text = podStateManager.bluetoothAddress ?: PLACEHOLDER - - val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100 - val successPercentageString = String.format("%.2f %%", connectionSuccessPercentage) - val quality = - "${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString" - bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality - val connectionStatsColor = when { - connectionSuccessPercentage > 90 -> - Color.WHITE - connectionSuccessPercentage > 60 -> - Color.YELLOW - else -> - Color.RED - } - bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor) bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let { podStateManager.deliveryStatus.toString() } ?: PLACEHOLDER diff --git a/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml b/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml index 04822f68d3..23d31bbff5 100644 --- a/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml +++ b/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml @@ -77,46 +77,6 @@ tools:ignore="HardcodedText" /> - - - - - - - - - Date: Sat, 25 Sep 2021 13:08:20 +0200 Subject: [PATCH 3/3] Revert "remove connection quality" This reverts commit e4e1af3829ece266ef2429b3af26d214d3e725ee. --- .../dash/ui/OmnipodDashOverviewFragment.kt | 16 ++++++++ ...omnipod_dash_overview_bluetooth_status.xml | 40 +++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt index 60556e60da..d0267f0589 100644 --- a/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt +++ b/omnipod-dash/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/dash/ui/OmnipodDashOverviewFragment.kt @@ -171,6 +171,7 @@ class OmnipodDashOverviewFragment : DaggerFragment() { } if (buildHelper.isEngineeringMode()) { bluetoothStatusBinding.deliveryStatus.visibility = View.VISIBLE + bluetoothStatusBinding.connectionQuality.visibility = View.VISIBLE } podInfoBinding.omnipodCommonOverviewLotNumberLayout.visibility = View.GONE podInfoBinding.omnipodCommonOverviewPodUniqueIdLayout.visibility = View.GONE @@ -251,6 +252,21 @@ class OmnipodDashOverviewFragment : DaggerFragment() { private fun updateBluetoothStatus() { bluetoothStatusBinding.omnipodDashBluetoothAddress.text = podStateManager.bluetoothAddress ?: PLACEHOLDER + + val connectionSuccessPercentage = podStateManager.connectionSuccessRatio() * 100 + val successPercentageString = String.format("%.2f %%", connectionSuccessPercentage) + val quality = + "${podStateManager.successfulConnections}/${podStateManager.connectionAttempts} :: $successPercentageString" + bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.text = quality + val connectionStatsColor = when { + connectionSuccessPercentage > 90 -> + Color.WHITE + connectionSuccessPercentage > 60 -> + Color.YELLOW + else -> + Color.RED + } + bluetoothStatusBinding.omnipodDashBluetoothConnectionQuality.setTextColor(connectionStatsColor) bluetoothStatusBinding.omnipodDashDeliveryStatus.text = podStateManager.deliveryStatus?.let { podStateManager.deliveryStatus.toString() } ?: PLACEHOLDER diff --git a/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml b/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml index 23d31bbff5..04822f68d3 100644 --- a/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml +++ b/omnipod-dash/src/main/res/layout/omnipod_dash_overview_bluetooth_status.xml @@ -77,6 +77,46 @@ tools:ignore="HardcodedText" /> + + + + + + + + +