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) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Wmy1BpCKi8KeSjaWhYuCPV
This commit is contained in:
+6
-2
@@ -1,4 +1,4 @@
|
|||||||
package de.jeanlucmakiola.clockula.ui.ring
|
package de.jeanlucmakiola.clockula.ui.common
|
||||||
|
|
||||||
import android.text.format.DateFormat
|
import android.text.format.DateFormat
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
@@ -10,7 +10,11 @@ import java.time.LocalTime
|
|||||||
import java.time.format.DateTimeFormatter
|
import java.time.format.DateTimeFormatter
|
||||||
import java.time.format.FormatStyle
|
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
|
@Composable
|
||||||
internal fun rememberAlarmTimeFormatter(): (TimeOfDay) -> String {
|
internal fun rememberAlarmTimeFormatter(): (TimeOfDay) -> String {
|
||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
@@ -33,6 +33,7 @@ import androidx.compose.ui.draw.scale
|
|||||||
import androidx.compose.ui.res.stringResource
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.unit.dp
|
import androidx.compose.ui.unit.dp
|
||||||
import de.jeanlucmakiola.clockula.R
|
import de.jeanlucmakiola.clockula.R
|
||||||
|
import de.jeanlucmakiola.clockula.ui.common.rememberAlarmTimeFormatter
|
||||||
import de.jeanlucmakiola.floret.identity.collapseExit
|
import de.jeanlucmakiola.floret.identity.collapseExit
|
||||||
import de.jeanlucmakiola.floret.identity.expandEnter
|
import de.jeanlucmakiola.floret.identity.expandEnter
|
||||||
import de.jeanlucmakiola.floret.identity.rememberReduceMotion
|
import de.jeanlucmakiola.floret.identity.rememberReduceMotion
|
||||||
|
|||||||
Reference in New Issue
Block a user