From 7f93262d06db3e794bbc44f659a631ed64dd33ce Mon Sep 17 00:00:00 2001 From: damontecres <154766448+damontecres@users.noreply.github.com> Date: Fri, 17 Oct 2025 18:55:54 -0400 Subject: [PATCH] Show subtitles even when controller is visible (#28) Closes #20 Show subtitles slightly smaller and higher when the controls are visible This needs to be revisited when custom subtitle styling is implemented (#11). --- .../wholphin/ui/playback/PlaybackPage.kt | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackPage.kt b/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackPage.kt index be9511c4..e1c810cd 100644 --- a/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackPage.kt +++ b/app/src/main/java/com/github/damontecres/wholphin/ui/playback/PlaybackPage.kt @@ -260,6 +260,30 @@ fun PlaybackPage( } } + // Subtitles + if (skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled) { + val maxSize by animateFloatAsState(if (controllerViewState.controlsVisible) .7f else 1f) + AndroidView( + factory = { context -> + SubtitleView(context).apply { + setUserDefaultStyle() + setUserDefaultTextSize() + } + }, + update = { + it.setCues(cues) + }, + onReset = { + it.setCues(null) + }, + modifier = + Modifier + .fillMaxSize(maxSize) + .align(Alignment.TopCenter) + .background(Color.Transparent), + ) + } + // The playback controls AnimatedVisibility( controllerViewState.controlsVisible, @@ -343,28 +367,6 @@ fun PlaybackPage( ) } - // Subtitles - if (!controllerViewState.controlsVisible && skipIndicatorDuration == 0L && currentItemPlayback.subtitleIndexEnabled) { - AndroidView( - factory = { context -> - SubtitleView(context).apply { - setUserDefaultStyle() - setUserDefaultTextSize() - } - }, - update = { - it.setCues(cues) - }, - onReset = { - it.setCues(null) - }, - modifier = - Modifier - .fillMaxSize() - .background(Color.Transparent), - ) - } - // Ask to skip intros, etc button AnimatedVisibility( showSegment,