refactor: simplify formatting for playback speed and text scale labels

This commit is contained in:
2026-07-06 22:57:32 +02:00
parent f8b82bcd99
commit a74e9396e6
2 changed files with 4 additions and 4 deletions
@@ -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 { internal fun formatPlaybackSpeed(speed: Float): String {
val tenths = (speed * 10).roundToInt() 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 @Preview
@@ -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 { private fun formatTextScale(scale: Float): String {
val tenths = (scale * 10).roundToInt() 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 @Preview