Move Omnipod Test Beep button to Pod Management menu and make non optional

This commit is contained in:
Bart Sopers 2020-11-22 22:04:59 +01:00
parent 26c3b66e7c
commit c681e19804
9 changed files with 48 additions and 45 deletions

View file

@ -77,7 +77,6 @@ import info.nightscout.androidaps.plugins.pump.omnipod.driver.communication.mess
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertConfiguration;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.AlertSet;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager;
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.TimeUtil;
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodActiveAlertsChanged;
@ -318,7 +317,6 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
event.isChanged(getResourceHelper(), R.string.key_omnipod_suspend_delivery_button_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_pulse_log_button_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_rileylink_stats_button_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_test_beep_button_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_time_change_event_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_tbr_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_smb_sound_enabled) ||
@ -850,7 +848,7 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
case UPDATE_ALERT_CONFIGURATION:
return updateAlertConfiguration();
case PLAY_TEST_BEEP:
return executeCommand(OmnipodCommandType.PLAY_TEST_BEEP, () -> aapsOmnipodManager.playTestBeep(((CommandPlayTestBeep)command).getBeepType()));
return executeCommand(OmnipodCommandType.PLAY_TEST_BEEP, () -> aapsOmnipodManager.playTestBeep(((CommandPlayTestBeep) command).getBeepType()));
default:
aapsLogger.warn(LTag.PUMP, "Unknown custom command: " + commandType);
return new PumpEnactResult(getInjector()).success(false).enacted(false).comment(resourceHelper.gs(R.string.omnipod_error_unknown_custom_command, commandType));

View file

@ -12,7 +12,6 @@ public class OmnipodStorageKeys {
public static final int TBR_BEEPS_ENABLED = R.string.key_omnipod_tbr_beeps_enabled;
public static final int SUSPEND_DELIVERY_BUTTON_ENABLED = R.string.key_omnipod_suspend_delivery_button_enabled;
public static final int PULSE_LOG_BUTTON_ENABLED = R.string.key_omnipod_pulse_log_button_enabled;
public static final int TEST_BEEP_BUTTON_ENABLED = R.string.key_omnipod_test_beep_button_enabled;
public static final int TIME_CHANGE_EVENT_ENABLED = R.string.key_omnipod_time_change_event_enabled;
public static final int EXPIRATION_REMINDER_ENABLED = R.string.key_omnipod_expiration_reminder_enabled;
public static final int EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN = R.string.key_omnipod_expiration_reminder_hours_before_shutdown;

View file

@ -165,7 +165,6 @@ public class AapsOmnipodManager {
tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TBR_BEEPS_ENABLED, true);
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_BUTTON_ENABLED, false);
testBeepButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TEST_BEEP_BUTTON_ENABLED, true);
rileylinkStatsButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.RILEYLINK_STATS_BUTTON_ENABLED, false);
timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true);

View file

