fix animated visibility for previous and next stream

This commit is contained in:
Christian Schabesberger 2024-09-06 15:51:31 +02:00
parent 58e0ad9f09
commit 8a3cc12bd7
2 changed files with 6 additions and 7 deletions

View File

@ -30,7 +30,6 @@ import androidx.core.content.ContextCompat.getSystemService
import androidx.lifecycle.AndroidViewModel
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.viewModelScope
import androidx.media3.common.MediaItem
import androidx.media3.common.Player
import dagger.hilt.android.lifecycle.HiltViewModel
import kotlinx.coroutines.Job
@ -70,7 +69,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
private var uiVisibilityJob: Job? = null
private var progressUpdaterJob: Job? = null
private var playlistProgressUpdatrJob: Job? = null
private var playlistProgressUpdaterJob: Job? = null
// this is necesary to restore the embedded view UI configuration when returning from fullscreen
private var embeddedUiConfig: EmbeddedUiConfig? = null
@ -328,8 +327,8 @@ class VideoPlayerViewModelImpl @Inject constructor(
}
private fun resetPlaylistProgressUpdaterJob() {
playlistProgressUpdatrJob?.cancel()
playlistProgressUpdatrJob = viewModelScope.launch {
playlistProgressUpdaterJob?.cancel()
playlistProgressUpdaterJob = viewModelScope.launch {
while (true) {
updateProgressInPlaylistOnce()
delay(1000)
@ -450,7 +449,7 @@ class VideoPlayerViewModelImpl @Inject constructor(
}
override fun closeStreamSelection() {
playlistProgressUpdatrJob?.cancel()
playlistProgressUpdaterJob?.cancel()
progressUpdaterJob?.cancel()
updateUiMode(uiState.value.uiMode.getUiHiddenState())
}

View File

@ -70,7 +70,7 @@ fun CenterUI(
Box(modifier = Modifier.size(80.dp)) {
androidx.compose.animation.AnimatedVisibility(
uiState.currentPlaylistItemIndex != 0,
enter = fadeIn(animationSpec = tween(200)),
enter = fadeIn(animationSpec = tween(400)),
exit = fadeOut(animationSpec = tween(400))
) {
@ -97,7 +97,7 @@ fun CenterUI(
Box(modifier = Modifier.size(80.dp)) {
androidx.compose.animation.AnimatedVisibility(
uiState.currentPlaylistItemIndex < uiState.playList.size - 1,
enter = fadeIn(animationSpec = tween(200)),
enter = fadeIn(animationSpec = tween(400)),
exit = fadeOut(animationSpec = tween(400))
) {
CenterControllButton(