mirror of
https://github.com/bbara04/Purefin.git
synced 2026-03-31 17:10:08 +02:00
refactor: rename player gesture handlers for clarity
- Rename `PlayerGesturesLayer` parameters to be more descriptive of the gesture type (e.g., `onDoubleTapLeft`, `onDoubleTapCenter`, `onDoubleTapRight`). - Update the `PlayerScreen` to use the new, more specific gesture handler names.
This commit is contained in:
@@ -89,9 +89,9 @@ fun PlayerScreen(
|
||||
PlayerGesturesLayer(
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
onTap = { viewModel.toggleControlsVisibility() },
|
||||
onSeekForward = { viewModel.seekBy(30_000) },
|
||||
onSeekBackward = { viewModel.seekBy(-10_000) },
|
||||
onResumePause = {viewModel.togglePlayPause()},
|
||||
onDoubleTapRight = { viewModel.seekBy(30_000) },
|
||||
onDoubleTapLeft = { viewModel.seekBy(-10_000) },
|
||||
onDoubleTapCenter = {viewModel.togglePlayPause()},
|
||||
onVerticalDragLeft = { delta ->
|
||||
val diff = (-delta / 800f)
|
||||
brightness = (brightness + diff).coerceIn(0f, 1f)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package hu.bbara.purefin.player.ui.components
|
||||
|
||||
import androidx.compose.foundation.gestures.detectDragGestures
|
||||
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
|
||||
import androidx.compose.foundation.gestures.detectTapGestures
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
@@ -12,9 +13,9 @@ import androidx.compose.ui.input.pointer.pointerInput
|
||||
fun PlayerGesturesLayer(
|
||||
modifier: Modifier = Modifier,
|
||||
onTap: () -> Unit,
|
||||
onResumePause: () -> Unit,
|
||||
onSeekForward: () -> Unit,
|
||||
onSeekBackward: () -> Unit,
|
||||
onDoubleTapCenter: () -> Unit,
|
||||
onDoubleTapRight: () -> Unit,
|
||||
onDoubleTapLeft: () -> Unit,
|
||||
onVerticalDragLeft: (delta: Float) -> Unit,
|
||||
onVerticalDragRight: (delta: Float) -> Unit
|
||||
) {
|
||||
@@ -30,11 +31,11 @@ fun PlayerGesturesLayer(
|
||||
val oneThird = screenWidth / 3
|
||||
val secondThird = oneThird * 2
|
||||
if (offset.x < oneThird) {
|
||||
onSeekBackward()
|
||||
onDoubleTapLeft()
|
||||
} else if (offset.x >= oneThird && offset.x <= secondThird) {
|
||||
onResumePause()
|
||||
onDoubleTapCenter()
|
||||
} else {
|
||||
onSeekForward()
|
||||
onDoubleTapRight()
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user