Fix next up episode back handling

This commit is contained in:
Damontecres 2025-10-13 11:07:16 -04:00
parent 61a69f206b
commit 3906eb196a
No known key found for this signature in database
2 changed files with 8 additions and 7 deletions

View file

@ -183,17 +183,17 @@ fun PlaybackPage(
Box( Box(
modifier modifier
.background(Color.Black) .background(Color.Black),
.onKeyEvent(keyHandler::onKeyEvent)
.focusRequester(focusRequester)
.focusable(),
) { ) {
val playerSize by animateFloatAsState(if (nextUp == null) 1f else .66f) val playerSize by animateFloatAsState(if (nextUp == null) 1f else .66f)
Box( Box(
modifier = modifier =
Modifier Modifier
.fillMaxSize(playerSize) .fillMaxSize(playerSize)
.align(Alignment.TopCenter), .align(Alignment.TopCenter)
.onKeyEvent(keyHandler::onKeyEvent)
.focusRequester(focusRequester)
.focusable(),
) { ) {
PlayerSurface( PlayerSurface(
player = player, player = player,
@ -354,7 +354,7 @@ fun PlaybackPage(
// Next up episode // Next up episode
BackHandler(nextUp != null) { BackHandler(nextUp != null) {
viewModel.cancelUpNextEpisode() viewModel.navigationManager.goBack()
} }
AnimatedVisibility( AnimatedVisibility(
nextUp != null, nextUp != null,
@ -374,7 +374,6 @@ fun PlaybackPage(
preferences.appPreferences.playbackPreferences.autoPlayNextDelaySeconds, preferences.appPreferences.playbackPreferences.autoPlayNextDelaySeconds,
) )
} }
// TODO need extra back press for some reason
BackHandler(timeLeft > 0 && autoPlayEnabled) { BackHandler(timeLeft > 0 && autoPlayEnabled) {
timeLeft = -1 timeLeft = -1
autoPlayEnabled = false autoPlayEnabled = false

View file

@ -22,6 +22,7 @@ import com.github.damontecres.dolphin.preferences.UserPreferences
import com.github.damontecres.dolphin.ui.DefaultItemFields import com.github.damontecres.dolphin.ui.DefaultItemFields
import com.github.damontecres.dolphin.ui.indexOfFirstOrNull import com.github.damontecres.dolphin.ui.indexOfFirstOrNull
import com.github.damontecres.dolphin.ui.nav.Destination import com.github.damontecres.dolphin.ui.nav.Destination
import com.github.damontecres.dolphin.ui.nav.NavigationManager
import com.github.damontecres.dolphin.util.ApiRequestPager import com.github.damontecres.dolphin.util.ApiRequestPager
import com.github.damontecres.dolphin.util.EqualityMutableLiveData import com.github.damontecres.dolphin.util.EqualityMutableLiveData
import com.github.damontecres.dolphin.util.ExceptionHandler import com.github.damontecres.dolphin.util.ExceptionHandler
@ -85,6 +86,7 @@ class PlaybackViewModel
constructor( constructor(
@ApplicationContext context: Context, @ApplicationContext context: Context,
val api: ApiClient, val api: ApiClient,
val navigationManager: NavigationManager,
) : ViewModel() { ) : ViewModel() {
val player: ExoPlayer = val player: ExoPlayer =
ExoPlayer ExoPlayer