From 49d6eb561762c34ec866c4a80de4aa78526e6f72 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Sun, 22 Nov 2020 22:19:43 +0100 Subject: [PATCH] Only allow play test beep & pulse log when a Pod is paired and in the approriate state --- .../pump/omnipod/ui/PodManagementActivity.kt | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt index 8938765b52..058a033d85 100644 --- a/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt +++ b/omnipod/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/ui/PodManagementActivity.kt @@ -151,11 +151,16 @@ class PodManagementActivity : NoSplashAppCompatActivity() { omnipod_pod_management_button_activate_pod.isEnabled = !podStateManager.isPodActivationCompleted omnipod_pod_management_button_deactivate_pod.isEnabled = podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED) - if (commandQueue.isCustomCommandInQueue(CommandPlayTestBeep::class.java)) { - omnipod_pod_management_button_play_test_beep.isEnabled = false - omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_playing_test_beep) + if (podStateManager.isPodInitialized && podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED)) { + if (commandQueue.isCustomCommandInQueue(CommandPlayTestBeep::class.java)) { + omnipod_pod_management_button_play_test_beep.isEnabled = false + omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_playing_test_beep) + } else { + omnipod_pod_management_button_play_test_beep.isEnabled = true + omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_play_test_beep) + } } else { - omnipod_pod_management_button_play_test_beep.isEnabled = true + omnipod_pod_management_button_play_test_beep.isEnabled = false omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_play_test_beep) } @@ -163,18 +168,23 @@ class PodManagementActivity : NoSplashAppCompatActivity() { omnipod_pod_management_button_discard_pod.isEnabled = true } if (pulseLogButtonEnabled) { - if (commandQueue.isCustomCommandInQueue(CommandReadPulseLog::class.java)) { - omnipod_pod_management_button_pulse_log.isEnabled = false - omnipod_pod_management_button_pulse_log.setText(R.string.omnipod_pod_management_button_reading_pulse_log) + if (podStateManager.isPodActivationCompleted) { + if (commandQueue.isCustomCommandInQueue(CommandReadPulseLog::class.java)) { + omnipod_pod_management_button_pulse_log.isEnabled = false + omnipod_pod_management_button_pulse_log.setText(R.string.omnipod_pod_management_button_reading_pulse_log) + } else { + omnipod_pod_management_button_pulse_log.isEnabled = true + omnipod_pod_management_button_pulse_log.setText(R.string.omnipod_pod_management_button_read_pulse_log) + } } else { - omnipod_pod_management_button_pulse_log.isEnabled = true + omnipod_pod_management_button_pulse_log.isEnabled = false omnipod_pod_management_button_pulse_log.setText(R.string.omnipod_pod_management_button_read_pulse_log) } } } else { + omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_play_test_beep) omnipod_pod_management_button_activate_pod.isEnabled = false omnipod_pod_management_button_deactivate_pod.isEnabled = false - omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_play_test_beep) omnipod_pod_management_button_play_test_beep.isEnabled = false if (discardButtonEnabled) {