refactor: simplify formatting for playback speed and text scale labels
This commit is contained in:
+2
-2
@@ -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
|
||||||
|
|||||||
+2
-2
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user