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));
}
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);
}
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;
}
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);
}
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]);
}
Aggregations