Search in sources :

Example 76 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_Settings by omnirom.

the class EnabledNetworkModePreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    super.updateState(preference);
    final ListPreference listPreference = (ListPreference) preference;
    mBuilder.setPreferenceEntries();
    mBuilder.setPreferenceValueAndSummary();
    listPreference.setEntries(mBuilder.getEntries());
    listPreference.setEntryValues(mBuilder.getEntryValues());
    listPreference.setValue(Integer.toString(mBuilder.getSelectedEntryValue()));
    listPreference.setSummary(mBuilder.getSummary());
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 77 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_Settings by omnirom.

the class EnabledNetworkModePreferenceController method onPreferenceChange.

@Override
public boolean onPreferenceChange(Preference preference, Object object) {
    final int newPreferredNetworkMode = Integer.parseInt((String) object);
    final ListPreference listPreference = (ListPreference) preference;
    if (mTelephonyManager.setPreferredNetworkTypeBitmask(MobileNetworkUtils.getRafFromNetworkType(newPreferredNetworkMode))) {
        mBuilder.setPreferenceValueAndSummary(newPreferredNetworkMode);
        listPreference.setValue(Integer.toString(mBuilder.getSelectedEntryValue()));
        listPreference.setSummary(mBuilder.getSummary());
        return true;
    }
    return false;
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 78 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_Settings by omnirom.

the class AccessibilityButtonLocationPreferenceController method onPreferenceChange.

@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
    final ListPreference listPreference = (ListPreference) preference;
    final Integer value = Ints.tryParse((String) newValue);
    if (value != null) {
        Settings.Secure.putInt(mContext.getContentResolver(), Settings.Secure.ACCESSIBILITY_BUTTON_MODE, value);
        updateState(listPreference);
    }
    return true;
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 79 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_Settings by omnirom.

the class AccessibilityButtonLocationPreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    super.updateState(preference);
    final ListPreference listPreference = (ListPreference) preference;
    listPreference.setValue(getCurrentAccessibilityButtonMode());
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 80 with ListPreference

use of androidx.preference.ListPreference in project android_packages_apps_Settings by omnirom.

the class SelectLongPressTimeoutPreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    super.updateState(preference);
    if (!(preference instanceof ListPreference)) {
        return;
    }
    final ListPreference listPreference = (ListPreference) preference;
    listPreference.setValue(getLongPressTimeoutValue());
}
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