From 05c7f0f60d8c245b084b909c73339052984eef9f Mon Sep 17 00:00:00 2001 From: Jonas Haugesen Date: Fri, 11 Sep 2026 12:30:05 +0200 Subject: [PATCH] Show the next alarm 24 hours ahead, not 8 An alarm set for the next morning left the dynamic zone before it was visible: at 22:00 an alarm at 06:00 is eight hours away, so the part only appeared while the phone was unlikely to be looked at. The window is now 24 hours, and the setting summary says so (also in Danish; the other translations still say 8 and will follow upstream). Verified on the Titan 2 that Chrono (com.vicolo.chrono) registers its alarms the way this part reads them: dumpsys alarm lists them as "Alarm clock" entries with a showIntent pointing at Chrono, and AlarmManager.nextAlarmClock returns the earliest one, so ACTION_NEXT_ALARM_CLOCK_CHANGED keeps the part up to date. Tapping it opens Chrono as well - SHOW_ALARMS, SET_ALARM and SHOW_TIMERS all resolve to com.vicolo.chrono/.MainActivity. --- .../ui/launcher/widgets/clock/parts/AlarmPartProvider.kt | 7 ++++++- core/i18n/src/main/res/values-da/strings.xml | 2 +- core/i18n/src/main/res/values/strings.xml | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/clock/parts/AlarmPartProvider.kt b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/clock/parts/AlarmPartProvider.kt index 37214c7a2..f22eb47e8 100644 --- a/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/clock/parts/AlarmPartProvider.kt +++ b/app/ui/src/main/java/de/mm20/launcher2/ui/launcher/widgets/clock/parts/AlarmPartProvider.kt @@ -25,6 +25,11 @@ import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.channels.trySendBlocking import kotlinx.coroutines.flow.* +/** + * How far ahead the next alarm is shown. + */ +private const val AlarmWindow = 24 * 60 * 60 * 1000L + class AlarmPartProvider : PartProvider { private val nextAlarmTime = mutableStateOf(null) @@ -43,7 +48,7 @@ class AlarmPartProvider : PartProvider { send(0) } else { time.collectLatest { - if (alarm > it + 8 * 60 * 60 * 1000) { + if (alarm > it + AlarmWindow) { send(0) } else { send(60) diff --git a/core/i18n/src/main/res/values-da/strings.xml b/core/i18n/src/main/res/values-da/strings.xml index 3e72eccf1..415374780 100644 --- a/core/i18n/src/main/res/values-da/strings.xml +++ b/core/i18n/src/main/res/values-da/strings.xml @@ -415,7 +415,7 @@ Anvend form på alle ikoner, inklusive dem, der normalt ikke understøtter det Telegram-gruppe Licenseret under GNU General Public License 3.0 - Vis alarmer, der ringer inden for de næste 8 timer + Vis alarmer, der ringer inden for de næste 24 timer Vis fastgjorte og ofte brugte elementer over app-gitter Anvendelse: 1,5 kg eller 4 cm >> in Vis en knap for at omarrangere favoritterne diff --git a/core/i18n/src/main/res/values/strings.xml b/core/i18n/src/main/res/values/strings.xml index f00c1c09b..30a9b415f 100644 --- a/core/i18n/src/main/res/values/strings.xml +++ b/core/i18n/src/main/res/values/strings.xml @@ -612,7 +612,7 @@ Show when low or charging Off Alarms - Show alarms that will ring within the next 8 hours + Show alarms that will ring within the next 24 hours Events Show today\'s agenda all-day