Merge remote-tracking branch 'origin/feat/brightness-auto-mode' into feat/brightness-auto-mode

# Conflicts:
#	app/src/main/java/hu/bbara/purefin/ui/screen/player/PlayerScreen.kt
This commit is contained in:
2026-05-22 18:50:45 +02:00

View File

@@ -64,6 +64,8 @@ import kotlin.math.roundToInt
private const val CONTROLS_VISIBLE_SUBTITLE_BOTTOM_PADDING_FRACTION = 0.32f private const val CONTROLS_VISIBLE_SUBTITLE_BOTTOM_PADDING_FRACTION = 0.32f
private const val WIDE_VIDEO_ASPECT_RATIO = 16f / 9f private const val WIDE_VIDEO_ASPECT_RATIO = 16f / 9f
/** Small negative band below zero that represents adaptive/auto brightness mode. */
private const val AUTO_BRIGHTNESS_SENTINEL = -0.1f
@OptIn(UnstableApi::class) @OptIn(UnstableApi::class)
@Composable @Composable
@@ -148,7 +150,7 @@ fun PlayerScreen(
onDoubleTapCenter = { viewModel.togglePlayPause() }, onDoubleTapCenter = { viewModel.togglePlayPause() },
onVerticalDragLeft = { delta -> onVerticalDragLeft = { delta ->
val diff = (-delta / 800f) val diff = (-delta / 800f)
brightness = (brightness + diff).coerceIn(-1f, 1f) brightness = (brightness + diff).coerceIn(AUTO_BRIGHTNESS_SENTINEL, 1f)
applyBrightness(activity, brightness) applyBrightness(activity, brightness)
}, },
onVerticalDragRight = { delta -> onVerticalDragRight = { delta ->
@@ -400,7 +402,7 @@ private fun formatSeekDelta(deltaMs: Long): String {
private fun readCurrentBrightness(activity: Activity?): Float { private fun readCurrentBrightness(activity: Activity?): Float {
val current = activity?.window?.attributes?.screenBrightness val current = activity?.window?.attributes?.screenBrightness
return if (current != null && current >= 0) current else -1f return if (current != null && current >= 0) current else AUTO_BRIGHTNESS_SENTINEL
} }
private fun applyBrightness(activity: Activity?, value: Float) { private fun applyBrightness(activity: Activity?, value: Float) {