From 4662aee90d950839a970dd76e8aa661efeab0d78 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Sat, 12 Sep 2026 14:43:46 +0200 Subject: [PATCH] refactor(ui): move the alarm time formatter where both screens can reach it The ring screen wrote it first; the alarms list needs the same 12/24-hour rendering. Moved rather than copied. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Wmy1BpCKi8KeSjaWhYuCPV --- .../TimeFormatting.kt => common/AlarmTimeFormatter.kt} | 8 ++++++-- .../java/de/jeanlucmakiola/clockula/ui/ring/RingScreen.kt | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) rename app/src/main/java/de/jeanlucmakiola/clockula/ui/{ring/TimeFormatting.kt => common/AlarmTimeFormatter.kt} (82%) diff --git a/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/TimeFormatting.kt b/app/src/main/java/de/jeanlucmakiola/clockula/ui/common/AlarmTimeFormatter.kt similarity index 82% rename from app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/TimeFormatting.kt rename to app/src/main/java/de/jeanlucmakiola/clockula/ui/common/AlarmTimeFormatter.kt index 6f59c4e..263056f 100644 --- a/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/TimeFormatting.kt +++ b/app/src/main/java/de/jeanlucmakiola/clockula/ui/common/AlarmTimeFormatter.kt @@ -1,4 +1,4 @@ -package de.jeanlucmakiola.clockula.ui.ring +package de.jeanlucmakiola.clockula.ui.common import android.text.format.DateFormat import androidx.compose.runtime.Composable @@ -10,7 +10,11 @@ import java.time.LocalTime import java.time.format.DateTimeFormatter import java.time.format.FormatStyle -/** Honours the user's 12/24-hour setting. Deliberately not unit-tested: it is one platform call. */ +/** + * Honours the user's 12/24-hour setting. Deliberately not unit-tested: it is + * one platform call. Shared by the ring screen, the alarm list and the editor, + * so all three read a time the same way (M5). + */ @Composable internal fun rememberAlarmTimeFormatter(): (TimeOfDay) -> String { val context = LocalContext.current diff --git a/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/RingScreen.kt b/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/RingScreen.kt index 170c7fc..773dc69 100644 --- a/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/RingScreen.kt +++ b/app/src/main/java/de/jeanlucmakiola/clockula/ui/ring/RingScreen.kt @@ -33,6 +33,7 @@ import androidx.compose.ui.draw.scale import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import de.jeanlucmakiola.clockula.R +import de.jeanlucmakiola.clockula.ui.common.rememberAlarmTimeFormatter import de.jeanlucmakiola.floret.identity.collapseExit import de.jeanlucmakiola.floret.identity.expandEnter import de.jeanlucmakiola.floret.identity.rememberReduceMotion