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:
@@ -0,0 +1,67 @@
|
||||
/*
|
||||
* Copyright (C) 2017 The Android Open Source Project
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.android.settings.bluetooth;
|
||||
|
||||
import android.app.Fragment;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.VisibleForTesting;
|
||||
import android.support.v7.preference.Preference;
|
||||
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothAdapter;
|
||||
import com.android.settingslib.core.lifecycle.Lifecycle;
|
||||
|
||||
public class BluetoothDeviceRenamePreferenceController extends
|
||||
BluetoothDeviceNamePreferenceController {
|
||||
|
||||
public static final String PREF_KEY = "bt_rename_device";
|
||||
|
||||
private final Fragment mFragment;
|
||||
|
||||
public BluetoothDeviceRenamePreferenceController(Context context, Fragment fragment,
|
||||
Lifecycle lifecycle) {
|
||||
super(context, lifecycle);
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
BluetoothDeviceRenamePreferenceController(Context context, Fragment fragment,
|
||||
LocalBluetoothAdapter localAdapter) {
|
||||
super(context, localAdapter);
|
||||
mFragment = fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPreferenceKey() {
|
||||
return PREF_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateDeviceName(final Preference preference, final String deviceName) {
|
||||
preference.setSummary(deviceName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handlePreferenceTreeClick(Preference preference) {
|
||||
if (PREF_KEY.equals(preference.getKey())) {
|
||||
LocalDeviceNameDialogFragment.newInstance()
|
||||
.show(mFragment.getFragmentManager(), LocalDeviceNameDialogFragment.TAG);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user