dap: Migrate to SelectorWithWidgetPreference
authorLuK1337 <priv.luk@gmail.com>
Wed, 20 Mar 2024 08:21:59 +0000 (09:21 +0100)
committerLuK1337 <priv.luk@gmail.com>
Wed, 20 Mar 2024 15:54:31 +0000 (16:54 +0100)
Change-Id: Ie4aaa1fff836a407c1d8f5b919b7b0051748f5d3

dap/res/xml/dolby_settings.xml
dap/src/org/lineageos/dap/DolbyFragment.kt

index a494eb6ff774e5b9ca02444ac24824f46c447ac4..94f829c206261a4c30a4b976bef41b20ad7c4bac 100644 (file)
         android:key="dolby_top_intro"
         android:title="@string/dolby_top_intro_summary" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:defaultValue="true"
         android:key="dolby_profile_auto"
         android:title="@string/dolby_profile_auto" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_game"
         android:title="@string/dolby_profile_game" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_game_1"
         android:title="@string/dolby_profile_game_1" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_game_2"
         android:title="@string/dolby_profile_game_2" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_movie"
         android:title="@string/dolby_profile_movie" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_music"
         android:title="@string/dolby_profile_music" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_off"
         android:title="@string/dolby_profile_off" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_spacial_audio"
         android:title="@string/dolby_profile_spacial_audio" />
 
-    <com.android.settingslib.widget.RadioButtonPreference
+    <com.android.settingslib.widget.SelectorWithWidgetPreference
         android:key="dolby_profile_voice"
         android:title="@string/dolby_profile_voice" />
 
index 29834343dd143d763cbfba8935308e3003d69de1..ff68a90a29c274ea0b3795c674d4df4e72c80f4a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The LineageOS Project
+ * Copyright (C) 2022-2024 The LineageOS Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,7 +23,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener
 import androidx.preference.PreferenceFragment
 
 import com.android.settingslib.widget.MainSwitchPreference
-import com.android.settingslib.widget.RadioButtonPreference
+import com.android.settingslib.widget.SelectorWithWidgetPreference
 
 import org.lineageos.dap.R
 
@@ -39,7 +39,7 @@ class DolbyFragment : PreferenceFragment(), OnCheckedChangeListener {
         switchBar.isChecked = DolbyCore.isEnabled()
 
         for ((key, value) in PREF_DOLBY_MODES) {
-            val preference = findPreference<RadioButtonPreference>(key)!!
+            val preference = findPreference<SelectorWithWidgetPreference>(key)!!
             preference.setOnPreferenceClickListener {
                 setProfile(value)
                 true
@@ -55,7 +55,7 @@ class DolbyFragment : PreferenceFragment(), OnCheckedChangeListener {
         DolbyCore.setProfile(profile)
 
         for ((key, value) in PREF_DOLBY_MODES) {
-            val preference = findPreference<RadioButtonPreference>(key)!!
+            val preference = findPreference<SelectorWithWidgetPreference>(key)!!
             preference.isChecked = value == profile
         }
     }