add double tap play/pause gesture
This commit is contained in:
parent
63334f5893
commit
d4d29f4c5c
|
@ -63,9 +63,13 @@ fun EmbeddedGestureUI(
|
|||
|
||||
Row(modifier = modifier) {
|
||||
GestureSurface(
|
||||
modifier = Modifier.weight(1f), onRegularTap = defaultOnRegularTap, onMultiTap = {
|
||||
modifier = Modifier.weight(1f),
|
||||
onRegularTap = defaultOnRegularTap,
|
||||
onMultiTap = {
|
||||
viewModel.fastSeek(-it)
|
||||
}, onMultiTapFinished = viewModel::finishFastSeek, onMovement = handleDownwardMovement
|
||||
},
|
||||
onMultiTapFinished = viewModel::finishFastSeek,
|
||||
onMovement = handleDownwardMovement
|
||||
) {
|
||||
FadedAnimationForSeekFeedback(
|
||||
uiState.fastSeekSeconds, backwards = true
|
||||
|
@ -79,6 +83,26 @@ fun EmbeddedGestureUI(
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
GestureSurface(
|
||||
modifier = Modifier.weight(1f),
|
||||
onRegularTap = defaultOnRegularTap,
|
||||
onMultiTap = { count ->
|
||||
if(count == 1) {
|
||||
if(uiState.playing) {
|
||||
viewModel.pause()
|
||||
viewModel.showUi()
|
||||
} else {
|
||||
viewModel.play()
|
||||
}
|
||||
}
|
||||
},
|
||||
onMultiTapFinished = viewModel::finishFastSeek,
|
||||
onMovement = handleDownwardMovement
|
||||
) {
|
||||
Box(modifier = Modifier.fillMaxSize())
|
||||
}
|
||||
|
||||
GestureSurface(
|
||||
modifier = Modifier.weight(1f),
|
||||
onRegularTap = defaultOnRegularTap,
|
||||
|
|
|
@ -121,6 +121,16 @@ fun FullscreenGestureUI(
|
|||
if (0 < movement.y) {
|
||||
viewModel.switchToEmbeddedView()
|
||||
}
|
||||
},
|
||||
onMultiTap = { count ->
|
||||
if(count == 1) {
|
||||
if(uiState.playing) {
|
||||
viewModel.pause()
|
||||
viewModel.showUi()
|
||||
} else {
|
||||
viewModel.play()
|
||||
}
|
||||
}
|
||||
})
|
||||
GestureSurface(modifier = Modifier.weight(1f),
|
||||
onRegularTap = defaultOnRegularTap,
|
||||
|
|
Loading…
Reference in New Issue