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(
|
PlayerGesturesLayer(
|
||||||
modifier = Modifier.fillMaxSize(),
|
modifier = Modifier.fillMaxSize(),
|
||||||
onTap = { viewModel.toggleControlsVisibility() },
|
onTap = { viewModel.toggleControlsVisibility() },
|
||||||
onSeekForward = { viewModel.seekBy(30_000) },
|
onDoubleTapRight = { viewModel.seekBy(30_000) },
|
||||||
onSeekBackward = { viewModel.seekBy(-10_000) },
|
onDoubleTapLeft = { viewModel.seekBy(-10_000) },
|
||||||
onResumePause = {viewModel.togglePlayPause()},
|
onDoubleTapCenter = {viewModel.togglePlayPause()},
|
||||||
onVerticalDragLeft = { delta ->
|
onVerticalDragLeft = { delta ->
|
||||||
val diff = (-delta / 800f)
|
val diff = (-delta / 800f)
|
||||||
brightness = (brightness + diff).coerceIn(0f, 1f)
|
brightness = (brightness + diff).coerceIn(0f, 1f)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package hu.bbara.purefin.player.ui.components
|
package hu.bbara.purefin.player.ui.components
|
||||||
|
|
||||||
import androidx.compose.foundation.gestures.detectDragGestures
|
import androidx.compose.foundation.gestures.detectDragGestures
|
||||||
|
import androidx.compose.foundation.gestures.detectHorizontalDragGestures
|
||||||
import androidx.compose.foundation.gestures.detectTapGestures
|
import androidx.compose.foundation.gestures.detectTapGestures
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@@ -12,9 +13,9 @@ import androidx.compose.ui.input.pointer.pointerInput
|
|||||||
fun PlayerGesturesLayer(
|
fun PlayerGesturesLayer(
|
||||||
modifier: Modifier = Modifier,
|
modifier: Modifier = Modifier,
|
||||||
onTap: () -> Unit,
|
onTap: () -> Unit,
|
||||||
onResumePause: () -> Unit,
|
onDoubleTapCenter: () -> Unit,
|
||||||
onSeekForward: () -> Unit,
|
onDoubleTapRight: () -> Unit,
|
||||||
onSeekBackward: () -> Unit,
|
onDoubleTapLeft: () -> Unit,
|
||||||
onVerticalDragLeft: (delta: Float) -> Unit,
|
onVerticalDragLeft: (delta: Float) -> Unit,
|
||||||
onVerticalDragRight: (delta: Float) -> Unit
|
onVerticalDragRight: (delta: Float) -> Unit
|
||||||
) {
|
) {
|
||||||
@@ -30,11 +31,11 @@ fun PlayerGesturesLayer(
|
|||||||
val oneThird = screenWidth / 3
|
val oneThird = screenWidth / 3
|
||||||
val secondThird = oneThird * 2
|
val secondThird = oneThird * 2
|
||||||
if (offset.x < oneThird) {
|
if (offset.x < oneThird) {
|
||||||
onSeekBackward()
|
onDoubleTapLeft()
|
||||||
} else if (offset.x >= oneThird && offset.x <= secondThird) {
|
} else if (offset.x >= oneThird && offset.x <= secondThird) {
|
||||||
onResumePause()
|
onDoubleTapCenter()
|
||||||
} else {
|
} else {
|
||||||
onSeekForward()
|
onDoubleTapRight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user