Only allow play test beep & pulse log when a Pod is paired and in the approriate state

This commit is contained in:
Bart Sopers 2020-11-22 22:19:43 +01:00
parent c681e19804
commit 49d6eb5617

View file

@ -151,6 +151,7 @@ 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 (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)
@ -158,11 +159,16 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
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 = false
omnipod_pod_management_button_play_test_beep.setText(R.string.omnipod_pod_management_button_play_test_beep)
}
if (discardButtonEnabled) {
omnipod_pod_management_button_discard_pod.isEnabled = true
}
if (pulseLogButtonEnabled) {
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)
@ -170,11 +176,15 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
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 = 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) {