Added test beep button and made rileylink stats optional

This commit is contained in:
Artiom Kenibasov 2020-11-21 17:12:16 +01:00
parent 3aace47d57
commit 8dc75111d2
8 changed files with 112 additions and 22 deletions

View file

@ -309,6 +309,8 @@ public class OmnipodPumpPlugin extends PumpPluginBase implements PumpInterface,
event.isChanged(getResourceHelper(), R.string.key_omnipod_smb_beeps_enabled) || event.isChanged(getResourceHelper(), R.string.key_omnipod_smb_beeps_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_suspend_delivery_button_enabled) || 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_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_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_tbr_sound_enabled) ||
event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_smb_sound_enabled) || event.isChanged(getResourceHelper(), R.string.key_omnipod_notification_uncertain_smb_sound_enabled) ||

View file

@ -12,6 +12,7 @@ public class OmnipodStorageKeys {
public static final int TBR_BEEPS_ENABLED = R.string.key_omnipod_tbr_beeps_enabled; 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 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 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 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_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; public static final int EXPIRATION_REMINDER_HOURS_BEFORE_SHUTDOWN = R.string.key_omnipod_expiration_reminder_hours_before_shutdown;
@ -21,6 +22,7 @@ public class OmnipodStorageKeys {
public static final int NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_smb_sound_enabled; public static final int NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_smb_sound_enabled;
public static final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled; public static final int NOTIFICATION_UNCERTAIN_BOLUS_SOUND_ENABLED = R.string.key_omnipod_notification_uncertain_bolus_sound_enabled;
public static final int AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED = R.string.key_omnipod_automatically_acknowledge_alerts_enabled; public static final int AUTOMATICALLY_ACKNOWLEDGE_ALERTS_ENABLED = R.string.key_omnipod_automatically_acknowledge_alerts_enabled;
public static final int RILEYLINK_STATS_BUTTON_ENABLED = R.string.key_omnipod_rileylink_stats_button_enabled;
} }
public static class Statistics { public static class Statistics {

View file

@ -115,6 +115,8 @@ public class AapsOmnipodManager {
private boolean notificationUncertainSmbSoundEnabled; private boolean notificationUncertainSmbSoundEnabled;
private boolean notificationUncertainBolusSoundEnabled; private boolean notificationUncertainBolusSoundEnabled;
private boolean automaticallyAcknowledgeAlertsEnabled; private boolean automaticallyAcknowledgeAlertsEnabled;
private boolean testBeepButtonEnabled;
private boolean rileylinkStatsButtonEnabled;
@Inject @Inject
public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService, public AapsOmnipodManager(OmnipodRileyLinkCommunicationManager communicationService,
@ -156,6 +158,8 @@ public class AapsOmnipodManager {
tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TBR_BEEPS_ENABLED, true); tbrBeepsEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TBR_BEEPS_ENABLED, true);
suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false); suspendDeliveryButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.SUSPEND_DELIVERY_BUTTON_ENABLED, false);
pulseLogButtonEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.PULSE_LOG_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); timeChangeEventEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.TIME_CHANGE_EVENT_ENABLED, true);
notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true); notificationUncertainTbrSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_TBR_SOUND_ENABLED, true);
notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED, true); notificationUncertainSmbSoundEnabled = sp.getBoolean(OmnipodStorageKeys.Preferences.NOTIFICATION_UNCERTAIN_SMB_SOUND_ENABLED, true);
@ -629,6 +633,13 @@ public class AapsOmnipodManager {
return pulseLogButtonEnabled; return pulseLogButtonEnabled;
} }
public boolean isTestBeepButtonEnabled() {
return testBeepButtonEnabled; }
public boolean isRileylinkStatsButtonEnabled() {
return rileylinkStatsButtonEnabled;
}
public boolean isTimeChangeEventEnabled() { public boolean isTimeChangeEventEnabled() {
return timeChangeEventEnabled; return timeChangeEventEnabled;
} }

