From fdfb90f9e8207702700093888d0de6dea9a198eb Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Wed, 12 Aug 2009 15:38:01 -0700 Subject: [PATCH] b/1770342 Bluetooth: Show the pair and connect when the user long touches a device without any supported profiles. --- .../bluetooth/LocalBluetoothDevice.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java index cb2973f4b6f..c46e795c032 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothDevice.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothDevice.java @@ -700,26 +700,26 @@ public class LocalBluetoothDevice implements Comparable { menu.setHeaderTitle(getName()); - if (isConnected) { - menu.add(0, CONTEXT_ITEM_DISCONNECT, 0, R.string.bluetooth_device_context_disconnect); - } else if (hasProfiles) { - // For connection action, show either "Connect" or "Pair & connect" - int connectString = (bondState == BluetoothDevice.BOND_NOT_BONDED) - ? R.string.bluetooth_device_context_pair_connect - : R.string.bluetooth_device_context_connect; - menu.add(0, CONTEXT_ITEM_CONNECT, 0, connectString); - } - - if (bondState == BluetoothDevice.BOND_BONDED) { - // For unpair action, show either "Unpair" or "Disconnect & unpair" - int unpairString = isConnected - ? R.string.bluetooth_device_context_disconnect_unpair - : R.string.bluetooth_device_context_unpair; - menu.add(0, CONTEXT_ITEM_UNPAIR, 0, unpairString); + if (bondState == BluetoothDevice.BOND_NOT_BONDED) { // Not paired and not connected + menu.add(0, CONTEXT_ITEM_CONNECT, 0, R.string.bluetooth_device_context_pair_connect); + } else { // Paired + if (isConnected) { // Paired and connected + menu.add(0, CONTEXT_ITEM_DISCONNECT, 0, + R.string.bluetooth_device_context_disconnect); + menu.add(0, CONTEXT_ITEM_UNPAIR, 0, + R.string.bluetooth_device_context_disconnect_unpair); + } else { // Paired but not connected + if (hasProfiles) { + menu.add(0, CONTEXT_ITEM_CONNECT, 0, R.string.bluetooth_device_context_connect); + } + menu.add(0, CONTEXT_ITEM_UNPAIR, 0, R.string.bluetooth_device_context_unpair); + } // Show the connection options item - menu.add(0, CONTEXT_ITEM_CONNECT_ADVANCED, 0, - R.string.bluetooth_device_context_connect_advanced); + if (hasProfiles) { + menu.add(0, CONTEXT_ITEM_CONNECT_ADVANCED, 0, + R.string.bluetooth_device_context_connect_advanced); + } } }