From adb571fcbd4ef2c0c2c42bbc42ecd1eb53497c72 Mon Sep 17 00:00:00 2001 From: Abdallah <54363735+abdallahmehiz@users.noreply.github.com> Date: Fri, 24 Nov 2023 18:22:52 +0100 Subject: [PATCH] fix(player): Make chapters sheet scrollable + adjust stream sheet scrolling (#1212) --- .../settings/sheets/StreamsCatalogSheet.kt | 48 +++++++++++-------- .../settings/sheets/VideoChaptersSheet.kt | 6 ++- 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/StreamsCatalogSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/StreamsCatalogSheet.kt index c5e143a06..2b53a506c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/StreamsCatalogSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/StreamsCatalogSheet.kt @@ -68,24 +68,26 @@ fun StreamsCatalogSheet( Column( modifier = Modifier .padding(contentPadding) - .padding(vertical = TabbedDialogPaddings.Vertical) - .verticalScroll(rememberScrollState()), + .padding(vertical = TabbedDialogPaddings.Vertical), ) { - @Composable fun QualityTracksPage() = StreamsPageBuilder( + @Composable + fun QualityTracksPage() = StreamsPageBuilder( externalTrackCode = null, stream = videoStreams.quality, openContentFd = openContentFd, onTrackSelected = onQualitySelected, ) - @Composable fun SubtitleTracksPage() = StreamsPageBuilder( + @Composable + fun SubtitleTracksPage() = StreamsPageBuilder( externalTrackCode = "sub", stream = videoStreams.subtitle, openContentFd = openContentFd, onTrackSelected = onSubtitleSelected, ) - @Composable fun AudioTracksPage() = StreamsPageBuilder( + @Composable + fun AudioTracksPage() = StreamsPageBuilder( externalTrackCode = "audio", stream = videoStreams.audio, openContentFd = openContentFd, @@ -167,22 +169,28 @@ private fun StreamsPageBuilder( } } - tracks.forEachIndexed { i, track -> - val selected = index == i + Column( + modifier = Modifier + .fillMaxWidth() + .verticalScroll(rememberScrollState()), + ) { + tracks.forEachIndexed { i, track -> + val selected = index == i - Row( - modifier = Modifier - .fillMaxWidth() - .clickable(onClick = { onSelected(i) }) - .padding(sheetDialogPadding), - ) { - Text( - text = track.lang, - fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal, - fontStyle = if (selected) FontStyle.Italic else FontStyle.Normal, - style = MaterialTheme.typography.bodyMedium, - color = if (selected) MaterialTheme.colorScheme.primary else Color.Unspecified, - ) + Row( + modifier = Modifier + .fillMaxWidth() + .clickable(onClick = { onSelected(i) }) + .padding(sheetDialogPadding), + ) { + Text( + text = track.lang, + fontWeight = if (selected) FontWeight.Bold else FontWeight.Normal, + fontStyle = if (selected) FontStyle.Italic else FontStyle.Normal, + style = MaterialTheme.typography.bodyMedium, + color = if (selected) MaterialTheme.colorScheme.primary else Color.Unspecified, + ) + } } } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/VideoChaptersSheet.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/VideoChaptersSheet.kt index a2e43921a..d0b87d4c4 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/VideoChaptersSheet.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/player/settings/sheets/VideoChaptersSheet.kt @@ -5,6 +5,8 @@ import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.rememberScrollState +import androidx.compose.foundation.verticalScroll import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Text import androidx.compose.runtime.Composable @@ -40,7 +42,9 @@ fun VideoChaptersSheet( onDismissRequest = onDismissRequest, ) { Column( - modifier = Modifier.padding(MaterialTheme.padding.medium), + modifier = Modifier + .padding(MaterialTheme.padding.medium) + .verticalScroll(rememberScrollState()), ) { Text( text = stringResource(id = R.string.chapter_dialog_header),