Search in sources :

Example 16 with AccessPointPreference

use of com.android.settingslib.wifi.AccessPointPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class WifiConnectionPreferenceController method updatePreference.

private void updatePreference(AccessPoint accessPoint) {
    if (mPreference != null) {
        mPreferenceGroup.removePreference(mPreference);
        mPreference = null;
    }
    if (accessPoint == null) {
        return;
    }
    if (mPrefContext != null) {
        mPreference = new AccessPointPreference(accessPoint, mPrefContext, mBadgeCache, R.drawable.ic_wifi_signal_0, false);
        mPreference.setKey(KEY);
        mPreference.refresh();
        mPreference.setOrder(order);
        mPreference.setOnPreferenceClickListener(pref -> {
            Bundle args = new Bundle();
            mPreference.getAccessPoint().saveWifiState(args);
            new SubSettingLauncher(mPrefContext).setTitleRes(R.string.pref_title_network_details).setDestination(WifiNetworkDetailsFragment.class.getName()).setArguments(args).setSourceMetricsCategory(mMetricsCategory).launch();
            return true;
        });
        mPreferenceGroup.addPreference(mPreference);
    }
}
Also used : SubSettingLauncher(com.android.settings.core.SubSettingLauncher) AccessPointPreference(com.android.settingslib.wifi.AccessPointPreference) Bundle(android.os.Bundle)

Aggregations

AccessPointPreference (com.android.settingslib.wifi.AccessPointPreference)16 AccessPoint (com.android.settingslib.wifi.AccessPoint)12 Test (org.junit.Test)4 Context (android.content.Context)3 WifiConfiguration (android.net.wifi.WifiConfiguration)3 Bundle (android.os.Bundle)2 View (android.view.View)2 VisibleForTesting (androidx.annotation.VisibleForTesting)2 SubSettingLauncher (com.android.settings.core.SubSettingLauncher)2 Config (org.robolectric.annotation.Config)2 Activity (android.app.Activity)1 SettingsEnums (android.app.settings.SettingsEnums)1 Intent (android.content.Intent)1 WifiEnterpriseConfig (android.net.wifi.WifiEnterpriseConfig)1 WifiManager (android.net.wifi.WifiManager)1 Log (android.util.Log)1 Toast (android.widget.Toast)1 Preference (androidx.preference.Preference)1 PreferenceCategory (androidx.preference.PreferenceCategory)1 R (com.android.settings.R)1