View file

@ -24,6 +24,7 @@ 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.OmnipodPumpPlugin
import info.nightscout.androidaps.plugins.pump.omnipod.R 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.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.OmnipodConstants
import info.nightscout.androidaps.plugins.pump.omnipod.driver.definition.PodProgressStatus 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.manager.PodStateManager
@ -119,6 +120,12 @@ class OmnipodOverviewFragment : DaggerFragment() {
DisplayResultDialogCallback(resourceHelper.gs(R.string.omnipod_error_failed_to_refresh_status), false)) 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_rileylink_stats.setOnClickListener { omnipod_overview_button_rileylink_stats.setOnClickListener {
if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) { if (omnipodPumpPlugin.rileyLinkService?.verifyConfiguration() == true) {
startActivity(Intent(context, RileyLinkStatusActivity::class.java)) startActivity(Intent(context, RileyLinkStatusActivity::class.java))
@ -448,8 +455,11 @@ class OmnipodOverviewFragment : DaggerFragment() {
updateSuspendDeliveryButton() updateSuspendDeliveryButton()
updateSetTimeButton() updateSetTimeButton()
updatePulseLogButton() updatePulseLogButton()
updateTestBeepButton()
updateRileylinkStatsButton()
} }
private fun disablePodActionButtons() { private fun disablePodActionButtons() {
omnipod_overview_button_acknowledge_active_alerts.isEnabled = false omnipod_overview_button_acknowledge_active_alerts.isEnabled = false
omnipod_overview_button_resume_delivery.isEnabled = false omnipod_overview_button_resume_delivery.isEnabled = false
@ -457,6 +467,7 @@ class OmnipodOverviewFragment : DaggerFragment() {
omnipod_overview_button_set_time.isEnabled = false omnipod_overview_button_set_time.isEnabled = false
omnipod_overview_button_refresh_status.isEnabled = false omnipod_overview_button_refresh_status.isEnabled = false
omnipod_overview_button_pulse_log.isEnabled = false omnipod_overview_button_pulse_log.isEnabled = false
omnipod_overview_button_test_beep.isEnabled = false
} }
private fun updateRefreshStatusButton() { private fun updateRefreshStatusButton() {
@ -510,6 +521,24 @@ class OmnipodOverviewFragment : DaggerFragment() {
} }
} }
private fun updateRileylinkStatsButton() {
if (omnipodManager.isRileylinkStatsButtonEnabled) {
omnipod_overview_button_rileylink_stats.visibility = View.VISIBLE
omnipod_overview_button_rileylink_stats.isEnabled = true
} else {
omnipod_overview_button_rileylink_stats.visibility = View.GONE
}
}
private fun updateTestBeepButton() {
if (omnipodManager.isTestBeepButtonEnabled) {
omnipod_overview_button_test_beep.visibility = View.VISIBLE
omnipod_overview_button_test_beep.isEnabled = podStateManager.isPodActivationCompleted && rileyLinkServiceData.rileyLinkServiceState.isReady && isQueueEmpty()
} else {
omnipod_overview_button_test_beep.visibility = View.GONE
}
}
private fun displayNotConfiguredDialog() { private fun displayNotConfiguredDialog() {
context?.let { context?.let {
UIRunnable(Runnable { UIRunnable(Runnable {

View file

@ -0,0 +1,14 @@
<vector
xmlns:android="http://schemas.android.com/apk/res/android"
android:height="48dp"
android:viewportHeight="75"
android:viewportWidth="75"
android:width="48dp"
>
<path android:fillColor="#4CAF50"
android:pathData="M39.389,13.769L22.235,28.606L6,28.606L6,47.699L21.989,47.699L39.389,62.75L39.389,13.769z"
android:strokeColor="#4CAF50" android:strokeLineJoin="round" android:strokeWidth="5"/>
<path android:fillColor="#00000000"
android:pathData="M48,27.6a19.5,19.5 0,0 1,0 21.4M55.1,20.5a30,30 0,0 1,0 35.6M61.6,14a38.8,38.8 0,0 1,0 48.6"
android:strokeColor="#4CAF50" android:strokeLineCap="round" android:strokeWidth="5"/>
</vector>

View file

@ -779,28 +779,6 @@
android:paddingRight="0dp" android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_acknowledge_active_alerts" /> android:text="@string/omnipod_overview_button_acknowledge_active_alerts" />
<Button
android:id="@+id/omnipod_overview_button_rileylink_stats"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_danarstats"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_riley_link_stats" />
<Button
android:id="@+id/omnipod_overview_button_pulse_log"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_cp_bolus_correction"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_read_pulse_log"
android:visibility="gone" />
<Button <Button
android:id="@+id/omnipod_overview_button_set_time" android:id="@+id/omnipod_overview_button_set_time"
@ -838,6 +816,42 @@
android:text="@string/omnipod_overview_button_suspend_delivery" android:text="@string/omnipod_overview_button_suspend_delivery"
android:visibility="gone" /> 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_speaker_icon"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_test_beep"
/>
<Button
android:id="@+id/omnipod_overview_button_pulse_log"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_cp_bolus_correction"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_read_pulse_log"
android:visibility="gone" />
<Button
android:id="@+id/omnipod_overview_button_rileylink_stats"
style="@style/ButtonSmallFontStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:drawableTop="@drawable/ic_danarstats"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="@string/omnipod_overview_button_riley_link_stats"
android:visibility="gone" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -257,6 +257,12 @@
<string name="omnipod_time_ago">%1$s ago</string> <string name="omnipod_time_ago">%1$s ago</string>
<string name="omnipod_cmd_beep_config">Beep config</string> <string name="omnipod_cmd_beep_config">Beep config</string>
<string name="omnipod_cmd_play_test_beep">Play test beep</string> <string name="omnipod_cmd_play_test_beep">Play test beep</string>
<string name="key_omnipod_test_beep_button_enabled">AAPS.Omnipod.test_beep_button_enabled</string>
<string name="omnipod_config_test_beep_button_enabled">Test beep button enabled</string>
<string name="omnipod_overview_button_test_beep">Test beep</string>
<string name="omnipod_config_rileylink_stats_button_enabled">RileyLink Stats button enabled</string>
<string name="key_omnipod_rileylink_stats_button_enabled">AAPS.Omnipod.rileylink_stats_button_enabled</string>
<string name="omnipod_error_failed_to_play_test_beep">Failed to play test beep</string>
<plurals name="omnipod_minutes"> <plurals name="omnipod_minutes">
<item quantity="one">%1$d minute</item> <item quantity="one">%1$d minute</item>
<item quantity="other">%1$d minutes</item> <item quantity="other">%1$d minutes</item>

View file

@ -105,16 +105,28 @@
android:key="@string/key_omnipod_suspend_delivery_button_enabled" android:key="@string/key_omnipod_suspend_delivery_button_enabled"
android:title="@string/omnipod_config_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 <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="@string/key_omnipod_pulse_log_button_enabled" android:key="@string/key_omnipod_pulse_log_button_enabled"
android:title="@string/omnipod_config_pulse_log_button_enabled" /> android:title="@string/omnipod_config_pulse_log_button_enabled" />
<SwitchPreference
android:defaultValue="false"
android:key="@string/key_omnipod_rileylink_stats_button_enabled"
android:title="@string/omnipod_config_rileylink_stats_button_enabled" />
<SwitchPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="@string/key_omnipod_time_change_event_enabled" android:key="@string/key_omnipod_time_change_event_enabled"
android:title="@string/omnipod_config_time_change_enabled" /> android:title="@string/omnipod_config_time_change_enabled" />
</PreferenceCategory> </PreferenceCategory>
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>