Add preference group for saved devcies.
Currently it only contains bluetooth devices. Bug: 3240835 Test: RunSettingsRoboTests Change-Id: Ief102e7174a4c4610dbda6b728419b303ff928f9
This commit is contained in:
@@ -148,10 +148,23 @@ public abstract class BluetoothDeviceUpdater implements BluetoothCallback {
|
||||
mPrefContext = context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return {@code true} if {@code cachedBluetoothDevice} matches this
|
||||
* {@link BluetoothDeviceUpdater} and should stay in the list, otherwise return {@code false}
|
||||
*/
|
||||
public abstract boolean isFilterMatched(CachedBluetoothDevice cachedBluetoothDevice);
|
||||
|
||||
/**
|
||||
* Update whether to show {@cde cachedBluetoothDevice} in the list.
|
||||
*/
|
||||
abstract public void update(CachedBluetoothDevice cachedBluetoothDevice);
|
||||
protected void update(CachedBluetoothDevice cachedBluetoothDevice) {
|
||||
if (isFilterMatched(cachedBluetoothDevice)) {
|
||||
// Add the preference if it is new one
|
||||
addPreference(cachedBluetoothDevice);
|
||||
} else {
|
||||
removePreference(cachedBluetoothDevice);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the {@link Preference} that represents the {@code cachedDevice}
|
||||
|
Reference in New Issue
Block a user