[Android] Fix ClassCastException for Audio output preference

Nicolas Pomepuy git at videolan.org
Tue Aug 13 10:17:08 CEST 2019


vlc-android | branch: master | Nicolas Pomepuy <nicolas.pomepuy at gmail.com> | Mon Aug 12 07:06:58 2019 +0200| [597da4fd2ee30040e3b2f8a3af853fc9ce569dcd] | committer: Nicolas Pomepuy

Fix ClassCastException for Audio output preference

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

 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 fabd3bdac..60288053b 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<SwitchPreference>("audio_digital_output")?.isChecked = false
+                if (opensles) findPreference<CheckBoxPreference>("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 ad409d63f..2763394c0 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<SwitchPreference>("audio_digital_output")?.isChecked = false
+                if (opensles) findPreference<CheckBoxPreference>("audio_digital_output")?.isChecked = false
                 findPreference<Preference>("audio_digital_output")?.isVisible = !opensles
             }
         }



More information about the Android mailing list