Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use user setting for seeking on Android TV #342

Merged
merged 6 commits into from
Feb 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
7 changes: 7 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,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>
Expand Down Expand Up @@ -364,6 +366,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>
Expand Down Expand Up @@ -401,6 +407,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>
Expand Down
27 changes: 27 additions & 0 deletions app/src/main/res/xml/settings_player.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>