mirror of
https://github.com/bbara04/Purefin.git
synced 2026-07-24 03:36:51 +00:00
refactor(player): move back key handling to BackHandler in TvPlayerScreen
Consolidate Back and Escape key handling in the existing BackHandler composable and remove the redundant branch from handleTvPlayerRootKeyEvent. The BackHandler already implements the same panel/playlist/controls dismissal chain and adds the missing onBack() fallback for system navigation. Drop the now-unused parameters (isPlaylistExpanded, trackPanelType, onCloseTrackPanel, onCollapsePlaylist, onHideControls) from both the function and its call site.
This commit is contained in:
@@ -254,11 +254,6 @@ fun TvPlayerScreen(
|
||||
controlsVisible = controlsVisible,
|
||||
popupVisible = showSkipIntroButton || showNextEpisodeOverlay,
|
||||
onShowControls = ::showControls,
|
||||
isPlaylistExpanded = isPlaylistExpanded,
|
||||
trackPanelType = trackPanelType,
|
||||
onCloseTrackPanel = closeTrackPanel,
|
||||
onCollapsePlaylist = {},
|
||||
onHideControls = ::hideControls,
|
||||
onTogglePlayback = {
|
||||
// This is a hack to trigger the ValueChangeTimedVisibility to show the hidden resume/stop feedback.
|
||||
resumeStopFeedbackCounter++
|
||||
@@ -504,38 +499,12 @@ internal fun handleTvPlayerRootKeyEvent(
|
||||
event: KeyEvent,
|
||||
controlsVisible: Boolean,
|
||||
popupVisible: Boolean,
|
||||
isPlaylistExpanded: Boolean,
|
||||
trackPanelType: TvTrackPanelType?,
|
||||
onCloseTrackPanel: () -> Unit,
|
||||
onCollapsePlaylist: () -> Unit,
|
||||
onHideControls: () -> Unit,
|
||||
onTogglePlayback: () -> Unit,
|
||||
onSeekRelative: (Long) -> Unit,
|
||||
onShowControls: () -> Unit,
|
||||
): Boolean {
|
||||
if (event.type != KeyEventType.KeyDown) return false
|
||||
|
||||
if (event.key == Key.Back || event.key == Key.Escape) {
|
||||
return when {
|
||||
trackPanelType != null -> {
|
||||
onCloseTrackPanel()
|
||||
true
|
||||
}
|
||||
|
||||
isPlaylistExpanded -> {
|
||||
onCollapsePlaylist()
|
||||
true
|
||||
}
|
||||
|
||||
controlsVisible -> {
|
||||
onHideControls()
|
||||
true
|
||||
}
|
||||
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
if (!controlsVisible) {
|
||||
return when (event.key) {
|
||||
Key.DirectionLeft -> {
|
||||
|
||||
Reference in New Issue
Block a user