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
This commit is contained in:
Terry Hanoman 2023-02-08 10:46:39 -05:00 committed by GitHub
parent 329966732f
commit 6c646d65a8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 51 additions and 4 deletions

View file

@ -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()

View file

@ -506,4 +506,8 @@
\nInicia sesión en una cuenta de biblioteca o añade series desde tu biblioteca local</string>
<string name="safe_mode_file">¡Se encontró un archivo en modo seguro!
\nNo cargar ninguna extensión al inicio hasta que se elimine el archivo.</string>
<string name="android_tv_interface_on_seek_settings">Jugadora mostrada - buscar cantidad</string>
<string name="android_tv_interface_off_seek_settings">Jugadora oculta - buscar cantidad</string>
<string name="pref_category_android_tv">Android TV</string>
<string name="android_tv_interface_on_seek_settings_summary">La cantidad de búsqueda utilizada cuando la jugadora es visible.</string>
</resources>

View file

@ -31,6 +31,8 @@
<string name="double_tap_enabled_key" translatable="false">double_tap_enabled_key</string>
<string name="double_tap_pause_enabled_key" translatable="false">double_tap_pause_enabled_key</string>
<string name="double_tap_seek_time_key" translatable="false">double_tap_seek_time_key2</string>
<string name="android_tv_interface_off_seek_key" translatable="false">android_tv_interface_off_seek_key</string>
<string name="android_tv_interface_on_seek_key" translatable="false">android_tv_interface_on_seek_key</string>
<string name="swipe_vertical_enabled_key" translatable="false">swipe_vertical_enabled_key</string>
<string name="autoplay_next_key" translatable="false">autoplay_next_key</string>
<string name="display_sub_key" translatable="false">display_sub_key</string>
@ -363,6 +365,10 @@
<string name="video_buffer_length_settings">Video buffer length</string>
<string name="video_buffer_disk_settings">Video cache on disk</string>
<string name="video_buffer_clear_settings">Clear video and image cache</string>
<string name="android_tv_interface_on_seek_settings">Player Shown - Seek Amount</string>
<string name="android_tv_interface_on_seek_settings_summary">The seek amount used when the player is visible</string>
<string name="android_tv_interface_off_seek_settings">Player Hidden - Seek Amount</string>
<string name="android_tv_interface_off_seek_settings_summary">The seek amount used when the player is hidden</string>
<string name="video_ram_description">Causes crashes if set too high on devices with low memory, such as Android TV.</string>
<string name="video_disk_description">Causes problems if set too high on devices with low storage space, such as Android TV.</string>
<string name="dns_pref">DNS over HTTPS</string>
@ -400,6 +406,7 @@
<string name="pref_category_extensions">Extensions</string>
<string name="pref_category_actions">Actions</string>
<string name="pref_category_cache">Cache</string>
<string name="pref_category_android_tv">Android TV</string>
<string name="pref_category_gestures">Gestures</string>
<string name="pref_category_player_features">Player features</string>
<string name="pref_category_subtitles">Subtitles</string>

View file

@ -149,4 +149,31 @@
android:key="@string/video_buffer_clear_key"
android:title="@string/video_buffer_clear_settings" />
</PreferenceCategory>
<PreferenceCategory
android:title="@string/pref_category_android_tv">
<SeekBarPreference
android:defaultValue="10"
android:max="60"
android:title="@string/android_tv_interface_on_seek_settings"
android:summary="@string/android_tv_interface_on_seek_settings_summary"
app:adjustable="true"
app:defaultValue="30"
app:icon="@drawable/go_forward_30"
app:key="@string/android_tv_interface_on_seek_key"
app:min="5"
app:seekBarIncrement="5"
app:showSeekBarValue="true" />
<SeekBarPreference
android:defaultValue="10"
android:max="60"
android:title="@string/android_tv_interface_off_seek_settings"
android:summary="@string/android_tv_interface_off_seek_settings_summary"
app:adjustable="true"
app:defaultValue="10"
app:icon="@drawable/go_forward_30"
app:key="@string/android_tv_interface_off_seek_key"
app:min="5"
app:seekBarIncrement="5"
app:showSeekBarValue="true" />
</PreferenceCategory>
</PreferenceScreen>