Search in sources :

Example 71 with Preference

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

the class NotifyOpenNetworkPreferenceControllerTest method handlePreferenceTreeClick_nonMatchingType_shouldDoNothing.

@Test
public void handlePreferenceTreeClick_nonMatchingType_shouldDoNothing() {
    final Preference pref = new Preference(mContext);
    pref.setKey(mController.getPreferenceKey());
    assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 72 with Preference

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

the class P2pThisDevicePreferenceControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mPreference = new Preference(RuntimeEnvironment.application);
    when(mPreferenceScreen.findPreference(anyString())).thenReturn(mPreference);
    mController = new P2pThisDevicePreferenceController(RuntimeEnvironment.application);
}
Also used : Preference(androidx.preference.Preference) Before(org.junit.Before)

Example 73 with Preference

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

the class WifiWakeupPreferenceControllerTest method handlePreferenceTreeClick_nonMatchingType_shouldDoNothing.

@Test
public void handlePreferenceTreeClick_nonMatchingType_shouldDoNothing() {
    final Preference pref = new Preference(mContext);
    pref.setKey(mController.getPreferenceKey());
    assertThat(mController.handlePreferenceTreeClick(pref)).isFalse();
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 74 with Preference

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

the class UseOpenWifiPreferenceControllerTest method onPreferenceChange_notAvailable_shouldDoNothing.

@Test
public void onPreferenceChange_notAvailable_shouldDoNothing() {
    createController();
    final Preference pref = new Preference(mContext);
    pref.setKey(mController.getPreferenceKey());
    assertThat(mController.onPreferenceChange(pref, null)).isFalse();
}
Also used : SwitchPreference(androidx.preference.SwitchPreference) Preference(androidx.preference.Preference) Test(org.junit.Test)

Example 75 with Preference

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

the class WifiSettings method onCreateContextMenu.

@Override
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo info) {
    Preference preference = (Preference) view.getTag();
    if (preference instanceof LongPressAccessPointPreference) {
        mSelectedAccessPoint = ((LongPressAccessPointPreference) preference).getAccessPoint();
        menu.setHeaderTitle(mSelectedAccessPoint.getTitle());
        if (mSelectedAccessPoint.isConnectable()) {
            menu.add(Menu.NONE, MENU_ID_CONNECT, 0, /* order */
            R.string.wifi_connect);
        }
        WifiConfiguration config = mSelectedAccessPoint.getConfig();
        // Some configs are ineditable
        if (WifiUtils.isNetworkLockedDown(getActivity(), config)) {
            return;
        }
        // could only be disconnected and be put in blacklists so it won't be used again.
        if (mSelectedAccessPoint.isSaved() || mSelectedAccessPoint.isEphemeral()) {
            final int stringId = mSelectedAccessPoint.isEphemeral() ? R.string.wifi_disconnect_button_text : R.string.forget;
            menu.add(Menu.NONE, MENU_ID_FORGET, 0, /* order */
            stringId);
        }
        if (mSelectedAccessPoint.isSaved() && !mSelectedAccessPoint.isActive()) {
            menu.add(Menu.NONE, MENU_ID_MODIFY, 0, /* order */
            R.string.wifi_modify);
        }
    }
}
Also used : WifiConfiguration(android.net.wifi.WifiConfiguration) AccessPointPreference(com.android.settingslib.wifi.AccessPointPreference) DataUsagePreference(com.android.settings.datausage.DataUsagePreference) Preference(androidx.preference.Preference) AccessPoint(com.android.settingslib.wifi.AccessPoint)

Aggregations

Preference (androidx.preference.Preference)863 Test (org.junit.Test)343 Before (org.junit.Before)164 Intent (android.content.Intent)81 PreferenceScreen (androidx.preference.PreferenceScreen)81 NotificationChannel (android.app.NotificationChannel)77 SwitchPreference (androidx.preference.SwitchPreference)75 RestrictedSwitchPreference (com.android.settingslib.RestrictedSwitchPreference)69 Context (android.content.Context)60 ArrayList (java.util.ArrayList)50 NotificationBackend (com.android.settings.notification.NotificationBackend)45 ListPreference (androidx.preference.ListPreference)43 PreferenceCategory (androidx.preference.PreferenceCategory)40 Tile (com.android.settingslib.drawer.Tile)40 PreferenceManager (androidx.preference.PreferenceManager)39 Activity (android.app.Activity)27 UserHandle (android.os.UserHandle)27 FooterPreference (com.android.settingslib.widget.FooterPreference)27 PackageManager (android.content.pm.PackageManager)26 Bundle (android.os.Bundle)24