[Android] Migrate the video settings to the visibility manager
Nicolas Pomepuy
git at videolan.org
Wed Apr 2 11:59:28 UTC 2025
vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Wed Apr 2 08:00:51 2025 +0200| [5a9dc43ebd721beb6021bb82a1689ccae1262140] | committer: Duncan McNamara
Migrate the video settings to the visibility manager
> https://code.videolan.org/videolan/vlc-android/commit/5a9dc43ebd721beb6021bb82a1689ccae1262140
---
.../television/ui/preferences/PreferencesVideo.kt | 16 ----------------
.../vlc/gui/preferences/PreferenceVisibilityManager.kt | 5 ++++-
.../org/videolan/vlc/gui/preferences/PreferencesVideo.kt | 3 ---
3 files changed, 4 insertions(+), 20 deletions(-)
diff --git a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
index 23c2d174e2..536b3df5d2 100644
--- a/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
+++ b/application/television/src/main/java/org/videolan/television/ui/preferences/PreferencesVideo.kt
@@ -25,16 +25,10 @@ package org.videolan.television.ui.preferences
import android.annotation.TargetApi
import android.content.SharedPreferences
import android.os.Build
-import android.os.Bundle
-import androidx.preference.Preference
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.launch
import org.videolan.resources.VLCInstance
-import org.videolan.tools.LOCK_USE_SENSOR
-import org.videolan.tools.POPUP_FORCE_LEGACY
-import org.videolan.tools.SAVE_BRIGHTNESS
-import org.videolan.tools.putSingle
import org.videolan.vlc.R
import org.videolan.vlc.gui.helpers.restartMediaPlayer
@@ -45,16 +39,6 @@ class PreferencesVideo : BasePreferenceFragment(), SharedPreferences.OnSharedPre
override fun getTitleId() = R.string.video_prefs_category
- override fun onCreate(savedInstanceState: Bundle?) {
- super.onCreate(savedInstanceState)
-
- findPreference<Preference>("secondary_display_category")?.isVisible = false
- findPreference<Preference>("secondary_display_category_summary")?.isVisible = false
- findPreference<Preference>("enable_clone_mode")?.isVisible = false
- findPreference<Preference>(SAVE_BRIGHTNESS)?.isVisible = false
- findPreference<Preference>(POPUP_FORCE_LEGACY)?.isVisible = false
- }
-
override fun onStart() {
super.onStart()
preferenceScreen.sharedPreferences!!.registerOnSharedPreferenceChangeListener(this)
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferenceVisibilityManager.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferenceVisibilityManager.kt
index 0439884c38..e561893632 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferenceVisibilityManager.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferenceVisibilityManager.kt
@@ -37,7 +37,9 @@ import org.videolan.tools.KEY_APP_THEME
import org.videolan.tools.LIST_TITLE_ELLIPSIZE
import org.videolan.tools.PLAYLIST_MODE_AUDIO
import org.videolan.tools.PLAYLIST_MODE_VIDEO
+import org.videolan.tools.POPUP_FORCE_LEGACY
import org.videolan.tools.RESUME_PLAYBACK
+import org.videolan.tools.SAVE_BRIGHTNESS
import org.videolan.tools.TV_FOLDERS_FIRST
import org.videolan.vlc.BuildConfig
import org.videolan.vlc.VlcMigrationHelper
@@ -58,12 +60,13 @@ object PreferenceVisibilityManager {
RESUME_PLAYBACK -> AndroidDevices.isPhone && !forTv
KEY_AOUT -> VlcMigrationHelper.getAudioOutputFromDevice() == VlcMigrationHelper.AudioOutput.ALL
"audio_digital_output" -> sharedPreferences.getString("aout", "0") != "2"
- KEY_APP_THEME, LIST_TITLE_ELLIPSIZE, "enable_headset_detection", "enable_play_on_headset_insertion", "ignore_headset_media_button_presses", "headset_prefs_category" -> !forTv
+ "secondary_display_category", "secondary_display_category_summary", "enable_clone_mode", SAVE_BRIGHTNESS, KEY_APP_THEME, LIST_TITLE_ELLIPSIZE, "enable_headset_detection", "enable_play_on_headset_insertion", "ignore_headset_media_button_presses", "headset_prefs_category" -> !forTv
TV_FOLDERS_FIRST, BROWSER_SHOW_HIDDEN_FILES, PLAYLIST_MODE_VIDEO, PLAYLIST_MODE_AUDIO -> forTv
"optional_features" -> FeatureFlag.entries.isNotEmpty()
"show_update" -> !forTv && BuildConfig.DEBUG
"quick_play" -> !forTv
"quick_play_default" -> !forTv
+ POPUP_FORCE_LEGACY -> AndroidUtil.isOOrLater && !forTv
else -> true
}
diff --git a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
index d65668a5d1..814b88d6e7 100644
--- a/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
+++ b/application/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesVideo.kt
@@ -25,9 +25,7 @@ package org.videolan.vlc.gui.preferences
import android.content.SharedPreferences
import android.os.Bundle
import androidx.lifecycle.lifecycleScope
-import androidx.preference.Preference
import kotlinx.coroutines.launch
-import org.videolan.libvlc.util.AndroidUtil
import org.videolan.resources.VLCInstance
import org.videolan.tools.POPUP_FORCE_LEGACY
import org.videolan.tools.PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER
@@ -46,7 +44,6 @@ class PreferencesVideo : BasePreferenceFragment(), SharedPreferences.OnSharedPre
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- findPreference<Preference>(POPUP_FORCE_LEGACY)?.isVisible = AndroidUtil.isOOrLater
if (Settings.getInstance(requireContext()).getBoolean(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)) {
UiTools.snackerConfirm(requireActivity(), requireActivity().getString(R.string.video_settings_disclaimer), indefinite = true) {
Settings.getInstance(requireContext()).putSingle(PREF_SHOW_VIDEO_SETTINGS_DISCLAIMER, false)
More information about the Android
mailing list