Search in sources :

Example 11 with ListPreference

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

the class WifiTetherSecurityPreferenceController method updateDisplay.

@Override
public void updateDisplay() {
    final WifiConfiguration config = mWifiManager.getWifiApConfiguration();
    if (config != null && config.getAuthType() == WifiConfiguration.KeyMgmt.NONE) {
        mSecurityValue = WifiConfiguration.KeyMgmt.NONE;
    } else {
        mSecurityValue = WifiConfiguration.KeyMgmt.WPA2_PSK;
    }
    final ListPreference preference = (ListPreference) mPreference;
    preference.setSummary(getSummaryForSecurityType(mSecurityValue));
    preference.setValue(String.valueOf(mSecurityValue));
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) ListPreference(androidx.preference.ListPreference)

Example 12 with ListPreference

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

the class GameDriverAppPreferenceControllerTest method onPreferenceChange_selectGAME_DRIVER_shouldUpdateAttributesAndSettingsGlobal.

@Test
public void onPreferenceChange_selectGAME_DRIVER_shouldUpdateAttributesAndSettingsGlobal() {
    loadDefaultConfig();
    final ListPreference preference = mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
    mController.onPreferenceChange(preference, mValueList[GAME_DRIVER]);
    assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
    assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
    assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
    assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_IN_APPS)).isEqualTo(TEST_PKG_NAME);
    assertThat(Settings.Global.getString(mResolver, Settings.Global.GAME_DRIVER_OPT_OUT_APPS)).isEqualTo("");
}
Also used : ListPreference(androidx.preference.ListPreference) Test(org.junit.Test)

Example 13 with ListPreference

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

the class GameDriverAppPreferenceControllerTest method createPreference_configPRERELEASE_DRIVER_shouldSetPrereleaseDriverAttributes.

@Test
public void createPreference_configPRERELEASE_DRIVER_shouldSetPrereleaseDriverAttributes() {
    loadConfig("", TEST_PKG_NAME, "");
    final ListPreference preference = mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
    assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
    assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
    assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
    assertThat(preference.getEntries()).isEqualTo(mValueList);
    assertThat(preference.getEntryValues()).isEqualTo(mValueList);
    assertThat(preference.getSummary()).isEqualTo(mPreferencePrereleaseDriver);
}
Also used : ListPreference(androidx.preference.ListPreference) Test(org.junit.Test)

Example 14 with ListPreference

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

the class GameDriverAppPreferenceControllerTest method createPreference_configSystem_shouldSetSystemAttributes.

@Test
public void createPreference_configSystem_shouldSetSystemAttributes() {
    loadConfig("", "", TEST_PKG_NAME);
    final ListPreference preference = mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
    assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
    assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
    assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
    assertThat(preference.getEntries()).isEqualTo(mValueList);
    assertThat(preference.getEntryValues()).isEqualTo(mValueList);
    assertThat(preference.getEntry()).isEqualTo(mValueList[SYSTEM]);
    assertThat(preference.getValue()).isEqualTo(mValueList[SYSTEM]);
    assertThat(preference.getSummary()).isEqualTo(mValueList[SYSTEM]);
}
Also used : ListPreference(androidx.preference.ListPreference) Test(org.junit.Test)

Example 15 with ListPreference

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

the class GameDriverAppPreferenceControllerTest method createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes.

@Test
public void createPreference_configGAME_DRIVER_shouldSetGameDriverAttributes() {
    loadConfig(TEST_PKG_NAME, "", "");
    final ListPreference preference = mController.createListPreference(mContext, TEST_PKG_NAME, TEST_APP_NAME);
    assertThat(preference.getKey()).isEqualTo(TEST_PKG_NAME);
    assertThat(preference.getTitle()).isEqualTo(TEST_APP_NAME);
    assertThat(preference.getDialogTitle()).isEqualTo(mDialogTitle);
    assertThat(preference.getEntries()).isEqualTo(mValueList);
    assertThat(preference.getEntryValues()).isEqualTo(mValueList);
    assertThat(preference.getEntry()).isEqualTo(mValueList[GAME_DRIVER]);
    assertThat(preference.getValue()).isEqualTo(mValueList[GAME_DRIVER]);
    assertThat(preference.getSummary()).isEqualTo(mValueList[GAME_DRIVER]);
}
Also used : ListPreference(androidx.preference.ListPreference) Test(org.junit.Test)

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