use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiTetherSecurityPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mConfig = new WifiConfiguration();
mConfig.SSID = "test_1234";
mConfig.preSharedKey = "test_password";
mConfig.allowedKeyManagement.set(WifiConfiguration.KeyMgmt.WPA2_PSK);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getSystemService(Context.WIFI_SERVICE)).thenReturn(mWifiManager);
when(mWifiManager.getWifiApConfiguration()).thenReturn(mConfig);
when(mContext.getSystemService(Context.CONNECTIVITY_SERVICE)).thenReturn(mConnectivityManager);
when(mConnectivityManager.getTetherableWifiRegexs()).thenReturn(new String[] { "1", "2" });
when(mScreen.findPreference(anyString())).thenReturn(mPreference);
mController = new WifiTetherSecurityPreferenceController(mContext, mListener);
mPreference = new ListPreference(RuntimeEnvironment.application);
mController.mPreference = mPreference;
}
use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BluetoothAudioCodecPriorityPreferenceController method updateBluetoothAudioCodecPriorityOptions.
private void updateBluetoothAudioCodecPriorityOptions() {
final int value = Settings.System.getInt(mContext.getContentResolver(), Settings.System.A2DP_SOURCE_CODEC_PRIORITY, 0);
// default
int index = 0;
for (int i = 0; i < mListValues.length; i++) {
int val = Integer.parseInt(mListValues[i]);
if (val >= value) {
index = i;
break;
}
}
final ListPreference listPreference = (ListPreference) mPreference;
listPreference.setValue(mListValues[index]);
listPreference.setSummary(mListSummaries[index]);
}
use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class BackgroundProcessLimitPreferenceController method updateAppProcessLimitOptions.
private void updateAppProcessLimitOptions() {
try {
final int limit = getActivityManagerService().getProcessLimit();
// default
int index = 0;
for (int i = 0; i < mListValues.length; i++) {
int val = Integer.parseInt(mListValues[i]);
if (val >= limit) {
index = i;
break;
}
}
final ListPreference listPreference = (ListPreference) mPreference;
listPreference.setValue(mListValues[index]);
listPreference.setSummary(mListSummaries[index]);
} catch (RemoteException e) {
// intentional no-op
}
}
use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NightModePreferenceController method displayPreference.
@Override
public void displayPreference(PreferenceScreen screen) {
if (!isAvailable()) {
setVisible(screen, KEY_NIGHT_MODE, false);
return;
}
final ListPreference mNightModePreference = screen.findPreference(KEY_NIGHT_MODE);
if (mNightModePreference != null) {
final UiModeManager uiManager = (UiModeManager) mContext.getSystemService(UI_MODE_SERVICE);
final int currentNightMode = uiManager.getNightMode();
mNightModePreference.setValue(String.valueOf(currentNightMode));
mNightModePreference.setOnPreferenceChangeListener(this);
}
}
use of androidx.preference.ListPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EnabledNetworkModePreferenceController method updateState.
@Override
public void updateState(Preference preference) {
super.updateState(preference);
final ListPreference listPreference = (ListPreference) preference;
final int networkMode = getPreferredNetworkMode();
updatePreferenceEntries(listPreference);
updatePreferenceValueAndSummary(listPreference, networkMode);
}
Aggregations