Search in sources :

Example 31 with ListPreference

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

the class SoundSettings method updateVolumeStepPrefs.

private void updateVolumeStepPrefs(Preference pref, int steps) {
    if (pref == null || !(pref instanceof ListPreference)) {
        return;
    }
    final ListPreference listPref = (ListPreference) pref;
    listPref.setSummary(String.valueOf(steps));
    listPref.setValue(String.valueOf(steps));
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 32 with ListPreference

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

the class HandsFreeProfileOutputPreferenceController method setPreference.

void setPreference(CharSequence[] mediaOutputs, CharSequence[] mediaValues, Preference preference) {
    final ListPreference listPreference = (ListPreference) preference;
    listPreference.setEntries(mediaOutputs);
    listPreference.setEntryValues(mediaValues);
    listPreference.setValueIndex(mSelectedIndex);
    listPreference.setSummary(mediaOutputs[mSelectedIndex]);
    mAudioSwitchPreferenceCallback.onPreferenceDataChanged(listPreference);
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 33 with ListPreference

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

the class SimulateColorSpacePreferenceController method usingDevelopmentColorSpace.

/**
 * @return <code>true</code> if the color space preference is currently
 * controlled by development settings
 */
private boolean usingDevelopmentColorSpace() {
    final ContentResolver cr = mContext.getContentResolver();
    final boolean enabled = Settings.Secure.getInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED, SETTING_VALUE_OFF) != SETTING_VALUE_OFF;
    if (enabled) {
        final String mode = Integer.toString(Settings.Secure.getInt(cr, Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER, AccessibilityManager.DALTONIZER_DISABLED));
        final int index = ((ListPreference) mPreference).findIndexOfValue(mode);
        if (index >= 0) {
            // We're using a mode controlled by developer preferences.
            return true;
        }
    }
    return false;
}
Also used : ListPreference(androidx.preference.ListPreference) ContentResolver(android.content.ContentResolver)

Example 34 with ListPreference

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

the class BluetoothMaxConnectedAudioDevicesPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final ListPreference listPreference = (ListPreference) mPreference;
    final CharSequence[] entries = listPreference.getEntries();
    entries[0] = String.format(entries[0].toString(), mDefaultMaxConnectedAudioDevices);
    listPreference.setEntries(entries);
}
Also used : ListPreference(androidx.preference.ListPreference)

Example 35 with ListPreference

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

the class BluetoothMaxConnectedAudioDevicesPreferenceController method updateState.

@Override
public void updateState(Preference preference) {
    final ListPreference listPreference = (ListPreference) preference;
    final CharSequence[] entries = listPreference.getEntries();
    final String currentValue = SystemProperties.get(MAX_CONNECTED_AUDIO_DEVICES_PROPERTY);
    int index = 0;
    if (!currentValue.isEmpty()) {
        index = listPreference.findIndexOfValue(currentValue);
        if (index < 0) {
            // Reset property value when value is illegal
            SystemProperties.set(MAX_CONNECTED_AUDIO_DEVICES_PROPERTY, "");
            index = 0;
        }
    }
    listPreference.setValueIndex(index);
    listPreference.setSummary(entries[index]);
}
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