mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
fix(android): a chooser in the player no longer closes on its own
The episode, track, speed, chapter and sleep choosers and the More menu live inside the player's controls, and the controls hide four seconds after they come up while the video plays. Hiding them took the open chooser with them, so a sheet being picked from closed at what looked like random. The controls now hold still while a chooser is open.
This commit is contained in:
1 parent
c9925b4b09
commit
4ca57d9449
1 file changed
+12
-3
@@ -477,8 +477,12 @@ fun PlayerScreen(
|
|||||||
// four seconds after it is reached cannot be found again.
|
// four seconds after it is reached cannot be found again.
|
||||||
val exploring = rememberTouchExploration()
|
val exploring = rememberTouchExploration()
|
||||||
LaunchedEffect(exploring) { if (exploring) showControls = true }
|
LaunchedEffect(exploring) { if (exploring) showControls = true }
|
||||||
LaunchedEffect(showControls, state.paused, exploring) {
|
// A chooser open over the controls. They hold still under it: the
|
||||||
if (showControls && !state.paused && !exploring) {
|
// choosers live inside the controls, so hiding them closed whatever was
|
||||||
|
// being picked from, four seconds after the controls came up.
|
||||||
|
var picking by remember { mutableStateOf(false) }
|
||||||
|
LaunchedEffect(showControls, state.paused, exploring, picking) {
|
||||||
|
if (showControls && !state.paused && !exploring && !picking) {
|
||||||
delay(CONTROLS_SECONDS * 1_000)
|
delay(CONTROLS_SECONDS * 1_000)
|
||||||
showControls = false
|
showControls = false
|
||||||
}
|
}
|
||||||
@@ -698,6 +702,7 @@ fun PlayerScreen(
|
|||||||
landscapeLocked = landscapeLocked,
|
landscapeLocked = landscapeLocked,
|
||||||
media = key,
|
media = key,
|
||||||
sleep = sleep,
|
sleep = sleep,
|
||||||
|
onPicking = { picking = it },
|
||||||
onLock = {
|
onLock = {
|
||||||
locked = true
|
locked = true
|
||||||
showControls = false
|
showControls = false
|
||||||
@@ -949,6 +954,7 @@ private fun PlayerControls(
|
|||||||
landscapeLocked: Boolean,
|
landscapeLocked: Boolean,
|
||||||
media: String,
|
media: String,
|
||||||
sleep: SleepTimer?,
|
sleep: SleepTimer?,
|
||||||
|
onPicking: (Boolean) -> Unit,
|
||||||
onLock: () -> Unit,
|
onLock: () -> Unit,
|
||||||
) {
|
) {
|
||||||
val scope = rememberCoroutineScope()
|
val scope = rememberCoroutineScope()
|
||||||
@@ -957,6 +963,10 @@ private fun PlayerControls(
|
|||||||
var showEpisodes by remember { mutableStateOf(false) }
|
var showEpisodes by remember { mutableStateOf(false) }
|
||||||
var showChapters by remember { mutableStateOf(false) }
|
var showChapters by remember { mutableStateOf(false) }
|
||||||
var showSpeeds by remember { mutableStateOf(false) }
|
var showSpeeds by remember { mutableStateOf(false) }
|
||||||
|
var more by remember { mutableStateOf(false) }
|
||||||
|
val picking = more || showSleep || choosing != null || showEpisodes || showChapters || showSpeeds
|
||||||
|
LaunchedEffect(picking) { onPicking(picking) }
|
||||||
|
DisposableEffect(Unit) { onDispose { onPicking(false) } }
|
||||||
// What the store says, so the dialog opens on the rate that is playing.
|
// What the store says, so the dialog opens on the rate that is playing.
|
||||||
var speed by remember { mutableStateOf(1.0) }
|
var speed by remember { mutableStateOf(1.0) }
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
@@ -1037,7 +1047,6 @@ private fun PlayerControls(
|
|||||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
if (!roomForAll) {
|
if (!roomForAll) {
|
||||||
CompactIcon(Icons.Default.Subtitles, "Subtitles") { choosing = "sub" }
|
CompactIcon(Icons.Default.Subtitles, "Subtitles") { choosing = "sub" }
|
||||||
var more by remember { mutableStateOf(false) }
|
|
||||||
Box {
|
Box {
|
||||||
CompactIcon(Icons.Default.MoreVert, "More") { more = true }
|
CompactIcon(Icons.Default.MoreVert, "More") { more = true }
|
||||||
DropdownMenu(expanded = more, onDismissRequest = { more = false }) {
|
DropdownMenu(expanded = more, onDismissRequest = { more = false }) {
|
||||||
|
|||||||
Reference in new issue
Block a user