[Android] Fix settings crash

Nicolas Pomepuy git at videolan.org
Fri Aug 2 14:35:39 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Thu Aug  1 08:59:03 2019 +0200| [7d7111503c1c5e35ae742296f80d7da305b2db3b] | committer: Nicolas Pomepuy

Fix settings crash

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

 vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt  | 4 ++--
 .../src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.kt       | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
index 60288053b..fabd3bdac 100644
--- a/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/preferences/PreferencesAudio.kt
@@ -24,8 +24,8 @@ package org.videolan.vlc.gui.preferences
 
 import android.content.SharedPreferences
 import android.os.Bundle
-import androidx.preference.CheckBoxPreference
 import androidx.preference.Preference
+import androidx.preference.SwitchPreference
 import androidx.preference.TwoStatePreference
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
@@ -92,7 +92,7 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
                 VLCInstance.restart()
                 (activity as PreferencesActivity).restartMediaPlayer()
                 val opensles = "1" == preferenceManager.sharedPreferences.getString("aout", "0")
-                if (opensles) findPreference<CheckBoxPreference>("audio_digital_output")?.isChecked = false
+                if (opensles) findPreference<SwitchPreference>("audio_digital_output")?.isChecked = false
                 findPreference<Preference>("audio_digital_output")?.isVisible = !opensles
             }
             "audio_digital_output" -> updatePassThroughSummary()
diff --git a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.kt b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.kt
index 2763394c0..ad409d63f 100644
--- a/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.kt
+++ b/vlc-android/src/org/videolan/vlc/gui/tv/preferences/PreferencesAudio.kt
@@ -26,8 +26,8 @@ import android.annotation.TargetApi
 import android.content.SharedPreferences
 import android.os.Build
 import android.os.Bundle
-import androidx.preference.CheckBoxPreference
 import androidx.preference.Preference
+import androidx.preference.SwitchPreference
 import kotlinx.coroutines.ExperimentalCoroutinesApi
 import kotlinx.coroutines.ObsoleteCoroutinesApi
 import org.videolan.libvlc.util.AndroidUtil
@@ -86,7 +86,7 @@ class PreferencesAudio : BasePreferenceFragment(), SharedPreferences.OnSharedPre
                 VLCInstance.restart()
                 if (activity != null) (activity as PreferencesActivity).restartMediaPlayer()
                 val opensles = "1" == preferenceManager.sharedPreferences.getString("aout", "0")
-                if (opensles) findPreference<CheckBoxPreference>("audio_digital_output")?.isChecked = false
+                if (opensles) findPreference<SwitchPreference>("audio_digital_output")?.isChecked = false
                 findPreference<Preference>("audio_digital_output")?.isVisible = !opensles
             }
         }



More information about the Android mailing list