[Android] Add the quick play advanced settings
Nicolas Pomepuy
git at videolan.org
Wed Mar 26 09:45:19 UTC 2025
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Thu Mar 6 09:23:25 2025 +0100| [192aaeb80315397ec2a87047a793495047048eb6] | committer: Nicolas Pomepuy
Add the quick play advanced settings
> https://code.videolan.org/videolan/vlc-android/commit/192aaeb80315397ec2a87047a793495047048eb6
---
application/resources/src/main/res/values/strings.xml | 4 ++++
.../television/ui/preferences/PreferencesAdvanced.kt | 3 +++
.../tools/src/main/java/org/videolan/tools/Settings.kt | 2 ++
application/vlc-android/res/xml/preferences_adv.xml | 13 +++++++++++++
.../videolan/vlc/gui/preferences/PreferencesAdvanced.kt | 17 ++++++++++++-----
5 files changed, 34 insertions(+), 5 deletions(-)
diff --git a/application/resources/src/main/res/values/strings.xml b/application/resources/src/main/res/values/strings.xml
index 904d203e43..a30093b57c 100644
--- a/application/resources/src/main/res/values/strings.xml
+++ b/application/resources/src/main/res/values/strings.xml
@@ -609,6 +609,10 @@
<string name="custom_libvlc_options_invalid">Invalid libVLC options!</string>
<string name="dav1d_thread_number">Dav1d thread number</string>
<string name="dav1d_thread_number_invalid">Invalid thread number! (>=1)</string>
+ <string name="browser_quick_play">Browser quick play menu</string>
+ <string name="browser_quick_play_summary">Add a quick play action in the browser items\' menu. It will load your media faster but some metadata may be missing</string>
+ <string name="browser_quick_play_default">Quick play as default action</string>
+ <string name="browser_quick_play_default_summary">If activated, taping a browser item will play it using quick play</string>
<string name="serious_crash">Unfortunately, a serious error has occurred and VLC had to close.</string>
<string name="help_us_send_log">Help us improving VLC by sending the following crash log:</string>
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
index 1187134bf1..359c6493b7 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesAdvanced.kt
@@ -40,6 +40,7 @@ import androidx.core.os.bundleOf
import androidx.core.text.isDigitsOnly
import androidx.fragment.app.FragmentActivity
import androidx.lifecycle.lifecycleScope
+import androidx.preference.CheckBoxPreference
import androidx.preference.EditTextPreference
import androidx.preference.Preference
import kotlinx.coroutines.CoroutineScope
@@ -107,6 +108,8 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (FeatureFlag.values().isNotEmpty()) findPreference<Preference>("optional_features")?.isVisible = true
+ findPreference<CheckBoxPreference>("quick_play")?.isVisible = false
+ findPreference<CheckBoxPreference>("quick_play_default")?.isVisible = false
}
override fun onDisplayPreferenceDialog(preference: Preference) {
diff --git a/application/tools/src/main/java/org/videolan/tools/Settings.kt b/application/tools/src/main/java/org/videolan/tools/Settings.kt
index ef529c1b48..3a972f2839 100644
--- a/application/tools/src/main/java/org/videolan/tools/Settings.kt
+++ b/application/tools/src/main/java/org/videolan/tools/Settings.kt
@@ -246,6 +246,8 @@ const val NOTIFICATION_PERMISSION_ASKED = "notification_permission_asked"
const val PLAYLIST_REPLACE = "playlist_replace"
const val HTTP_USER_AGENT = "http_user_agent"
const val DAV1D_THREAD_NUMBER = "dav1d_thread_number"
+const val KEY_QUICK_PLAY = "quick_play"
+const val KEY_QUICK_PLAY_DEFAULT = "quick_play_default"
//files
const val BROWSER_SHOW_HIDDEN_FILES = "browser_show_hidden_files"
diff --git a/application/vlc-android/res/xml/preferences_adv.xml b/application/vlc-android/res/xml/preferences_adv.xml
index 8882f94b02..3816cbaad8 100644
--- a/application/vlc-android/res/xml/preferences_adv.xml
+++ b/application/vlc-android/res/xml/preferences_adv.xml
@@ -114,6 +114,19 @@
android:key="dav1d_thread_number"
app:useSimpleSummaryProvider="true"
android:title="@string/dav1d_thread_number"/>
+ <CheckBoxPreference
+ app:singleLineTitle="false"
+ android:defaultValue="false"
+ android:key="quick_play"
+ android:summary="@string/browser_quick_play_summary"
+ android:title="@string/browser_quick_play"/>
+ <CheckBoxPreference
+ app:singleLineTitle="false"
+ android:defaultValue="false"
+ android:key="quick_play_default"
+ android:dependency="quick_play"
+ android:summary="@string/browser_quick_play_default_summary"
+ android:title="@string/browser_quick_play_default"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/developer_prefs_category">
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
index a80d2c0fd3..2aa8efb7f6 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt
@@ -40,15 +40,14 @@ import androidx.core.content.edit
import androidx.core.os.bundleOf
import androidx.core.text.isDigitsOnly
import androidx.fragment.app.FragmentActivity
-import androidx.fragment.app.setFragmentResultListener
import androidx.lifecycle.lifecycleScope
+import androidx.preference.CheckBoxPreference
import androidx.preference.EditTextPreference
import androidx.preference.Preference
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import org.videolan.medialibrary.interfaces.Medialibrary
-import org.videolan.medialibrary.media.MediaLibraryItem
import org.videolan.resources.AndroidDevices
import org.videolan.resources.EXPORT_SETTINGS_FILE
import org.videolan.resources.KEY_AUDIO_LAST_PLAYLIST
@@ -63,9 +62,11 @@ import org.videolan.resources.KEY_MEDIA_LAST_PLAYLIST_RESUME
import org.videolan.resources.ROOM_DATABASE
import org.videolan.resources.SCHEME_PACKAGE
import org.videolan.resources.VLCInstance
-import org.videolan.resources.util.parcelableList
import org.videolan.tools.BitmapCache
import org.videolan.tools.DAV1D_THREAD_NUMBER
+import org.videolan.tools.KEY_QUICK_PLAY
+import org.videolan.tools.KEY_QUICK_PLAY_DEFAULT
+import org.videolan.tools.RESULT_RESTART
import org.videolan.tools.Settings
import org.videolan.tools.putSingle
import org.videolan.vlc.BuildConfig
@@ -74,7 +75,6 @@ import org.videolan.vlc.gui.DebugLogActivity
import org.videolan.vlc.gui.browser.EXTRA_MRL
import org.videolan.vlc.gui.browser.FilePickerActivity
import org.videolan.vlc.gui.browser.KEY_PICKER_TYPE
-import org.videolan.vlc.gui.dialogs.CONFIRM_DELETE_DIALOG_MEDIALIST
import org.videolan.vlc.gui.dialogs.CONFIRM_DELETE_DIALOG_RESULT
import org.videolan.vlc.gui.dialogs.CONFIRM_DELETE_DIALOG_RESULT_VALUE
import org.videolan.vlc.gui.dialogs.ConfirmDeleteDialog
@@ -88,7 +88,6 @@ import org.videolan.vlc.gui.helpers.UiTools
import org.videolan.vlc.gui.helpers.hf.StoragePermissionsDelegate.Companion.getWritePermission
import org.videolan.vlc.gui.helpers.restartMediaPlayer
import org.videolan.vlc.gui.preferences.search.PreferenceParser
-import org.videolan.vlc.media.MediaUtils
import org.videolan.vlc.providers.PickerType
import org.videolan.vlc.util.AutoUpdate
import org.videolan.vlc.util.FeatureFlag
@@ -332,6 +331,14 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
}
return true
}
+ KEY_QUICK_PLAY -> {
+ val activity = activity
+ activity?.setResult(RESULT_RESTART)
+ if (!(preference as CheckBoxPreference).isChecked) {
+ findPreference<CheckBoxPreference>(KEY_QUICK_PLAY_DEFAULT)?.isChecked = false
+ }
+ return true
+ }
"restore_settings" -> {
val filePickerIntent = Intent(requireContext(), FilePickerActivity::class.java)
filePickerIntent.putExtra(KEY_PICKER_TYPE, PickerType.SETTINGS.ordinal)
More information about the Android
mailing list