Don't scroll when removing saved networks.

Bug: b/62374459
Test: Open saved networks from WifiSettings. Remove a saved network.
Screen should not scroll to the top of the list.

Change-Id: Ia78fc0b5435f659c8fe31abee8b76006d7986b66
This commit is contained in:
Sundeep Ghuman
2017-06-26 17:22:08 -07:00
parent 22080a1df5
commit 14cc864122
2 changed files with 15 additions and 20 deletions

View File

@@ -127,17 +127,25 @@ public class SavedAccessPointsWifiSettings extends SettingsPreferenceFragment
final List<AccessPoint> accessPoints =
WifiSavedConfigUtils.getAllConfigs(context, mWifiManager);
Collections.sort(accessPoints, SAVED_NETWORK_COMPARATOR);
preferenceScreen.removeAll();
cacheRemoveAllPrefs(preferenceScreen);
final int accessPointsSize = accessPoints.size();
for (int i = 0; i < accessPointsSize; ++i){
for (int i = 0; i < accessPointsSize; ++i) {
AccessPoint ap = accessPoints.get(i);
String key = AccessPointPreference.generatePreferenceKey(ap);
LongPressAccessPointPreference preference =
new LongPressAccessPointPreference(accessPoints.get(i), context,
mUserBadgeCache, true, this);
preference.setIcon(null);
preferenceScreen.addPreference(preference);
(LongPressAccessPointPreference) getCachedPreference(key);
if (preference == null) {
preference = new LongPressAccessPointPreference(
ap, context, mUserBadgeCache, true, this);
preference.setKey(key);
preference.setIcon(null);
preferenceScreen.addPreference(preference);
}
}
removeCachedPrefs(preferenceScreen);
if(getPreferenceScreen().getPreferenceCount() < 1) {
Log.w(TAG, "Saved networks activity loaded, but there are no saved networks!");
}