Search in sources :

Example 46 with ListPreference

use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ZenRuleMessagesPreferenceController method updateFromContactsValue.

private void updateFromContactsValue(Preference preference) {
    if (mRule == null || mRule.getZenPolicy() == null) {
        return;
    }
    ListPreference listPreference = (ListPreference) preference;
    listPreference.setSummary(mBackend.getContactsMessagesSummary(mRule.getZenPolicy()));
    final String currentVal = ZenModeBackend.getKeyFromZenPolicySetting(mRule.getZenPolicy().getPriorityMessageSenders());
    listPreference.setValue(mListValues[getIndexOfSendersValue(currentVal)]);
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 47 with ListPreference

use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class Buttons method initList.

private ListPreference initList(String key, int value) {
    ListPreference list = getPreferenceScreen().findPreference(key);
    if (list == null)
        return null;
    list.setValue(Integer.toString(value));
    list.setSummary(list.getEntry());
    list.setOnPreferenceChangeListener(this);
    return list;
}
Also used : SystemSettingListPreference(com.android.settings.rr.Preferences.SystemSettingListPreference) ListPreference(androidx.preference.ListPreference)

Example 48 with ListPreference

use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class GestureAnywhereSettings method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.gesture_anywhere);
    mContext = getActivity();
    mEnabledPref = (SwitchPreference) findPreference(KEY_ENABLED);
    mEnabledPref.setChecked((Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_ENABLED, 0) == 1));
    mEnabledPref.setOnPreferenceChangeListener(this);
    PreferenceScreen prefSet = getPreferenceScreen();
    mPositionPref = (ListPreference) prefSet.findPreference(KEY_POSITION);
    mPositionPref.setOnPreferenceChangeListener(this);
    int position = Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_POSITION, Gravity.LEFT);
    mPositionPref.setValue(String.valueOf(position));
    mTriggerWidthPref = (CustomSeekBarPreference) findPreference(KEY_TRIGGER_WIDTH);
    mTriggerWidthPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_WIDTH, 40));
    mTriggerWidthPref.setOnPreferenceChangeListener(this);
    mTriggerTopPref = (CustomSeekBarPreference) findPreference(KEY_TRIGGER_TOP);
    mTriggerTopPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_TOP, 0));
    mTriggerTopPref.setOnPreferenceChangeListener(this);
    mTriggerBottomPref = (CustomSeekBarPreference) findPreference(KEY_TRIGGER_BOTTOM);
    mTriggerBottomPref.setValue(Settings.System.getInt(getContentResolver(), Settings.System.GESTURE_ANYWHERE_TRIGGER_HEIGHT, 100));
    mTriggerBottomPref.setOnPreferenceChangeListener(this);
    Preference pref = findPreference(KEY_GESTURES);
    pref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {

        @Override
        public boolean onPreferenceClick(Preference preference) {
            startActivity(new Intent(getActivity(), GestureAnywhereBuilderActivity.class));
            return true;
        }
    });
    int anim = Settings.System.getInt(getActivity().getContentResolver(), Settings.System.RR_CONFIG_ANIM, 0);
    try {
        if (anim == 0) {
            removePreference("animation");
        } else if (anim == 1) {
            removePreference("preview");
        } else if (anim == 2) {
            removePreference("animation");
            removePreference("preview");
        }
    } catch (Exception e) {
    }
    if (SystemNavigationPreferenceController.isEdgeToEdgeEnabled(mContext)) {
        mFooterPreferenceMixin.createFooterPreference().setTitle(R.string.ga_warning_message);
    }
}
Also used : PreferenceScreen(androidx.preference.PreferenceScreen) CustomSeekBarPreference(com.android.settings.rr.Preferences.CustomSeekBarPreference) SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) ListPreference(androidx.preference.ListPreference) Intent(android.content.Intent)

Example 49 with ListPreference

use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class UpdatableListPreferenceDialogFragment method onDialogClosed.

@Override
public void onDialogClosed(boolean positiveResult) {
    if (positiveResult && mClickedDialogEntryIndex >= 0) {
        final ListPreference preference = getListPreference();
        final String value = mEntryValues[mClickedDialogEntryIndex].toString();
        if (preference.callChangeListener(value)) {
            preference.setValue(value);
        }
    }
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 50 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_crDroidSettings by crdroidandroid.

the class Buttons method initList.

private ListPreference initList(String key, int value) {
    ListPreference list = getPreferenceScreen().findPreference(key);
    if (list == null)
        return null;
    list.setValue(Integer.toString(value));
    list.setSummary(list.getEntry());
    list.setOnPreferenceChangeListener(this);
    return list;
}
Also used : ListPreference(androidx.preference.ListPreference)

Aggregations

ListPreference (androidx.preference.ListPreference)170 Test (org.junit.Test)24 Before (org.junit.Before)23 Preference (androidx.preference.Preference)20 EditTextPreference (androidx.preference.EditTextPreference)10 PreferenceScreen (androidx.preference.PreferenceScreen)10 SwitchPreference (androidx.preference.SwitchPreference)9 Context (android.content.Context)8 ContentResolver (android.content.ContentResolver)7 Intent (android.content.Intent)7 PersistableBundle (android.os.PersistableBundle)6 MultiSelectListPreference (androidx.preference.MultiSelectListPreference)6 Resources (android.content.res.Resources)5 Bundle (android.os.Bundle)5 RemoteException (android.os.RemoteException)5 RestrictionEntry (android.content.RestrictionEntry)4 OverlayInfo (android.content.om.OverlayInfo)4 ApplicationInfo (android.content.pm.ApplicationInfo)4 PackageInfo (android.content.pm.PackageInfo)4 WifiConfiguration (android.net.wifi.WifiConfiguration)4