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(
modifier
.background(Color.Black)
.onKeyEvent(keyHandler::onKeyEvent)
.focusRequester(focusRequester)
.focusable(),
.background(Color.Black),
) {
val playerSize by animateFloatAsState(if (nextUp == null) 1f else .66f)
Box(
modifier =
Modifier
.fillMaxSize(playerSize)
.align(Alignment.TopCenter),
.align(Alignment.TopCenter)
.onKeyEvent(keyHandler::onKeyEvent)
.focusRequester(focusRequester)
.focusable(),
) {
PlayerSurface(
player = player,
@ -354,7 +354,7 @@ fun PlaybackPage(
// Next up episode
BackHandler(nextUp != null) {
viewModel.cancelUpNextEpisode()
viewModel.navigationManager.goBack()
}
AnimatedVisibility(
nextUp != null,
@ -374,7 +374,6 @@ fun PlaybackPage(
preferences.appPreferences.playbackPreferences.autoPlayNextDelaySeconds,
)
}
// TODO need extra back press for some reason
BackHandler(timeLeft > 0 && autoPlayEnabled) {
timeLeft = -1
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.indexOfFirstOrNull
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.EqualityMutableLiveData
import com.github.damontecres.dolphin.util.ExceptionHandler
@ -85,6 +86,7 @@ class PlaybackViewModel
constructor(
@ApplicationContext context: Context,
val api: ApiClient,
val navigationManager: NavigationManager,
) : ViewModel() {
val player: ExoPlayer =
ExoPlayer