From fabbfd5f041d9689baa861dabc393b6289e15943 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 21 Jul 2024 21:17:10 +0200 Subject: [PATCH] Default snooze --- .../main/java/eu/faircode/email/FragmentDialogDuration.java | 2 ++ app/src/main/java/eu/faircode/email/ServiceUI.java | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogDuration.java b/app/src/main/java/eu/faircode/email/FragmentDialogDuration.java index acbb578d35..b1d5f955d0 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogDuration.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogDuration.java @@ -69,6 +69,8 @@ public class FragmentDialogDuration extends FragmentDialogBase { final Context context = getContext(); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); int default_snooze = prefs.getInt("default_snooze", 1); + if (default_snooze == 0) + default_snooze = 1; final View dview = LayoutInflater.from(context).inflate(R.layout.dialog_duration, null); final Button btn1hour = dview.findViewById(R.id.btn1hour); diff --git a/app/src/main/java/eu/faircode/email/ServiceUI.java b/app/src/main/java/eu/faircode/email/ServiceUI.java index 87dcf1ecc4..a4a803d087 100644 --- a/app/src/main/java/eu/faircode/email/ServiceUI.java +++ b/app/src/main/java/eu/faircode/email/ServiceUI.java @@ -439,9 +439,11 @@ public class ServiceUI extends IntentService { private void onSnooze(long id) { SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); - int notify_snooze_duration = prefs.getInt("default_snooze", 1); + int default_snooze = prefs.getInt("default_snooze", 1); + if (default_snooze == 0) + default_snooze = 1; - long wakeup = new Date().getTime() + notify_snooze_duration * 3600 * 1000L; + long wakeup = new Date().getTime() + default_snooze * 3600 * 1000L; DB db = DB.getInstance(this); try {