mirror of
https://github.com/tapframe/NuvioStreaming.git
synced 2026-05-16 23:12:12 +00:00
Hide speed indicator after 2 second to remove visual clutter
This commit is contained in:
parent
77c9879583
commit
c5c0a6f16d
1 changed files with 21 additions and 11 deletions
|
|
@ -79,10 +79,10 @@ private val PlayerActionRowHeight = 50.dp
|
||||||
|
|
||||||
private fun sliderOverlayBottomPadding(metrics: PlayerLayoutMetrics) =
|
private fun sliderOverlayBottomPadding(metrics: PlayerLayoutMetrics) =
|
||||||
metrics.sliderBottomOffset +
|
metrics.sliderBottomOffset +
|
||||||
metrics.sliderTouchHeight +
|
metrics.sliderTouchHeight +
|
||||||
PlayerTimeRowHeight +
|
PlayerTimeRowHeight +
|
||||||
PlayerActionRowHeight +
|
PlayerActionRowHeight +
|
||||||
PlayerSliderOverlayGap
|
PlayerSliderOverlayGap
|
||||||
|
|
||||||
private enum class PlayerSideGesture {
|
private enum class PlayerSideGesture {
|
||||||
Brightness,
|
Brightness,
|
||||||
|
|
@ -195,6 +195,7 @@ fun PlayerScreen(
|
||||||
var gestureMessageJob by remember { mutableStateOf<Job?>(null) }
|
var gestureMessageJob by remember { mutableStateOf<Job?>(null) }
|
||||||
var accumulatedSeekResetJob by remember { mutableStateOf<Job?>(null) }
|
var accumulatedSeekResetJob by remember { mutableStateOf<Job?>(null) }
|
||||||
var accumulatedSeekState by remember { mutableStateOf<PlayerAccumulatedSeekState?>(null) }
|
var accumulatedSeekState by remember { mutableStateOf<PlayerAccumulatedSeekState?>(null) }
|
||||||
|
var speedIndicatorJob by remember { mutableStateOf<Job?>(null) }
|
||||||
var initialLoadCompleted by remember(activeSourceUrl) { mutableStateOf(false) }
|
var initialLoadCompleted by remember(activeSourceUrl) { mutableStateOf(false) }
|
||||||
var speedBoostRestoreSpeed by remember(activeSourceUrl) { mutableStateOf<Float?>(null) }
|
var speedBoostRestoreSpeed by remember(activeSourceUrl) { mutableStateOf<Float?>(null) }
|
||||||
var isHoldToSpeedGestureActive by remember(activeSourceUrl) { mutableStateOf(false) }
|
var isHoldToSpeedGestureActive by remember(activeSourceUrl) { mutableStateOf(false) }
|
||||||
|
|
@ -202,7 +203,7 @@ fun PlayerScreen(
|
||||||
val initialProgressFraction = activeInitialProgressFraction
|
val initialProgressFraction = activeInitialProgressFraction
|
||||||
mutableStateOf(
|
mutableStateOf(
|
||||||
activeInitialPositionMs <= 0L &&
|
activeInitialPositionMs <= 0L &&
|
||||||
(initialProgressFraction == null || initialProgressFraction <= 0f),
|
(initialProgressFraction == null || initialProgressFraction <= 0f),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
var lastProgressPersistEpochMs by remember(activeSourceUrl) { mutableStateOf(0L) }
|
var lastProgressPersistEpochMs by remember(activeSourceUrl) { mutableStateOf(0L) }
|
||||||
|
|
@ -680,9 +681,18 @@ fun PlayerScreen(
|
||||||
icon = GestureFeedbackIcon.Speed,
|
icon = GestureFeedbackIcon.Speed,
|
||||||
)
|
)
|
||||||
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
hapticFeedback.performHapticFeedback(HapticFeedbackType.LongPress)
|
||||||
|
|
||||||
|
// Hide the speed indicator after 2 seconds, but keep speed active
|
||||||
|
speedIndicatorJob?.cancel()
|
||||||
|
speedIndicatorJob = scope.launch {
|
||||||
|
delay(2_000L)
|
||||||
|
liveGestureFeedback = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun deactivateHoldToSpeed() {
|
fun deactivateHoldToSpeed() {
|
||||||
|
speedIndicatorJob?.cancel()
|
||||||
|
speedIndicatorJob = null
|
||||||
isHoldToSpeedGestureActive = false
|
isHoldToSpeedGestureActive = false
|
||||||
val restoreSpeed = speedBoostRestoreSpeed ?: return
|
val restoreSpeed = speedBoostRestoreSpeed ?: return
|
||||||
playerController?.setPlaybackSpeed(restoreSpeed)
|
playerController?.setPlaybackSpeed(restoreSpeed)
|
||||||
|
|
@ -910,10 +920,10 @@ fun PlayerScreen(
|
||||||
val settings = playerSettingsUiState
|
val settings = playerSettingsUiState
|
||||||
val shouldAutoSelectInManualMode =
|
val shouldAutoSelectInManualMode =
|
||||||
settings.streamAutoPlayMode == StreamAutoPlayMode.MANUAL &&
|
settings.streamAutoPlayMode == StreamAutoPlayMode.MANUAL &&
|
||||||
(
|
(
|
||||||
settings.streamAutoPlayNextEpisodeEnabled ||
|
settings.streamAutoPlayNextEpisodeEnabled ||
|
||||||
settings.streamAutoPlayPreferBingeGroup
|
settings.streamAutoPlayPreferBingeGroup
|
||||||
)
|
)
|
||||||
|
|
||||||
// Determine auto-play mode for next episode
|
// Determine auto-play mode for next episode
|
||||||
val effectiveMode = if (shouldAutoSelectInManualMode) {
|
val effectiveMode = if (shouldAutoSelectInManualMode) {
|
||||||
|
|
@ -1387,8 +1397,8 @@ fun PlayerScreen(
|
||||||
if (gestureMode == null) {
|
if (gestureMode == null) {
|
||||||
val horizontalDominant =
|
val horizontalDominant =
|
||||||
!isHoldToSpeedGestureActiveState.value &&
|
!isHoldToSpeedGestureActiveState.value &&
|
||||||
abs(totalDx) > viewConfiguration.touchSlop &&
|
abs(totalDx) > viewConfiguration.touchSlop &&
|
||||||
abs(totalDx) > abs(totalDy)
|
abs(totalDx) > abs(totalDy)
|
||||||
val verticalDominant =
|
val verticalDominant =
|
||||||
abs(totalDy) > viewConfiguration.touchSlop && abs(totalDy) > abs(totalDx)
|
abs(totalDy) > viewConfiguration.touchSlop && abs(totalDy) > abs(totalDx)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue