use of com.android.settingslib.wifi.AccessPointPreference in project android_packages_apps_Settings by DirtyUnicorns.
the class WifiSettings method configureConnectedAccessPointPreferenceCategory.
/**
* Configure the ConnectedAccessPointPreferenceCategory and return true if the Category was
* shown.
*/
private boolean configureConnectedAccessPointPreferenceCategory(List<AccessPoint> accessPoints) {
if (accessPoints.size() == 0) {
removeConnectedAccessPointPreference();
return false;
}
AccessPoint connectedAp = accessPoints.get(0);
if (!connectedAp.isActive()) {
removeConnectedAccessPointPreference();
return false;
}
// Is the preference category empty?
if (mConnectedAccessPointPreferenceCategory.getPreferenceCount() == 0) {
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Is the previous currently connected SSID different from the new one?
AccessPointPreference preference = (AccessPointPreference) (mConnectedAccessPointPreferenceCategory.getPreference(0));
// in the UI.
if (preference.getAccessPoint() != connectedAp) {
removeConnectedAccessPointPreference();
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Else same AP is connected, simply refresh the connected access point preference
// (first and only access point in this category).
((LongPressAccessPointPreference) mConnectedAccessPointPreferenceCategory.getPreference(0)).refresh();
return true;
}
use of com.android.settingslib.wifi.AccessPointPreference in project android_packages_apps_Settings by SudaMod.
the class WifiSettings method configureConnectedAccessPointPreferenceCategory.
/**
* Configure the ConnectedAccessPointPreferenceCategory and return true if the Category was
* shown.
*/
private boolean configureConnectedAccessPointPreferenceCategory(List<AccessPoint> accessPoints) {
if (accessPoints.size() == 0) {
removeConnectedAccessPointPreference();
return false;
}
AccessPoint connectedAp = accessPoints.get(0);
if (!connectedAp.isActive()) {
removeConnectedAccessPointPreference();
return false;
}
// Is the preference category empty?
if (mConnectedAccessPointPreferenceCategory.getPreferenceCount() == 0) {
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Is the previous currently connected SSID different from the new one?
AccessPointPreference preference = (AccessPointPreference) (mConnectedAccessPointPreferenceCategory.getPreference(0));
// in the UI.
if (preference.getAccessPoint() != connectedAp) {
removeConnectedAccessPointPreference();
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Else same AP is connected, simply refresh the connected access point preference
// (first and only access point in this category).
((LongPressAccessPointPreference) mConnectedAccessPointPreferenceCategory.getPreference(0)).refresh();
return true;
}
use of com.android.settingslib.wifi.AccessPointPreference in project platform_packages_apps_Settings by BlissRoms.
the class WifiSettings method configureConnectedAccessPointPreferenceCategory.
/**
* Configure the ConnectedAccessPointPreferenceCategory and return true if the Category was
* shown.
*/
private boolean configureConnectedAccessPointPreferenceCategory(List<AccessPoint> accessPoints) {
if (accessPoints.size() == 0) {
removeConnectedAccessPointPreference();
return false;
}
AccessPoint connectedAp = accessPoints.get(0);
if (!connectedAp.isActive()) {
removeConnectedAccessPointPreference();
return false;
}
// Is the preference category empty?
if (mConnectedAccessPointPreferenceCategory.getPreferenceCount() == 0) {
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Is the previous currently connected SSID different from the new one?
AccessPointPreference preference = (AccessPointPreference) (mConnectedAccessPointPreferenceCategory.getPreference(0));
// in the UI.
if (preference.getAccessPoint() != connectedAp) {
removeConnectedAccessPointPreference();
addConnectedAccessPointPreference(connectedAp);
return true;
}
// Else same AP is connected, simply refresh the connected access point preference
// (first and only access point in this category).
((LongPressAccessPointPreference) mConnectedAccessPointPreferenceCategory.getPreference(0)).refresh();
return true;
}
use of com.android.settingslib.wifi.AccessPointPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SavedAccessPointsPreferenceController method refreshSavedAccessPoints.
@VisibleForTesting
void refreshSavedAccessPoints() {
if (mPreferenceGroup == null) {
Log.w(TAG, "PreferenceGroup is null, skipping.");
return;
}
final Context prefContext = mPreferenceGroup.getContext();
final List<AccessPoint> accessPoints = WifiSavedConfigUtils.getAllConfigs(mContext, mWifiManager);
Collections.sort(accessPoints, SavedNetworkComparator.INSTANCE);
mChildrenCache.cacheRemoveAllPrefs(mPreferenceGroup);
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i) {
AccessPoint ap = accessPoints.get(i);
if (mHost != null && mHost.isSubscriptionsFeatureEnabled() && ap.isPasspointConfig()) {
continue;
}
String key = ap.getKey();
AccessPointPreference preference = (AccessPointPreference) mChildrenCache.getCachedPreference(key);
if (preference == null) {
preference = new AccessPointPreference(ap, prefContext, mUserBadgeCache, true);
preference.setKey(key);
preference.setIcon(null);
preference.setOnPreferenceClickListener(this);
mPreferenceGroup.addPreference(preference);
}
preference.setOrder(i);
}
mChildrenCache.removeCachedPrefs(mPreferenceGroup);
if (mPreferenceGroup.getPreferenceCount() < 1) {
Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
mPreferenceGroup.setVisible(false);
} else {
mPreferenceGroup.setVisible(true);
}
if (mHost != null && !mHost.isSubscriptionsFeatureEnabled()) {
mPreferenceGroup.setVisible(true);
mPreferenceGroup.setTitle(null);
mPreferenceGroup.setLayoutResource(R.layout.preference_category_no_label);
}
}
use of com.android.settingslib.wifi.AccessPointPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SubscribedAccessPointsPreferenceController method refreshSubscribedAccessPoints.
@VisibleForTesting
void refreshSubscribedAccessPoints() {
if (mPreferenceGroup == null) {
Log.w(TAG, "PreferenceGroup is null, skipping.");
return;
}
if (mHost != null && !mHost.isSubscriptionsFeatureEnabled()) {
mPreferenceGroup.setVisible(false);
return;
}
final Context prefContext = mPreferenceGroup.getContext();
final List<AccessPoint> accessPoints = WifiSavedConfigUtils.getAllConfigs(mContext, mWifiManager);
Collections.sort(accessPoints, SavedNetworkComparator.INSTANCE);
mChildrenCache.cacheRemoveAllPrefs(mPreferenceGroup);
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i) {
AccessPoint ap = accessPoints.get(i);
if (!ap.isPasspointConfig()) {
continue;
}
final String key = ap.getKey();
AccessPointPreference preference = (AccessPointPreference) mChildrenCache.getCachedPreference(key);
if (preference == null) {
preference = new AccessPointPreference(ap, prefContext, mUserBadgeCache, true);
preference.setKey(key);
preference.setIcon(null);
preference.setOnPreferenceClickListener(this);
mPreferenceGroup.addPreference(preference);
}
preference.setOrder(i);
}
mChildrenCache.removeCachedPrefs(mPreferenceGroup);
if (mPreferenceGroup.getPreferenceCount() < 1) {
Log.w(TAG, "Subscribed networks activity loaded," + " but there are no subscribed networks!");
mPreferenceGroup.setVisible(false);
} else {
mPreferenceGroup.setVisible(true);
}
}
Aggregations