From a74e9396e6a25c023b2e8e0937f35a5ef0123c7b Mon Sep 17 00:00:00 2001 From: Antoine Jaury Date: Mon, 6 Jul 2026 22:57:32 +0200 Subject: [PATCH] refactor: simplify formatting for playback speed and text scale labels --- .../fr/ajaury/gwenedeg/player/ui/PlaybackSpeedBottomSheet.kt | 4 ++-- .../gwenedeg/preferences/ui/SubtitlePreferencesBottomSheet.kt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/player/ui/PlaybackSpeedBottomSheet.kt b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/player/ui/PlaybackSpeedBottomSheet.kt index 5411fe2..df2c278 100644 --- a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/player/ui/PlaybackSpeedBottomSheet.kt +++ b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/player/ui/PlaybackSpeedBottomSheet.kt @@ -93,10 +93,10 @@ private fun PlaybackSpeedContent( } } -/** Formats a speed multiplier as a short label, e.g. 1.0 → "x1", 0.7 → "x0.7". */ +/** Formats a speed multiplier as a short label, e.g. 1.0 → "x1.0", 0.7 → "x0.7". */ internal fun formatPlaybackSpeed(speed: Float): String { val tenths = (speed * 10).roundToInt() - return if (tenths % 10 == 0) "x${tenths / 10}" else "x${tenths / 10}.${tenths % 10}" + return "x${tenths / 10}.${tenths % 10}" } @Preview diff --git a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/preferences/ui/SubtitlePreferencesBottomSheet.kt b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/preferences/ui/SubtitlePreferencesBottomSheet.kt index cf498b5..af162c2 100644 --- a/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/preferences/ui/SubtitlePreferencesBottomSheet.kt +++ b/shared/src/commonMain/kotlin/fr/ajaury/gwenedeg/preferences/ui/SubtitlePreferencesBottomSheet.kt @@ -157,10 +157,10 @@ private fun SubtitleTextSizeControl( } } -/** Formats a text-scale multiplier as a short label, e.g. 1.0 -> "x1", 1.2 -> "x1.2". */ +/** Formats a text-scale multiplier as a short label, e.g. 1.0 -> "x1.0", 1.2 -> "x1.2". */ private fun formatTextScale(scale: Float): String { val tenths = (scale * 10).roundToInt() - return if (tenths % 10 == 0) "x${tenths / 10}" else "x${tenths / 10}.${tenths % 10}" + return "x${tenths / 10}.${tenths % 10}" } @Preview