sm6150-common: parts: Convert to SwitchPreferenceCompat

Change-Id: Ic1cbaba37d499da1855af9c3930f2df426e2d3af
This commit is contained in:
Michael Bestas 2024-03-08 20:15:39 +02:00 committed by basamaryan
parent e6c443b3bf
commit f6ca8c44ba
No known key found for this signature in database
GPG Key ID: 0A28C6D8648B81DD
2 changed files with 16 additions and 16 deletions

View File

@ -24,7 +24,7 @@
android:key="doze_enable"
android:title="@string/ambient_enable" />
<SwitchPreference
<SwitchPreferenceCompat
android:key="always_on_display"
android:disableDependentsState="true"
android:icon="@drawable/ic_doze_aod"
@ -44,7 +44,7 @@
android:key="gestures"
android:title="@string/ambient_display_gestures_title">
<SwitchPreference
<SwitchPreferenceCompat
android:key="wake_on_gesture"
android:defaultValue="false"
android:icon="@drawable/ic_doze_wake"
@ -57,7 +57,7 @@
android:key="pickup_sensor"
android:title="@string/pickup_sensor_title">
<SwitchPreference
<SwitchPreferenceCompat
android:key="gesture_pick_up"
android:defaultValue="false"
android:icon="@drawable/ic_doze_pickup"
@ -70,14 +70,14 @@
android:key="proximity_sensor"
android:title="@string/proximity_sensor_title">
<SwitchPreference
<SwitchPreferenceCompat
android:key="gesture_hand_wave"
android:defaultValue="false"
android:icon="@drawable/ic_doze_hand"
android:title="@string/hand_wave_gesture_title"
android:summary="@string/hand_wave_gesture_summary" />
<SwitchPreference
<SwitchPreferenceCompat
android:key="gesture_pocket"
android:defaultValue="false"
android:icon="@drawable/ic_doze_pocket"

View File

@ -33,7 +33,7 @@ import androidx.preference.Preference;
import androidx.preference.Preference.OnPreferenceChangeListener;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import androidx.preference.SwitchPreferenceCompat;
import com.android.settingslib.widget.MainSwitchPreference;
@ -44,12 +44,12 @@ public class DozeSettingsFragment extends PreferenceFragment
implements OnPreferenceChangeListener, OnCheckedChangeListener {
private MainSwitchPreference mSwitchBar;
private SwitchPreference mAlwaysOnDisplayPreference;
private SwitchPreferenceCompat mAlwaysOnDisplayPreference;
private ListPreference mDozeBrightnessPreference;
private SwitchPreference mWakeOnGesturePreference;
private SwitchPreference mPickUpPreference;
private SwitchPreference mHandwavePreference;
private SwitchPreference mPocketPreference;
private SwitchPreferenceCompat mWakeOnGesturePreference;
private SwitchPreferenceCompat mPickUpPreference;
private SwitchPreferenceCompat mHandwavePreference;
private SwitchPreferenceCompat mPocketPreference;
private Handler mHandler = new Handler();
@ -69,7 +69,7 @@ public class DozeSettingsFragment extends PreferenceFragment
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.setChecked(dozeEnabled);
mAlwaysOnDisplayPreference = (SwitchPreference) findPreference(DozeUtils.ALWAYS_ON_DISPLAY);
mAlwaysOnDisplayPreference = (SwitchPreferenceCompat) findPreference(DozeUtils.ALWAYS_ON_DISPLAY);
mAlwaysOnDisplayPreference.setEnabled(dozeEnabled);
mAlwaysOnDisplayPreference.setChecked(DozeUtils.isAlwaysOnEnabled(getActivity()));
mAlwaysOnDisplayPreference.setOnPreferenceChangeListener(this);
@ -89,19 +89,19 @@ public class DozeSettingsFragment extends PreferenceFragment
(PreferenceCategory) getPreferenceScreen().findPreference(
DozeUtils.CATEG_PROX_SENSOR);
mWakeOnGesturePreference = (SwitchPreference) findPreference(DozeUtils.WAKE_ON_GESTURE_KEY);
mWakeOnGesturePreference = (SwitchPreferenceCompat) findPreference(DozeUtils.WAKE_ON_GESTURE_KEY);
mWakeOnGesturePreference.setEnabled(dozeEnabled);
mWakeOnGesturePreference.setOnPreferenceChangeListener(this);
mPickUpPreference = (SwitchPreference) findPreference(DozeUtils.GESTURE_PICK_UP_KEY);
mPickUpPreference = (SwitchPreferenceCompat) findPreference(DozeUtils.GESTURE_PICK_UP_KEY);
mPickUpPreference.setEnabled(dozeEnabled);
mPickUpPreference.setOnPreferenceChangeListener(this);
mHandwavePreference = (SwitchPreference) findPreference(DozeUtils.GESTURE_HAND_WAVE_KEY);
mHandwavePreference = (SwitchPreferenceCompat) findPreference(DozeUtils.GESTURE_HAND_WAVE_KEY);
mHandwavePreference.setEnabled(dozeEnabled);
mHandwavePreference.setOnPreferenceChangeListener(this);
mPocketPreference = (SwitchPreference) findPreference(DozeUtils.GESTURE_POCKET_KEY);
mPocketPreference = (SwitchPreferenceCompat) findPreference(DozeUtils.GESTURE_POCKET_KEY);
mPocketPreference.setEnabled(dozeEnabled);
mPocketPreference.setOnPreferenceChangeListener(this);