Skip to content

Commit

Permalink
sdm845-common: parts: Convert to SwitchPreferenceCompat
Browse files Browse the repository at this point in the history
  • Loading branch information
bgcngm authored and RahulGorai0206 committed Apr 20, 2024
1 parent 64cfb7e commit 9dff347
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
8 changes: 4 additions & 4 deletions parts/res/xml/doze_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
android:key="doze_enable"
android:title="@string/ambient_display_enable_title" />

<SwitchPreference
<SwitchPreferenceCompat
android:key="always_on_display"
android:disableDependentsState="true"
android:title="@string/ambient_display_always_on_title"
Expand All @@ -39,7 +39,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_pickup"
Expand All @@ -52,14 +52,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_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_pocket"
Expand Down
18 changes: 9 additions & 9 deletions parts/src/org/lineageos/settings/doze/DozeSettingsFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragment;
import androidx.preference.SwitchPreference;
import androidx.preference.SwitchPreferenceCompat;

import com.android.settingslib.widget.MainSwitchPreference;
import com.android.settingslib.widget.OnMainSwitchChangeListener;
Expand All @@ -43,11 +43,11 @@ public class DozeSettingsFragment extends PreferenceFragment implements

private MainSwitchPreference mSwitchBar;

private SwitchPreference mAlwaysOnDisplayPreference;
private SwitchPreferenceCompat mAlwaysOnDisplayPreference;

private SwitchPreference mPickUpPreference;
private SwitchPreference mHandwavePreference;
private SwitchPreference mPocketPreference;
private SwitchPreferenceCompat mPickUpPreference;
private SwitchPreferenceCompat mHandwavePreference;
private SwitchPreferenceCompat mPocketPreference;

private Handler mHandler = new Handler();

Expand All @@ -67,7 +67,7 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
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);
Expand All @@ -77,15 +77,15 @@ public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
PreferenceCategory proximitySensorCategory = (PreferenceCategory) getPreferenceScreen().
findPreference(DozeUtils.CATEG_PROX_SENSOR);

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);

Expand Down

0 comments on commit 9dff347

Please sign in to comment.