Add two more options for snooze

Fix #515.
pull/1020/head
Cédric L'homme 4 years ago committed by Alex Baker
parent 9b724ad2c5
commit 3952b90271

@ -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;

@ -350,6 +350,8 @@ File %1$s contained %2$s.\n\n
<string name="date_shortcut_night">Night</string>
<string name="date_shortcut_tomorrow_morning">Tomorrow morning</string>
<string name="date_shortcut_tomorrow_afternoon">Tomorrow afternoon</string>
<string name="date_shortcut_tomorrow_evening">Tomorrow evening</string>
<string name="date_shortcut_tomorrow_night">Tomorrow night</string>
<string name="date_shortcut_must_come_before">%1$s must come before %2$s</string>
<string name="date_shortcut_must_come_after">%1$s must come after %2$s</string>
<string name="discard_changes">Discard changes?</string>

Loading…
Cancel
Save