Add device name preference in pairing page

Also refactor the preference controller
1. Extend from BasePreferenceController.
2. pass in the preference key. Then it could be reused in different
places with different key.

Bug: 69333961
Test: Screenshot | RunSettingsRoboTests
Change-Id: I773ca022baa326481045c1659565c9a21111200a
This commit is contained in:
jackqdyulei
2017-12-08 12:55:26 -08:00
parent ae1011ee5d
commit be555e2dad
6 changed files with 50 additions and 25 deletions

View File

@@ -46,9 +46,8 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
static final String KEY_AVAIL_DEVICES = "available_devices";
@VisibleForTesting
static final String KEY_FOOTER_PREF = "footer_preference";
private static final String KEY_RENAME_DEVICES = "bt_pair_rename_devices";
@VisibleForTesting
BluetoothDeviceNamePreferenceController mDeviceNamePrefController;
@VisibleForTesting
BluetoothProgressCategory mAvailableDevicesCategory;
@VisibleForTesting
@@ -195,10 +194,10 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
List<AbstractPreferenceController> controllers = new ArrayList<>();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context,
getLifecycle());
controllers.add(mDeviceNamePrefController);
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(
new BluetoothDeviceRenamePreferenceController(context, KEY_RENAME_DEVICES, this,
getLifecycle()));
return controllers;
}