mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-23 19:26:50 +00:00
fix(tv): focus segment skip button
This commit is contained in:
@@ -181,12 +181,16 @@ fun TvPlayerScreen(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LaunchedEffect(controlsVisible, controlsAutoHideBlocked) {
|
LaunchedEffect(
|
||||||
|
controlsVisible,
|
||||||
|
controlsAutoHideBlocked,
|
||||||
|
uiState.activeSkippableSegmentEndMs
|
||||||
|
) {
|
||||||
if (controlsAutoHideBlocked) return@LaunchedEffect
|
if (controlsAutoHideBlocked) return@LaunchedEffect
|
||||||
if (controlsVisible) {
|
if (controlsVisible) {
|
||||||
controlsFocusRequester.requestFocus()
|
controlsFocusRequester.requestFocus()
|
||||||
} else {
|
} else {
|
||||||
uiState.activeSkippableSegmentEndMs?.let {
|
if (uiState.activeSkippableSegmentEndMs != null) {
|
||||||
skipButtonFocusRequester.requestFocus()
|
skipButtonFocusRequester.requestFocus()
|
||||||
return@LaunchedEffect
|
return@LaunchedEffect
|
||||||
}
|
}
|
||||||
@@ -254,6 +258,8 @@ fun TvPlayerScreen(
|
|||||||
onResumePlaybackWithoutShowingControls = resumePlaybackWithoutShowingControls,
|
onResumePlaybackWithoutShowingControls = resumePlaybackWithoutShowingControls,
|
||||||
onSeekRelative = seekByWithoutShowingControls,
|
onSeekRelative = seekByWithoutShowingControls,
|
||||||
onShowControls = showTvControls,
|
onShowControls = showTvControls,
|
||||||
|
onSkipSegment = skipSegmentAndShowControls,
|
||||||
|
hasSkippableSegment = uiState.activeSkippableSegmentEndMs != null,
|
||||||
onTogglePlayPause = togglePlayPauseAndShowControls
|
onTogglePlayPause = togglePlayPauseAndShowControls
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -385,6 +391,8 @@ internal fun handleTvPlayerRootKeyEvent(
|
|||||||
onResumePlaybackWithoutShowingControls: () -> Unit,
|
onResumePlaybackWithoutShowingControls: () -> Unit,
|
||||||
onSeekRelative: (Long) -> Unit,
|
onSeekRelative: (Long) -> Unit,
|
||||||
onShowControls: () -> Unit,
|
onShowControls: () -> Unit,
|
||||||
|
onSkipSegment: () -> Unit = {},
|
||||||
|
hasSkippableSegment: Boolean = false,
|
||||||
onTogglePlayPause: () -> Unit
|
onTogglePlayPause: () -> Unit
|
||||||
): Boolean {
|
): Boolean {
|
||||||
if (event.type != KeyEventType.KeyDown) return false
|
if (event.type != KeyEventType.KeyDown) return false
|
||||||
@@ -428,7 +436,9 @@ internal fun handleTvPlayerRootKeyEvent(
|
|||||||
}
|
}
|
||||||
|
|
||||||
Key.DirectionCenter, Key.Enter -> {
|
Key.DirectionCenter, Key.Enter -> {
|
||||||
if (isPlaying) {
|
if (hasSkippableSegment) {
|
||||||
|
onSkipSegment()
|
||||||
|
} else if (isPlaying) {
|
||||||
onPausePlaybackWithoutShowingControls()
|
onPausePlaybackWithoutShowingControls()
|
||||||
} else {
|
} else {
|
||||||
onResumePlaybackWithoutShowingControls()
|
onResumePlaybackWithoutShowingControls()
|
||||||
|
|||||||
Reference in New Issue
Block a user