Workarounds to avoid removing all prefs
Removing all prefs causes ugly animations, so avoid it at all cost and cache all the prefs (while still added) as long as possible. Bug: 26271353 Change-Id: I33b84d751938b460f4b66c0158057407dd45d974
This commit is contained in:
@@ -176,11 +176,19 @@ public abstract class DeviceListPreferenceFragment extends
|
||||
return;
|
||||
}
|
||||
|
||||
BluetoothDevicePreference preference = new BluetoothDevicePreference(
|
||||
getPrefContext(), cachedDevice);
|
||||
String key = cachedDevice.getDevice().getAddress();
|
||||
BluetoothDevicePreference preference = (BluetoothDevicePreference) getCachedPreference(key);
|
||||
|
||||
if (preference == null) {
|
||||
preference = new BluetoothDevicePreference(getPrefContext(), cachedDevice);
|
||||
mDeviceListGroup.addPreference(preference);
|
||||
} else {
|
||||
// Tell the preference it is being re-used in case there is new info in the
|
||||
// cached device.
|
||||
preference.rebind();
|
||||
}
|
||||
|
||||
initDevicePreference(preference);
|
||||
mDeviceListGroup.addPreference(preference);
|
||||
mDevicePreferenceMap.put(cachedDevice, preference);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user