UI refresh on bluetooth list page

- xml layout clean up
- add "Device name" preference, tapping will bring up rename dialog
- Remove tap target from original device_name pref

Merged-In: I6e9764dbb6c51f94be6d6a61d5a6401141407409
Change-Id: I9cb67cc557a9b932d7cf795a8d4a6fb5215c4365
Fix: 62890841
Fix: 62891178
Test: robotests
This commit is contained in:
Fan Zhang
2017-07-12 10:18:54 -07:00
parent d1bac25518
commit 7b9568c10d
9 changed files with 205 additions and 76 deletions

View File

@@ -22,7 +22,6 @@ import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
import android.content.ContentResolver;
import android.content.Context;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.SystemProperties;
@@ -55,6 +54,8 @@ import com.android.settingslib.bluetooth.BluetoothDeviceFilter;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
import com.android.settingslib.bluetooth.LocalBluetoothManager;
import com.android.settingslib.core.AbstractPreferenceController;
import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.widget.FooterPreference;
import java.util.ArrayList;
@@ -66,7 +67,6 @@ import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;
/**
* BluetoothSettings is the Settings screen for Bluetooth configuration and
* connection management.
*
*/
public class BluetoothSettings extends DeviceListPreferenceFragment implements Indexable {
private static final String TAG = "BluetoothSettings";
@@ -87,7 +87,6 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
private SwitchBar mSwitchBar;
private final IntentFilter mIntentFilter;
private BluetoothDeviceNamePreferenceController mDeviceNamePrefController;
@VisibleForTesting
BluetoothPairingPreferenceController mPairingPrefController;
@@ -98,7 +97,6 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
public BluetoothSettings() {
super(DISALLOW_CONFIG_BLUETOOTH);
mIntentFilter = new IntentFilter(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED);
}
@Override
@@ -356,14 +354,15 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
@Override
protected List<PreferenceController> getPreferenceControllers(Context context) {
List<PreferenceController> controllers = new ArrayList<>();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context,
this, getLifecycle());
final List<PreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context, lifecycle);
mPairingPrefController = new BluetoothPairingPreferenceController(context, this,
(SettingsActivity) getActivity());
controllers.add(mDeviceNamePrefController);
controllers.add(mPairingPrefController);
controllers.add(new BluetoothFilesPreferenceController(context));
controllers.add(new BluetoothDeviceRenamePreferenceController(context, this, lifecycle));
return controllers;
}