Skip to content

Commit c1a230f

Browse files
committed
fix animation spec some more
1 parent bb8d123 commit c1a230f

File tree

1 file changed

+19
-7
lines changed

1 file changed

+19
-7
lines changed

new-player/src/main/java/net/newpipe/newplayer/ui/videoplayer/VideoPlayerUI.kt

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ package net.newpipe.newplayer.ui.videoplayer
2323
import android.os.Build
2424
import androidx.annotation.OptIn
2525
import androidx.compose.animation.AnimatedVisibility
26-
import androidx.compose.foundation.clickable
26+
import androidx.compose.animation.core.snap
27+
import androidx.compose.animation.expandIn
28+
import androidx.compose.animation.fadeIn
29+
import androidx.compose.animation.fadeOut
30+
import androidx.compose.animation.shrinkOut
2731
import androidx.compose.foundation.layout.Box
2832
import androidx.compose.foundation.layout.aspectRatio
2933
import androidx.compose.foundation.layout.fillMaxSize
@@ -44,14 +48,14 @@ import androidx.compose.ui.layout.boundsInWindow
4448
import androidx.compose.ui.layout.onGloballyPositioned
4549
import androidx.core.graphics.toRect
4650
import androidx.media3.common.util.UnstableApi
47-
import net.newpipe.newplayer.uiModel.NewPlayerUIState
48-
import net.newpipe.newplayer.uiModel.InternalNewPlayerViewModel
49-
import net.newpipe.newplayer.ui.selection_ui.StreamSelectUI
5051
import net.newpipe.newplayer.data.NewPlayerException
5152
import net.newpipe.newplayer.ui.common.activity
5253
import net.newpipe.newplayer.ui.selection_ui.ChapterSelectUI
54+
import net.newpipe.newplayer.ui.selection_ui.StreamSelectUI
5355
import net.newpipe.newplayer.ui.videoplayer.pip.getPipParams
5456
import net.newpipe.newplayer.ui.videoplayer.pip.supportsPip
57+
import net.newpipe.newplayer.uiModel.InternalNewPlayerViewModel
58+
import net.newpipe.newplayer.uiModel.NewPlayerUIState
5559
import net.newpipe.newplayer.uiModel.UIModeState
5660

5761
@OptIn(UnstableApi::class)
@@ -93,7 +97,7 @@ internal fun VideoPlayerUi(viewModel: InternalNewPlayerViewModel, uiState: NewPl
9397
&& supportsPip(activity)
9498
) {
9599
val pipParams = getPipParams(uiState.contentRatio, videoViewBounds)
96-
if(pipParams != null)
100+
if (pipParams != null)
97101
activity.setPictureInPictureParams(pipParams)
98102
}
99103
}
@@ -131,7 +135,11 @@ internal fun VideoPlayerUi(viewModel: InternalNewPlayerViewModel, uiState: NewPl
131135
viewModel, uiState = uiState
132136
)
133137

134-
AnimatedVisibility(visible = uiState.uiMode.isStreamSelect) {
138+
AnimatedVisibility(
139+
visible = uiState.uiMode.isStreamSelect,
140+
enter = fadeIn() + expandIn(),
141+
exit = fadeOut(animationSpec = snap(0))
142+
) {
135143
Surface(
136144
modifier = Modifier.fillMaxSize(),
137145
color = STREAMSELECT_UI_BACKGROUND_COLOR
@@ -144,7 +152,11 @@ internal fun VideoPlayerUi(viewModel: InternalNewPlayerViewModel, uiState: NewPl
144152
}
145153
}
146154

147-
AnimatedVisibility(visible = uiState.uiMode.isChapterSelect) {
155+
AnimatedVisibility(
156+
visible = uiState.uiMode.isChapterSelect,
157+
enter = fadeIn() + expandIn(),
158+
exit = fadeOut(animationSpec = snap(0))
159+
) {
148160
Surface(
149161
modifier = Modifier.fillMaxSize(),
150162
color = STREAMSELECT_UI_BACKGROUND_COLOR

0 commit comments

Comments
 (0)