use of com.android.settingslib.wifi.AccessPoint in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class WifiDialogActivity method onForget.
@Override
public void onForget(WifiDialog dialog) {
final WifiManager wifiManager = getSystemService(WifiManager.class);
final AccessPoint accessPoint = dialog.getController().getAccessPoint();
if (accessPoint != null) {
if (!accessPoint.isSaved()) {
if (accessPoint.getNetworkInfo() != null && accessPoint.getNetworkInfo().getState() != NetworkInfo.State.DISCONNECTED) {
// Network is active but has no network ID - must be ephemeral.
wifiManager.disableEphemeralNetwork(AccessPoint.convertToQuotedString(accessPoint.getSsidStr()));
} else {
// Should not happen, but a monkey seems to trigger it
Log.e(TAG, "Failed to forget invalid network " + accessPoint.getConfig());
}
} else {
wifiManager.forget(accessPoint.getConfig().networkId, null);
}
}
Intent resultData = new Intent();
if (accessPoint != null) {
Bundle accessPointState = new Bundle();
accessPoint.saveWifiState(accessPointState);
resultData.putExtra(KEY_ACCESS_POINT_STATE, accessPointState);
}
setResult(RESULT_FORGET);
finish();
}
use of com.android.settingslib.wifi.AccessPoint in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SavedAccessPointsWifiSettings method initPreferences.
private void initPreferences() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
final Context context = getPrefContext();
final List<AccessPoint> accessPoints = WifiTracker.getCurrentAccessPoints(context, true, false, true);
Collections.sort(accessPoints, new Comparator<AccessPoint>() {
public int compare(AccessPoint ap1, AccessPoint ap2) {
if (ap1.getConfigName() != null) {
return ap1.getConfigName().compareTo(ap2.getConfigName());
} else {
return -1;
}
}
});
preferenceScreen.removeAll();
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i) {
LongPressAccessPointPreference preference = new LongPressAccessPointPreference(accessPoints.get(i), context, mUserBadgeCache, true, this);
preference.setIcon(null);
preferenceScreen.addPreference(preference);
}
if (getPreferenceScreen().getPreferenceCount() < 1) {
Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
}
}
Aggregations