Skip to content

Commit

Permalink
fix: hold for 2x speed setting not having any effect
Browse files Browse the repository at this point in the history
closes #67
  • Loading branch information
abdallahmehiz committed Sep 10, 2024
1 parent 924e21d commit 9f75cd1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ fun GestureHandler(modifier: Modifier = Modifier) {
val doubleTapToPause by playerPreferences.doubleTapToPause.collectAsState()
val doubleTapToSeek by playerPreferences.doubleTapToSeek.collectAsState()
val doubleTapToSeekDuration by playerPreferences.doubleTapToSeekDuration.collectAsState()
val doubleSpeedGesture by playerPreferences.holdForDoubleSpeed.collectAsState()
val brightnessGesture = playerPreferences.brightnessGesture.get()
val volumeGesture by playerPreferences.volumeGesture.collectAsState()
val seekGesture by playerPreferences.horizontalSeekGesture.collectAsState()
Expand Down Expand Up @@ -194,7 +195,7 @@ fun GestureHandler(modifier: Modifier = Modifier) {
interactionSource.emit(PressInteraction.Release(press))
},
onLongPress = {
if (areControlsLocked) return@detectTapGestures
if (!doubleSpeedGesture || areControlsLocked) return@detectTapGestures
if (!isLongPressing && !viewModel.paused.value) {
originalSpeed = viewModel.playbackSpeed.value
haptics.performHapticFeedback(HapticFeedbackType.LongPress)
Expand Down Expand Up @@ -227,7 +228,7 @@ fun GestureHandler(modifier: Modifier = Modifier) {
if (position >= duration && dragAmount > 0) return@detectHorizontalDragGestures
calculateNewHorizontalGestureValue(startingPosition, startingX, change.position.x, 0.15f).let {
viewModel.gestureSeekAmount.update { _ ->
Pair(startingPosition, it - startingPosition)
Pair(startingPosition, (it - startingPosition).coerceIn(0, (duration - startingPosition).toInt()))
}
viewModel.seekTo(it, preciseSeeking)
}
Expand Down

0 comments on commit 9f75cd1

Please sign in to comment.