From 181c7dfd858d8cd9dea97c7eec2676880f0a2603 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Sun, 8 Nov 2015 19:22:23 +0100 Subject: [PATCH] Add the option to mute notifications for one year. Fixes #4448. Closes #4454 --- res/values/arrays.xml | 1 + res/values/strings.xml | 1 + src/org/thoughtcrime/securesms/MuteDialog.java | 11 ++++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/res/values/arrays.xml b/res/values/arrays.xml index ae90315e22..dc00ef11c5 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -158,6 +158,7 @@ @string/arrays__mute_for_two_hours @string/arrays__mute_for_one_day @string/arrays__mute_for_seven_days + @string/arrays__mute_for_one_year diff --git a/res/values/strings.xml b/res/values/strings.xml index 016436928d..a7c6eacfc0 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -840,6 +840,7 @@ Mute for 2 hours Mute for 1 day Mute for 7 days + Mute for 1 year Settings default Enabled diff --git a/src/org/thoughtcrime/securesms/MuteDialog.java b/src/org/thoughtcrime/securesms/MuteDialog.java index 3f99bf0c96..7be80d13b6 100644 --- a/src/org/thoughtcrime/securesms/MuteDialog.java +++ b/src/org/thoughtcrime/securesms/MuteDialog.java @@ -21,11 +21,12 @@ public class MuteDialog extends AlertDialogWrapper { final long muteUntil; switch (which) { - case 0: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break; - case 1: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break; - case 2: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1); break; - case 3: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7); break; - default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break; + case 0: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break; + case 1: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(2); break; + case 2: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1); break; + case 3: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(7); break; + case 4: muteUntil = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(365); break; + default: muteUntil = System.currentTimeMillis() + TimeUnit.HOURS.toMillis(1); break; } listener.onMuted(muteUntil);