From 3952b902714edc4770ecd0f1eb6b704cac8d404a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20L=27homme?= Date: Wed, 10 Jun 2020 21:41:30 +0200 Subject: [PATCH] Add two more options for snooze Fix #515. --- .../org/tasks/reminders/SnoozeDialog.java | 21 ++++++++++++++++++- app/src/main/res/values/strings.xml | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/org/tasks/reminders/SnoozeDialog.java b/app/src/main/java/org/tasks/reminders/SnoozeDialog.java index 5358d403b..592a92289 100644 --- a/app/src/main/java/org/tasks/reminders/SnoozeDialog.java +++ b/app/src/main/java/org/tasks/reminders/SnoozeDialog.java @@ -35,6 +35,8 @@ public class SnoozeDialog extends InjectingDialogFragment { DateTime night = now.withMillisOfDay(preferences.getDateShortcutNight()); DateTime tomorrowMorning = morning.plusDays(1); DateTime tomorrowAfternoon = afternoon.plusDays(1); + DateTime tomorrowEvening = evening.plusDays(1); + DateTime tomorrowNight = night.plusDays(1); DateTime hourCutoff = new DateTime().plusMinutes(75); @@ -46,19 +48,34 @@ public class SnoozeDialog extends InjectingDialogFragment { if (morning.isAfter(hourCutoff)) { snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_morning, morning)); snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_afternoon, afternoon)); + snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_evening, evening)); + snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_night, night)); } else if (afternoon.isAfter(hourCutoff)) { snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_afternoon, afternoon)); snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_evening, evening)); + snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_night, night)); + snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_tomorrow_morning, tomorrowMorning)); } else if (evening.isAfter(hourCutoff)) { snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_evening, evening)); snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_night, night)); + snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_tomorrow_morning, tomorrowMorning)); + snoozeOptions.add( + new SnoozeOption(R.string.date_shortcut_tomorrow_afternoon, tomorrowAfternoon)); } else if (night.isAfter(hourCutoff)) { snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_night, night)); snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_tomorrow_morning, tomorrowMorning)); + snoozeOptions.add( + new SnoozeOption(R.string.date_shortcut_tomorrow_afternoon, tomorrowAfternoon)); + snoozeOptions.add( + new SnoozeOption(R.string.date_shortcut_tomorrow_evening, tomorrowEvening)); } else { snoozeOptions.add(new SnoozeOption(R.string.date_shortcut_tomorrow_morning, tomorrowMorning)); snoozeOptions.add( new SnoozeOption(R.string.date_shortcut_tomorrow_afternoon, tomorrowAfternoon)); + snoozeOptions.add( + new SnoozeOption(R.string.date_shortcut_tomorrow_evening, tomorrowEvening)); + snoozeOptions.add( + new SnoozeOption(R.string.date_shortcut_tomorrow_night, tomorrowNight)); } return snoozeOptions; @@ -88,9 +105,11 @@ public class SnoozeDialog extends InjectingDialogFragment { case 0: case 1: case 2: + case 3: + case 4: snoozeCallback.snoozeForTime(snoozeOptions.get(which).getDateTime()); break; - case 3: + case 5: dialog.dismiss(); snoozeCallback.pickDateTime(); break; diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ebe3b1adf..e2e3a700c 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -350,6 +350,8 @@ File %1$s contained %2$s.\n\n Night Tomorrow morning Tomorrow afternoon + Tomorrow evening + Tomorrow night %1$s must come before %2$s %1$s must come after %2$s Discard changes?