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:
2026-01-26 20:32:41 +01:00
parent f2158820ac
commit 8cd97fc928
2 changed files with 10 additions and 9 deletions

View File

@@ -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)

View File

@@ -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()
}
}
)