add string resources and remaining preference keys

This commit is contained in:
Ida Delphine
2026-10-07 16:59:43 +08:00
committed by Aayush Gupta
parent 939ff4254f
commit 62784f3cad
3 changed files with 153 additions and 2 deletions
@@ -89,4 +89,67 @@
<string name="best_resolution">Best resolution</string>
<string name="limit_data_usage_none_description">No limit</string>
<!-- Video/Audio Settings: Player section -->
<string name="settings_category_player_title">Player</string>
<string name="use_external_video_player_title">Use external video player</string>
<string name="use_external_video_player_summary">Removes audio at some resolutions</string>
<string name="use_external_audio_player_title">Use external audio player</string>
<string name="show_play_with_kodi_title">Show \"Play with Kodi\" option</string>
<string name="show_play_with_kodi_summary">Display an option to play a video via Kodi media center</string>
<string name="seekbar_preview_thumbnail_title">Seekbar thumbnail preview</string>
<string name="high_quality_larger">High quality (larger)</string>
<string name="low_quality_smaller">Low quality (smaller)</string>
<string name="dont_show">Don\'t show</string>
<!-- Video/Audio Settings: Behavior section -->
<string name="settings_category_player_behavior_title">Behavior</string>
<string name="preferred_open_action_settings_title">Preferred \'open\' action</string>
<string name="preferred_open_action_settings_summary">Default action when opening content — %1$s</string>
<string name="show_info">Show info</string>
<string name="video_player">Video player</string>
<string name="background_player">Background player</string>
<string name="popup_player">Popup player</string>
<string name="download">Download</string>
<string name="add_to_playlist">Add to playlist</string>
<string name="enqueue_stream">Enqueue</string>
<string name="always_ask_open_action">Always ask</string>
<string name="minimize_on_exit_title">Minimize on app switch</string>
<string name="minimize_on_exit_summary">Action when switching to other app from main video player — %1$s</string>
<string name="minimize_on_exit_none_description">None</string>
<string name="minimize_on_exit_background_description">Minimize to background player</string>
<string name="minimize_on_exit_popup_description">Minimize to popup player</string>
<string name="start_main_player_fullscreen_title">Start main player in fullscreen</string>
<string name="start_main_player_fullscreen_summary">Do not start videos in the mini player, but turn to fullscreen mode directly, if auto rotation is locked. You can still access the mini player by exiting fullscreen</string>
<string name="autoplay_title">Autoplay</string>
<string name="autoplay_summary">Start playback automatically — %1$s</string>
<string name="always">Always</string>
<string name="wifi_only">Only on Wi-Fi</string>
<string name="never">Never</string>
<string name="auto_queue_title">Auto-enqueue next stream</string>
<string name="auto_queue_summary">Continue ending (non-repeating) playback queue by appending a related stream</string>
<string name="resume_on_audio_focus_gain_title">Resume playing</string>
<string name="resume_on_audio_focus_gain_summary">Continue playing after interruptions (e.g. phonecalls)</string>
<string name="left_gesture_control_title">Left gesture action</string>
<string name="left_gesture_control_summary">Choose gesture for left half of player screen</string>
<string name="right_gesture_control_title">Right gesture action</string>
<string name="right_gesture_control_summary">Choose gesture for right half of player screen</string>
<string name="brightness">Brightness</string>
<string name="volume">Volume</string>
<string name="none">None</string>
<string name="popup_remember_size_pos_title">Remember popup properties</string>
<string name="popup_remember_size_pos_summary">Remember last size and position of popup</string>
<string name="use_inexact_seek_title">Use fast inexact seek</string>
<string name="use_inexact_seek_summary">Inexact seek allows the player to seek to positions faster with reduced precision. Seeking for 5, 15 or 25 seconds doesn\'t work with this</string>
<string name="seek_duration_title">Fast-forward/-rewind seek duration</string>
<string name="new_seek_duration_toast">Due to ExoPlayer constraints the seek duration was set to %1$d seconds</string>
<string name="clear_queue_confirmation_title">Ask for confirmation before clearing a queue</string>
<string name="clear_queue_confirmation_summary">Switching from one player to another may replace your queue</string>
<string name="ignore_hardware_media_buttons_title">Ignore hardware media button events</string>
<string name="ignore_hardware_media_buttons_summary">Useful, for instance, if you are using a headset with broken physical buttons</string>
<plurals name="seconds">
<item quantity="one">%1$d second</item>
<item quantity="other">%1$d seconds</item>
</plurals>
</resources>
@@ -0,0 +1,2 @@
package net.newpipe.app.composable
@@ -19,6 +19,27 @@ object VideoAudioPreferences {
const val KEY_PREFER_ORIGINAL_AUDIO = "prefer_original_audio"
const val KEY_PREFER_DESCRIPTIVE_AUDIO = "prefer_descriptive_audio"
// Player section
const val KEY_USE_EXTERNAL_VIDEO_PLAYER = "use_external_video_player"
const val KEY_USE_EXTERNAL_AUDIO_PLAYER = "use_external_audio_player"
const val KEY_SHOW_PLAY_WITH_KODI = "show_play_with_kodi"
const val KEY_SEEKBAR_PREVIEW_THUMBNAIL = "seekbar_preview_thumbnail_key"
// Behavior section
const val KEY_PREFERRED_OPEN_ACTION = "preferred_open_action_key"
const val KEY_MINIMIZE_ON_EXIT = "minimize_on_exit_key"
const val KEY_START_MAIN_PLAYER_FULLSCREEN = "start_main_player_fullscreen_key"
const val KEY_AUTOPLAY = "autoplay_key"
const val KEY_AUTO_QUEUE = "auto_queue_key"
const val KEY_RESUME_ON_AUDIO_FOCUS_GAIN = "resume_on_audio_focus_gain"
const val KEY_LEFT_GESTURE_CONTROL = "left_gesture_control"
const val KEY_RIGHT_GESTURE_CONTROL = "right_gesture_control"
const val KEY_POPUP_REMEMBER_SIZE_POS = "popup_remember_size_pos_key"
const val KEY_USE_INEXACT_SEEK = "use_inexact_seek_key"
const val KEY_SEEK_DURATION = "seek_duration"
const val KEY_CLEAR_QUEUE_CONFIRMATION = "clear_queue_confirmation_key"
const val KEY_IGNORE_HARDWARE_MEDIA_BUTTONS = "ignore_hardware_media_buttons_key"
// Special resolution values that need a localized label
const val BEST_RESOLUTION = "best_resolution"
const val LIMIT_DATA_USAGE_NONE = "limit_data_usage_none"
@@ -30,6 +51,36 @@ object VideoAudioPreferences {
const val AUDIO_M4A = "audio_m4a"
const val AUDIO_WEBM = "audio_webm"
// Seekbar preview thumbnail values.
const val SEEKBAR_THUMBNAIL_HIGH_QUALITY = "seekbar_preview_thumbnail_high_quality"
const val SEEKBAR_THUMBNAIL_LOW_QUALITY = "seekbar_preview_thumbnail_low_quality"
const val SEEKBAR_THUMBNAIL_NONE = "seekbar_preview_thumbnail_none"
// Preferred open action values.
const val OPEN_ACTION_SHOW_INFO = "show_info"
const val OPEN_ACTION_VIDEO_PLAYER = "video_player"
const val OPEN_ACTION_BACKGROUND_PLAYER = "background_player"
const val OPEN_ACTION_POPUP_PLAYER = "popup_player"
const val OPEN_ACTION_DOWNLOAD = "download"
const val OPEN_ACTION_ADD_TO_PLAYLIST = "add_to_playlist"
const val OPEN_ACTION_ENQUEUE = "enqueue"
const val OPEN_ACTION_ALWAYS_ASK = "always_ask_player"
// Minimize on exit values.
const val MINIMIZE_ON_EXIT_NONE = "minimize_on_exit_none_key"
const val MINIMIZE_ON_EXIT_BACKGROUND = "minimize_on_exit_background_key"
const val MINIMIZE_ON_EXIT_POPUP = "minimize_on_exit_popup_key"
// Autoplay values.
const val AUTOPLAY_ALWAYS = "autoplay_always_key"
const val AUTOPLAY_WIFI = "autoplay_wifi_key"
const val AUTOPLAY_NEVER = "autoplay_never_key"
// Player gesture values.
const val GESTURE_BRIGHTNESS = "brightness_control"
const val GESTURE_VOLUME = "volume_control"
const val GESTURE_NONE = "none_control"
const val DEFAULT_RESOLUTION = "720p60"
const val DEFAULT_POPUP_RESOLUTION = "480p"
const val DEFAULT_LIMIT_MOBILE_DATA_USAGE = LIMIT_DATA_USAGE_NONE
@@ -38,6 +89,25 @@ object VideoAudioPreferences {
const val DEFAULT_AUDIO_FORMAT = AUDIO_M4A
const val DEFAULT_PREFER_ORIGINAL_AUDIO = true
const val DEFAULT_PREFER_DESCRIPTIVE_AUDIO = false
const val DEFAULT_USE_EXTERNAL_VIDEO_PLAYER = false
const val DEFAULT_USE_EXTERNAL_AUDIO_PLAYER = false
const val DEFAULT_SHOW_PLAY_WITH_KODI = false
const val DEFAULT_SEEKBAR_PREVIEW_THUMBNAIL = SEEKBAR_THUMBNAIL_HIGH_QUALITY
const val DEFAULT_PREFERRED_OPEN_ACTION = OPEN_ACTION_ALWAYS_ASK
const val DEFAULT_MINIMIZE_ON_EXIT = MINIMIZE_ON_EXIT_BACKGROUND
const val DEFAULT_START_MAIN_PLAYER_FULLSCREEN = false
const val DEFAULT_AUTOPLAY = AUTOPLAY_WIFI
const val DEFAULT_AUTO_QUEUE = false
const val DEFAULT_RESUME_ON_AUDIO_FOCUS_GAIN = false
const val DEFAULT_LEFT_GESTURE_CONTROL = GESTURE_BRIGHTNESS
const val DEFAULT_RIGHT_GESTURE_CONTROL = GESTURE_VOLUME
const val DEFAULT_POPUP_REMEMBER_SIZE_POS = true
const val DEFAULT_USE_INEXACT_SEEK = false
const val DEFAULT_SEEK_DURATION_MS = "10000"
const val DEFAULT_CLEAR_QUEUE_CONFIRMATION = false
const val DEFAULT_IGNORE_HARDWARE_MEDIA_BUTTONS = false
private const val MILLIS_PER_SECOND = 1000
/** Higher resolutions, hidden behind the "show higher resolutions" toggle. */
val HIGH_RESOLUTIONS = listOf("2160p", "1440p")
@@ -56,10 +126,26 @@ object VideoAudioPreferences {
val AUDIO_FORMATS = listOf(AUDIO_M4A to "M4A", AUDIO_WEBM to "WebM")
/** Seek durations in milliseconds, stored as strings like the legacy app. */
val SEEK_DURATIONS_MS = listOf("5000", "10000", "15000", "20000", "25000", "30000")
fun resolutions(showHigher: Boolean): List<String> = insertHighResolutions(BASE_RESOLUTIONS, showHigher)
fun mobileDataResolutions(showHigher: Boolean): List<String> = insertHighResolutions(BASE_MOBILE_DATA_RESOLUTIONS, showHigher)
private fun insertHighResolutions(base: List<String>, showHigher: Boolean): List<String> =
if (!showHigher) base else base.toMutableList().apply { addAll(1, HIGH_RESOLUTIONS) }
fun seekDurationSeconds(durationMs: String): Int = durationMs.toInt() / MILLIS_PER_SECOND
/** ExoPlayer can't inexact-seek in 5-second steps in audio, so those durations are hidden. */
fun seekDurationsMs(inexactSeek: Boolean): List<String> = if (!inexactSeek) SEEK_DURATIONS_MS else SEEK_DURATIONS_MS.filter { seekDurationSeconds(it) % 10 != 5 }
/**
* The seek duration to switch to when [inexactSeek] hides the currently selected one or null when no adjustment is needed.
*/
fun adjustedSeekDurationMs(currentMs: String, inexactSeek: Boolean): String? {
if (!inexactSeek) return null
val seconds = seekDurationSeconds(currentMs)
return if (seconds % 10 == 5) ((seconds + 5) * MILLIS_PER_SECOND).toString() else null
}
private fun insertHighResolutions(base: List<String>, showHigher: Boolean): List<String> = if (!showHigher) base else base.toMutableList().apply { addAll(1, HIGH_RESOLUTIONS) }
}