diff --git a/app/src/main/java/com/github/damontecres/stashapp/ui/components/playback/PlaybackPageContent.kt b/app/src/main/java/com/github/damontecres/stashapp/ui/components/playback/PlaybackPageContent.kt index 32d63fd13..d8aa30145 100644 --- a/app/src/main/java/com/github/damontecres/stashapp/ui/components/playback/PlaybackPageContent.kt +++ b/app/src/main/java/com/github/damontecres/stashapp/ui/components/playback/PlaybackPageContent.kt @@ -526,7 +526,6 @@ fun PlaybackPageContent( val nextWithUpDown = remember { playlistPager != null && - playlistPager.filter.dataType == DataType.MARKER && playlistPager.size > 1 && uiConfig.preferences.interfacePreferences.useUpDownPreviousNext } @@ -1111,10 +1110,34 @@ class PlaybackKeyHandler( private val controllerViewState: ControllerViewState, private val updateSkipIndicator: (Long) -> Unit, ) { + private var keyDownKey: Key? = null + private var holdActionTriggered = false + fun onKeyEvent(it: KeyEvent): Boolean { var result = true if (!controlsEnabled) { result = false + } else if (it.type == KeyEventType.KeyDown) { + if (nextWithUpDown && (it.key == Key.DirectionUp || it.key == Key.DirectionDown)) { + val repeatCount = it.nativeKeyEvent.repeatCount + if (keyDownKey == null) { + keyDownKey = it.key + holdActionTriggered = false + } else if (keyDownKey == it.key && !holdActionTriggered && repeatCount >= 2) { + // Each repeat is roughly 250-300ms, so repeatCount==2 is ~500-600ms + holdActionTriggered = true + if (!controllerViewState.controlsVisible) { + if (it.key == Key.DirectionUp) { + player.seekToPreviousMediaItem() + } else if (it.key == Key.DirectionDown) { + player.seekToNextMediaItem() + } + } + } + result = true + } else { + result = false + } } else if (it.type != KeyEventType.KeyUp) { result = false } else if (isDpad(it)) { @@ -1125,10 +1148,14 @@ class PlaybackKeyHandler( } else if (skipWithLeftRight && it.key == Key.DirectionRight) { player.seekForward() updateSkipIndicator(player.seekForwardIncrement) - } else if (nextWithUpDown && it.key == Key.DirectionUp) { - player.seekToPreviousMediaItem() - } else if (nextWithUpDown && it.key == Key.DirectionDown) { - player.seekToNextMediaItem() + } else if (nextWithUpDown && (it.key == Key.DirectionUp || it.key == Key.DirectionDown)) { + val wasHeld = keyDownKey == it.key && holdActionTriggered + keyDownKey = null + holdActionTriggered = false + if (!wasHeld) { + // Only show player controls if it was a short press (not a hold) + controllerViewState.showControls() + } } else { controllerViewState.showControls() } diff --git a/app/src/main/java/com/github/damontecres/stashapp/ui/components/prefs/StashPreference.kt b/app/src/main/java/com/github/damontecres/stashapp/ui/components/prefs/StashPreference.kt index 428c27385..f9bb13ce0 100644 --- a/app/src/main/java/com/github/damontecres/stashapp/ui/components/prefs/StashPreference.kt +++ b/app/src/main/java/com/github/damontecres/stashapp/ui/components/prefs/StashPreference.kt @@ -507,7 +507,7 @@ sealed interface StashPreference { setter = { prefs, value -> prefs.updateInterfacePreferences { useUpDownPreviousNext = value } }, - summaryOn = R.string.enabled_for_markers, + summaryOn = R.string.enabled_for_scenes_and_markers, summaryOff = R.string.transcode_options_disabled, ) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 5a852fdf6..0dd12907d 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -169,7 +169,7 @@ Use Up/Down for Previous/Next Turn captions on by default Whether to turn captions for the device\'s language on by default - Enabled for marker playlists + Enabled for scene and marker playlists Scroll to next on View All Automatically scroll down to the \'next\' results when clicking View All on main page Scroll to the top of page when pressing the back button