Skip to content

Commit

Permalink
Add animation label for SeekPositionIndicator and add previews
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Apr 3, 2024
1 parent 02ace90 commit bfb06b4
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
37 changes: 34 additions & 3 deletions app/shared/video-player/androidMain/ui/VideoGestureHost.android.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package me.him188.ani.app.videoplayer.ui

import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.PreviewLightDark
import me.him188.ani.app.ui.foundation.ProvideCompositionLocalsForPreview
import me.him188.ani.app.videoplayer.ui.guesture.SeekPositionIndicator
Expand All @@ -10,22 +14,49 @@ import me.him188.ani.app.videoplayer.ui.guesture.SeekPositionIndicator
@Composable
private fun PreviewSeekPositionIndicatorForward() {
ProvideCompositionLocalsForPreview {
SeekPositionIndicator(deltaDuration = 10)
Box {
Box(
modifier = Modifier
.matchParentSize()
.background(Color.Transparent)
) {

}
SeekPositionIndicator(deltaDuration = 10)
}
}
}

@PreviewLightDark
@Composable
private fun PreviewSeekPositionIndicatorBackward() {
ProvideCompositionLocalsForPreview {
SeekPositionIndicator(deltaDuration = -10)
Box {
Box(
modifier = Modifier
.matchParentSize()
.background(Color.Transparent)
) {

}
SeekPositionIndicator(deltaDuration = -10)
}
}
}

@PreviewLightDark
@Composable
private fun PreviewSeekPositionIndicatorBackwardMinutes() {
ProvideCompositionLocalsForPreview {
SeekPositionIndicator(deltaDuration = -90)
Box {
Box(
modifier = Modifier
.matchParentSize()
.background(Color.Transparent)
) {

}
SeekPositionIndicator(deltaDuration = -90)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ fun VideoGestureHost(
AnimatedVisibility(
visible = seekerState.isSeeking,
enter = fadeIn(tween(durationMillis = 100)),
exit = fadeOut(tween(durationMillis = 500, delayMillis = 250))
exit = fadeOut(tween(durationMillis = 500, delayMillis = 250)),
label = "SeekPositionIndicator"
) {
SeekPositionIndicator(seekerState.deltaSeconds)
}
Expand Down

0 comments on commit bfb06b4

Please sign in to comment.