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