[Android] Remove useless actions when changing the aout settings

Nicolas Pomepuy git at videolan.org
Tue Apr 1 12:53:22 UTC 2025


vlc-android | branch: master | Nicolas Pomepuy <nicolas at videolabs.io> | Tue Apr  1 13:09:06 2025 +0200| [c7b2b91dd7e90eb89018163a6a836432668480e5] | committer: Nicolas Pomepuy

Remove useless actions when changing the aout settings

> https://code.videolan.org/videolan/vlc-android/commit/c7b2b91dd7e90eb89018163a6a836432668480e5
---

 .../org/videolan/television/ui/preferences/PreferencesAdvanced.kt   | 6 +++---
 .../src/org/videolan/vlc/gui/preferences/PreferencesAdvanced.kt     | 6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

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 d568864596..bdd4450dd8 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
@@ -354,9 +354,9 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
         when (key) {
             KEY_AOUT -> {
                 launch { restartLibVLC() }
-                val opensles = "2" == preferenceManager.sharedPreferences!!.getString(KEY_AOUT, "0")
-                if (opensles) findPreference<CheckBoxPreference>("audio_digital_output")?.isChecked = false
-                findPreference<Preference>("audio_digital_output")?.isVisible = !opensles
+                Settings.getInstance(activity).let {
+                    if (it.getString(KEY_AOUT, "0") == "2") it.putSingle("audio_digital_output", false)
+                }
             }
             "network_caching" -> {
                 sharedPreferences.edit {
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 48470de814..bf8d7793cd 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
@@ -390,9 +390,9 @@ class PreferencesAdvanced : BasePreferenceFragment(), SharedPreferences.OnShared
         when (key) {
             KEY_AOUT -> {
                 lifecycleScope.launch { restartLibVLC() }
-                val opensles = "2" == preferenceManager.sharedPreferences!!.getString(KEY_AOUT, "0")
-                if (opensles) findPreference<CheckBoxPreference>("audio_digital_output")?.isChecked = false
-                findPreference<Preference>("audio_digital_output")?.isVisible = !opensles
+                Settings.getInstance(requireActivity()).let {
+                    if (it.getString(KEY_AOUT, "0") == "2") it.putSingle("audio_digital_output", false)
+                }
             }
             "network_caching" -> {
                 sharedPreferences.edit {



More information about the Android mailing list