feat(alarms): say how long until an alarm rings when you set it

After a user action in the app sets an alarm, a snackbar says how long
until it rings: "Alarm set for 7 hours and 12 minutes from now". The row
already said "in 7h 12m", but nothing drew the eye to it, so an AM/PM or
wrong-day slip went unnoticed until the morning.

It is raised by switching an alarm on in the list, and in the editor by
picking a time (or keeping a new alarm's default one), arming or
disarming the skip, and changing the repeat days. Day taps wait a second
to settle, so Mon-Fri is one snackbar rather than five; a newer
countdown always replaces the one on screen. Switching the announced
alarm back off takes it back. A switched-off, ringing or snoozed alarm
says nothing, and the AlarmClock intents never reach it, since those
already get the status-bar icon.

AlarmSetCountdown decides what it says, purely, with the row's rounding;
the engine gains upcomingFor(), a read-only resolve of one alarm.

Fixes #19
This commit is contained in:
makiolaj committed 2026-10-21 18:51:49 +02:00
1 parent 3f431a7f32
commit 58c9bfebb1
13 files changed
+540 -8

No files matched your search

+16
View File
@@ -113,6 +113,22 @@
<string name="alarm_next_in_days_hours">in %1$dd %2$dh</string>
<string name="alarm_next_ringing">Ringing now</string>
<string name="alarm_next_snoozed">Snoozed \u00b7 %1$s</string>
<!-- #19: the snackbar after the user sets an alarm. %1$s is alarm_set_days/hours/minutes, or two of them joined by alarm_set_units_pair. -->
<string name="alarm_set_for">Alarm set for %1$s from now</string>
<string name="alarm_set_imminent">Alarm set for less than 1 minute from now</string>
<string name="alarm_set_units_pair">%1$s and %2$s</string>
<plurals name="alarm_set_days">
<item quantity="one">%1$d day</item>
<item quantity="other">%1$d days</item>
</plurals>
<plurals name="alarm_set_hours">
<item quantity="one">%1$d hour</item>
<item quantity="other">%1$d hours</item>
</plurals>
<plurals name="alarm_set_minutes">
<item quantity="one">%1$d minute</item>
<item quantity="other">%1$d minutes</item>
</plurals>
<string name="alarm_skipping_next">Skipping next</string>
<string name="alarm_repeat_once">Once</string>
<string name="alarm_repeat_every_day">Every day</string>