Fixed Bluetooth renaming bug.

+ After renaming your Bluetooth device, the title of the Bluetooth
    Activity stays "Bluetooth" instead of changing to the new name.
+ After renaming the device, the status at the bottom Bluetooth Settings
    is correctly displayed.

Bug: 16463239
Change-Id: Ifb12df2004fe1f89bd6f918e23c2c64ae08a0191
This commit is contained in:
PauloftheWest
2014-08-08 08:36:26 -07:00
parent b5fca45768
commit ed7b44d83d
3 changed files with 5 additions and 7 deletions

View File

@@ -264,9 +264,7 @@
<!-- Bluetooth settings screen, menu item to scan for nearby bluetooth devices -->
<string name="bluetooth_scan_for_devices">Scan for devices</string>
<!-- Bluetooth settings screen, menu item to change this device's Bluetooth name. [CHAR LIMIT=30] -->
<string name="bluetooth_rename_device" product="tablet">Rename tablet</string>
<!-- Bluetooth settings screen, menu item to change this device's Bluetooth name. [CHAR LIMIT=30] -->
<string name="bluetooth_rename_device" product="default">Rename phone</string>
<string name="bluetooth_rename_device">Rename this device</string>
<!-- Bluetooth settings screen, confirmation button for rename device dialog. [CHAR LIMIT=20] -->
<string name="bluetooth_rename_button">Rename</string>
<!-- Bluetooth settings. Dialog title to confirm disconnecting from all profiles of a device. [CHAR LIMIT=30] -->

View File

@@ -178,7 +178,6 @@ public final class BluetoothNameDialogFragment extends DialogFragment implements
mDeviceNameUpdated = true;
mDeviceNameEdited = false;
mDeviceNameView.setText(mLocalAdapter.getName());
getActivity().setTitle(mLocalAdapter.getName());
}
}

View File

@@ -99,13 +99,14 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
if (action.equals(BluetoothAdapter.ACTION_LOCAL_NAME_CHANGED)) {
updateDeviceName();
updateDeviceName(context);
}
}
private void updateDeviceName() {
private void updateDeviceName(Context context) {
if (mLocalAdapter.isEnabled() && mMyDevicePreference != null) {
mMyDevicePreference.setTitle(mLocalAdapter.getName());
mMyDevicePreference.setSummary(context.getResources().getString(
R.string.bluetooth_is_visible_message, mLocalAdapter.getName()));
}
}
};