@ -23,14 +23,17 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.OmnipodConstants
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.driver.util.TimeUtil
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpValuesChanged
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.*
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandAcknowledgeAlerts
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandGetPodStatus
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandHandleTimeChange
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandResumeDelivery
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandSuspendDelivery
import info.nightscout.androidaps.plugins.pump.omnipod.util.AapsOmnipodUtil
import info.nightscout.androidaps.plugins.pump.omnipod.util.OmnipodAlertUtil
import info.nightscout.androidaps.queue.Callback
@ -119,12 +122,6 @@ class OmnipodOverviewFragment : DaggerFragment() {
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_error_failed_to_refresh_status), false))
}
omnipod_overview_button_test_beep.setOnClickListener {
disablePodActionButtons()
commandQueue.customCommand(CommandPlayTestBeep(BeepConfigType.BIP_BIP),
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_error_failed_to_play_test_beep), false))
}
omnipod_overview_button_acknowledge_active_alerts.setOnClickListener {
disablePodActionButtons()
commandQueue.customCommand(CommandAcknowledgeAlerts(),
@ -460,7 +457,6 @@ class OmnipodOverviewFragment : DaggerFragment() {
updateAcknowledgeAlertsButton()
updateSuspendDeliveryButton()
updateSetTimeButton()
updateTestBeepButton()
}
private fun disablePodActionButtons() {
@ -469,7 +465,6 @@ class OmnipodOverviewFragment : DaggerFragment() {
omnipod_overview_button_suspend_delivery.isEnabled = false
omnipod_overview_button_set_time.isEnabled = false
omnipod_overview_button_refresh_status.isEnabled = false
omnipod_overview_button_test_beep.isEnabled = false
}
private fun updateRefreshStatusButton() {
@ -514,17 +509,6 @@ class OmnipodOverviewFragment : DaggerFragment() {
}
}
private fun updateTestBeepButton() {
if (omnipodManager.isTestBeepButtonEnabled) {
omnipod_overview_button_test_beep.visibility = View.VISIBLE
omnipod_overview_button_test_beep.isEnabled = podStateManager.isPodInitialized &&
podStateManager.activationProgress.isAtLeast(ActivationProgress.PAIRING_COMPLETED) &&
rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
} else {
omnipod_overview_button_test_beep.visibility = View.GONE
}
}
private fun displayNotConfiguredDialog() {
context?.let {
UIRunnable(Runnable {

View file

@ -14,9 +14,11 @@ import info.nightscout.androidaps.plugins.pump.common.hw.rileylink.service.Riley
import info.nightscout.androidaps.plugins.pump.omnipod.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.R
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.ActivationProgress
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.BeepConfigType
import info.nightscout.androidaps.plugins.pump.omnipod.driver.manager.PodStateManager
import info.nightscout.androidaps.plugins.pump.omnipod.event.EventOmnipodPumpValuesChanged
import info.nightscout.androidaps.plugins.pump.omnipod.manager.AapsOmnipodManager
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandPlayTestBeep
import info.nightscout.androidaps.plugins.pump.omnipod.queue.command.CommandReadPulseLog
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.activation.PodActivationWizardActivity
import info.nightscout.androidaps.plugins.pump.omnipod.ui.wizard.deactivation.PodDeactivationWizardActivity
@ -78,6 +80,19 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
}
}
omnipod_pod_management_button_play_test_beep.setOnClickListener {
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)
commandQueue.customCommand(CommandPlayTestBeep(BeepConfigType.BEEEP), object : Callback() {
override fun run() {
if (!result.success) {
displayErrorDialog(resourceHelper.gs(R.string.omnipod_warning), resourceHelper.gs(R.string.omnipod_two_strings_concatenated_by_colon, resourceHelper.gs(R.string.omnipod_error_failed_to_play_test_beep), result.comment), false)
}
}
})
}
omnipod_pod_management_button_pulse_log.setOnClickListener {
omnipod_pod_management_button_pulse_log.isEnabled = false
omnipod_pod_management_button_pulse_log.setText(R.string.omnipod_pod_management_button_reading_pulse_log)
@ -135,6 +150,15 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
if (rileyLinkServiceData.rileyLinkServiceState.isReady) {
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)
} 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)
}
if (discardButtonEnabled) {
omnipod_pod_management_button_discard_pod.isEnabled = true
}
@ -150,6 +174,9 @@ class PodManagementActivity : NoSplashAppCompatActivity() {
} else {
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) {
omnipod_pod_management_button_discard_pod.isEnabled = false
}

View file

@ -810,17 +810,6 @@
android:text="@string/omnipod_overview_button_suspend_delivery"
android:visibility="gone" />
<Button
android:id="@+id/omnipod_overview_button_test_beep"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_play_test_beep"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_test_beep" />
</LinearLayout>
</LinearLayout>

View file

@ -92,6 +92,19 @@
android:text="@string/omnipod_pod_management_button_discard_pod"
android:textAllCaps="false" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/omnipod_pod_management_button_play_test_beep"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="40dp"
android:layout_marginTop="20dp"
android:layout_marginRight="40dp"
android:layout_weight="0.5"
android:drawableTop="@drawable/ic_play_test_beep"
android:text="@string/omnipod_pod_management_button_play_test_beep"
android:textAllCaps="false" />
<androidx.appcompat.widget.AppCompatButton
android:id="@+id/omnipod_pod_management_button_pulse_log"
style="?android:attr/buttonStyle"

View file

@ -10,7 +10,6 @@
<string name="key_omnipod_tbr_beeps_enabled" translatable="false">AAPS.Omnipod.tbr_beeps_enabled</string>
<string name="key_omnipod_suspend_delivery_button_enabled" translatable="false">AAPS.Omnipod.suspend_delivery_button_enabled</string>
<string name="key_omnipod_pulse_log_button_enabled" translatable="false">AAPS.Omnipod.pulse_log_button_enabled</string>
<string name="key_omnipod_test_beep_button_enabled" translatable="false">AAPS.Omnipod.test_beep_button_enabled</string>
<string name="key_omnipod_rileylink_stats_button_enabled" translatable="false">AAPS.Omnipod.rileylink_stats_button_enabled</string>
<string name="key_omnipod_time_change_event_enabled" translatable="false">AAPS.Omnipod.time_change_enabled</string>
<string name="key_omnipod_expiration_reminder_enabled" translatable="false">AAPS.Omnipod.expiration_reminder_enabled</string>
@ -43,7 +42,6 @@
<string name="omnipod_config_tbr_beeps_enabled">TBR beeps enabled</string>
<string name="omnipod_config_suspend_delivery_button_enabled">Show Suspend Delivery button in Omnipod tab</string>
<string name="omnipod_config_pulse_log_button_enabled">Show Pulse Log button in Pod Management menu</string>
<string name="omnipod_config_test_beep_button_enabled">Show Test Beep button in Omnipod tab</string>
<string name="omnipod_config_rileylink_stats_button_enabled">Show RileyLink Stats button in Pod Management menu</string>
<string name="omnipod_config_time_change_enabled">DST/Time zone detection enabled</string>
<string name="omnipod_config_expiration_reminder_enabled">Expiration reminder enabled</string>
@ -188,6 +186,8 @@
<string name="omnipod_pod_management_button_read_pulse_log">Read pulse log</string>
<string name="omnipod_pod_management_button_reading_pulse_log">Reading pulse log…</string>
<string name="omnipod_pod_management_discard_pod_confirmation">If you discard the Pod, you will not be able to communicate with it anymore. You should only do this when all communication with the Pod persistently fails. If you can still communicate with the Pod, please use the <b>Deactivate Pod</b> option.\n\nIf you wish to proceed, please make sure to remove the Pod from your body!</string>
<string name="omnipod_pod_management_button_play_test_beep">Play test beep</string>
<string name="omnipod_pod_management_button_playing_test_beep">Playing test beep…</string>
<!-- Omnipod - Wizard common -->
<string name="omnipod_wizard_button_cancel">Cancel</string>
@ -231,7 +231,6 @@
<string name="omnipod_overview_button_resume_delivery">Resume delivery</string>
<string name="omnipod_overview_button_pod_management">Pod mgmt</string>
<string name="omnipod_overview_button_acknowledge_active_alerts">Ack alerts</string>
<string name="omnipod_overview_button_test_beep">Test beep</string>
<string name="omnipod_overview_pod_status">Pod status</string>
<string name="omnipod_overview_total_delivered">Total delivered</string>
<string name="omnipod_overview_total_delivered_value">%1$.2f U</string>

View file

@ -105,11 +105,6 @@
android:key="@string/key_omnipod_suspend_delivery_button_enabled"
android:title="@string/omnipod_config_suspend_delivery_button_enabled" />
<SwitchPreference
android:defaultValue="true"
android:key="@string/key_omnipod_test_beep_button_enabled"
android:title="@string/omnipod_config_test_beep_button_enabled" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_omnipod_pulse_log_button_enabled"