diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/MissedReadingActivity.java b/app/src/main/java/com/eveningoutpost/dexdrip/MissedReadingActivity.java index 9e88c4ef3b..6de08a58c8 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/MissedReadingActivity.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/MissedReadingActivity.java @@ -94,8 +94,7 @@ protected void onCreate(Bundle savedInstanceState) { endHour = AlertType.time2Hours(endMinutes); endMinute = AlertType.time2Minutes(endMinutes); bgMissedMinutes.setText(prefs.getString("bg_missed_minutes", "30")); - int defaultSnooze = MissedReadingService.readPerfsInt(prefs, "other_alerts_snooze", 20); - bgMissedSnoozeMin.setText(prefs.getString("bg_missed_alerts_snooze", "" + defaultSnooze)); + bgMissedSnoozeMin.setText("" + MissedReadingService.getOtherAlertSnoozeMinutes(prefs, "bg_missed_alerts")); bgMissedReraiseSec.setText(prefs.getString("bg_missed_alerts_reraise_sec", "60")); addListenerOnButtons(); diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/Services/MissedReadingService.java b/app/src/main/java/com/eveningoutpost/dexdrip/Services/MissedReadingService.java index f7004b2ea6..1a25b9f208 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/Services/MissedReadingService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/Services/MissedReadingService.java @@ -153,9 +153,14 @@ static public long getOtherAlertReraiseSec(Context context, String alertName) { if(enableAlertsReraise) { return readPerfsInt(prefs, alertName + "_reraise_sec", 60); } else { - int defaultSnooze = readPerfsInt(prefs, "other_alerts_snooze", 20); - return 60 * readPerfsInt(prefs, alertName + "_snooze", defaultSnooze); + return 60 * getOtherAlertSnoozeMinutes(prefs, alertName); } } + + static public long getOtherAlertSnoozeMinutes(SharedPreferences prefs, String alertName) { + int defaultSnooze = readPerfsInt(prefs, "other_alerts_snooze", 20); + return readPerfsInt(prefs, alertName + "_snooze", defaultSnooze); + } + } diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/Services/SnoozeOnNotificationDismissService.java b/app/src/main/java/com/eveningoutpost/dexdrip/Services/SnoozeOnNotificationDismissService.java index 4a492900c5..c2825b2c48 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/Services/SnoozeOnNotificationDismissService.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/Services/SnoozeOnNotificationDismissService.java @@ -73,7 +73,8 @@ private void snoozeBgAlert() { private void snoozeOtherAlert(String alertType) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); - int snoozeMinutes = MissedReadingService.readPerfsInt(prefs, "other_alerts_snooze", 20); + long snoozeMinutes = MissedReadingService.getOtherAlertSnoozeMinutes(prefs, alertType); + Log.i(TAG, "snoozeOtherAlert calling snooze alert alert = " + alertType + " snoozeMinutes = " + snoozeMinutes); UserNotification.snoozeAlert(alertType, snoozeMinutes); } }