Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fun PlayerSheet(
customMaxWidth: Dp? = null,
customMaxHeight: Dp? = null,
surfaceColor: Color? = null,
content: @Composable () -> Unit,
content: @Composable (() -> Unit) -> Unit,
) {
val scope = rememberCoroutineScope()
val density = LocalDensity.current
Expand Down Expand Up @@ -189,7 +189,7 @@ fun PlayerSheet(
shape = xyz.mpv.rex.ui.theme.pillShape
)
)
content()
content(internalOnDismissRequest)
}
},
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,20 @@ fun PlayerControls(
}
}
}


var hideControlsAfterSheetDismiss by remember { mutableStateOf(false) }

val onOpenSheet: (Sheets) -> Unit = {
viewModel.sheetShown.update { _ -> it }
if (it == Sheets.None) {
viewModel.showControls()
if (hideControlsAfterSheetDismiss) {
hideControlsAfterSheetDismiss = false
} else {
viewModel.showControls()
}
} else {
viewModel.hideControls()
viewModel.panelShown.update { Panels.None }
viewModel.hideControls()
viewModel.panelShown.update { Panels.None }
}
}

Expand Down Expand Up @@ -2134,6 +2140,7 @@ fun PlayerControls(
chapters = chapters.toImmutableList(),
currentChapterIndex = currentChapter ?: 0,
onSeekToChapter = { chapterIndex ->
hideControlsAfterSheetDismiss = true
viewModel.seekToChapter(chapterIndex)
},
activeStop = currentStopLineup.active,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ fun ChaptersSheet(
},
)
},
trackIndexed = { _, item ->
trackIndexed = { _, item, dismissSheet ->
when (item) {
is ChapterSheetItem.BookmarkItem -> {
val bookmark = item.bookmark
Expand Down Expand Up @@ -253,6 +253,7 @@ fun ChaptersSheet(
} else {
onClick(item.chapter)
}
dismissSheet()
},
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ fun <T> GenericTracksSheet(
track: @Composable (T) -> Unit = {},
footer: @Composable () -> Unit = {},
key: ((index: Int, item: T) -> Any)? = null,
trackIndexed: (@Composable (index: Int, item: T) -> Unit)? = null,
trackIndexed: (@Composable (index: Int, item: T, dismissSheet: () -> Unit) -> Unit)? = null,
) {
val listState = lazyListState ?: rememberLazyListState()

PlayerSheet(onDismissRequest, customMaxWidth = customMaxWidth) {
PlayerSheet(onDismissRequest, customMaxWidth = customMaxWidth) { dismissSheet ->
Column(modifier) {
header()
LazyColumn(
Expand All @@ -54,7 +54,7 @@ fun <T> GenericTracksSheet(
verticalArrangement = Arrangement.spacedBy(6.dp),
) {
itemsIndexed(items = tracks, key = key) { index, item ->
if (trackIndexed != null) trackIndexed(index, item) else track(item)
if (trackIndexed != null) trackIndexed(index, item, dismissSheet) else track(item)
}
item {
footer()
Expand Down
Loading