From 6c646d65a82fdc9f6e74e58c5539aec78a286ffa Mon Sep 17 00:00:00 2001 From: Terry Hanoman Date: Wed, 8 Feb 2023 10:46:39 -0500 Subject: [PATCH] Use user setting for seeking on Android TV (#342) * Use user setting for seeking on Android TV * Fixed left dpad seeking * Added a Android TV section for seeking * Fixed text * Removed semi-colons --- .../ui/player/FullScreenPlayer.kt | 17 +++++++++--- app/src/main/res/values-es/strings.xml | 4 +++ app/src/main/res/values/strings.xml | 7 +++++ app/src/main/res/xml/settings_player.xml | 27 +++++++++++++++++++ 4 files changed, 51 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt index 2dad05ef..8d28fd9d 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/player/FullScreenPlayer.kt @@ -109,6 +109,8 @@ open class FullScreenPlayer : AbstractPlayerFragment() { protected var currentPrefQuality = Qualities.P2160.value // preferred maximum quality, used for ppl w bad internet or on cell protected var fastForwardTime = 10000L + protected var androidTVInterfaceOffSeekTime = 10000L; + protected var androidTVInterfaceOnSeekTime = 30000L; protected var swipeHorizontalEnabled = false protected var swipeVerticalEnabled = false protected var playBackSpeedEnabled = false @@ -1051,19 +1053,19 @@ open class FullScreenPlayer : AbstractPlayerFragment() { } KeyEvent.KEYCODE_DPAD_LEFT -> { if (!isShowing && !isLocked) { - player.seekTime(-10000L) + player.seekTime(-androidTVInterfaceOffSeekTime) return true } else if (player_pause_play?.isFocused == true) { - player.seekTime(-30000L) + player.seekTime(-androidTVInterfaceOnSeekTime) return true } } KeyEvent.KEYCODE_DPAD_RIGHT -> { if (!isShowing && !isLocked) { - player.seekTime(10000L) + player.seekTime(androidTVInterfaceOffSeekTime) return true } else if (player_pause_play?.isFocused == true) { - player.seekTime(30000L) + player.seekTime(androidTVInterfaceOnSeekTime) return true } } @@ -1207,6 +1209,13 @@ open class FullScreenPlayer : AbstractPlayerFragment() { settingsManager.getInt(ctx.getString(R.string.double_tap_seek_time_key), 10) .toLong() * 1000L + androidTVInterfaceOffSeekTime = + settingsManager.getInt(ctx.getString(R.string.android_tv_interface_off_seek_key), 10) + .toLong() * 1000L + androidTVInterfaceOnSeekTime = + settingsManager.getInt(ctx.getString(R.string.android_tv_interface_on_seek_key), 10) + .toLong() * 1000L + navigationBarHeight = ctx.getNavigationBarHeight() statusBarHeight = ctx.getStatusBarHeight() diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml index 5b6f6f55..d253e256 100644 --- a/app/src/main/res/values-es/strings.xml +++ b/app/src/main/res/values-es/strings.xml @@ -506,4 +506,8 @@ \nInicia sesión en una cuenta de biblioteca o añade series desde tu biblioteca local ¡Se encontró un archivo en modo seguro! \nNo cargar ninguna extensión al inicio hasta que se elimine el archivo. + Jugadora mostrada - buscar cantidad + Jugadora oculta - buscar cantidad + Android TV + La cantidad de búsqueda utilizada cuando la jugadora es visible. \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 3158a7a2..778f34c9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -31,6 +31,8 @@ double_tap_enabled_key double_tap_pause_enabled_key double_tap_seek_time_key2 + android_tv_interface_off_seek_key + android_tv_interface_on_seek_key swipe_vertical_enabled_key autoplay_next_key display_sub_key @@ -363,6 +365,10 @@ Video buffer length Video cache on disk Clear video and image cache + Player Shown - Seek Amount + The seek amount used when the player is visible + Player Hidden - Seek Amount + The seek amount used when the player is hidden Causes crashes if set too high on devices with low memory, such as Android TV. Causes problems if set too high on devices with low storage space, such as Android TV. DNS over HTTPS @@ -400,6 +406,7 @@ Extensions Actions Cache + Android TV Gestures Player features Subtitles diff --git a/app/src/main/res/xml/settings_player.xml b/app/src/main/res/xml/settings_player.xml index d9b7e247..0e5bd84f 100644 --- a/app/src/main/res/xml/settings_player.xml +++ b/app/src/main/res/xml/settings_player.xml @@ -149,4 +149,31 @@ android:key="@string/video_buffer_clear_key" android:title="@string/video_buffer_clear_settings" /> + + + + \ No newline at end of file