diff options
author | PauloftheWest <paulofthewest@google.com> | 2014-07-05 08:10:52 -0700 |
---|---|---|
committer | PauloftheWest <paulofthewest@google.com> | 2014-07-11 16:52:47 -0700 |
commit | 059a70fdc08add3b8a039aa8ff4960e2b8e3c65a (patch) | |
tree | 262da7646cbec0fd530013f2de502f46578b0167 | |
parent | cc4e973d72a16a587b3f8dc4ddedc77ad150a7bc (diff) | |
download | packages_apps_Settings-059a70fdc08add3b8a039aa8ff4960e2b8e3c65a.zip packages_apps_Settings-059a70fdc08add3b8a039aa8ff4960e2b8e3c65a.tar.gz packages_apps_Settings-059a70fdc08add3b8a039aa8ff4960e2b8e3c65a.tar.bz2 |
Numerous minor updates for Bluetooth Settings
+ Remove top "this device" item from the list
+ Upon opening Bluetooth settings, cue a search for available, pair-ready devices
+ Upon opening Bluetooth settings, make the phone/tablet visible to other devices
+ Keep phone/tablet visible as long Bluetooth settings is open and screen is on
+ Filter this list so that only pair-ready devices are displayed
+ Add non-interactive text “<Device name> is now visible to nearby devices” at the bottom of the available devices list
Overflow menu:
- Remove “visibility timeout”
+ Replace “Search for devices” with “Refresh”
Bug: 15716927
Change-Id: I7c5225784af9bfb48dde511e05503ddc59be2b2b
-rw-r--r-- | res/values/strings.xml | 4 | ||||
-rwxr-xr-x | src/com/android/settings/bluetooth/BluetoothSettings.java | 65 |
2 files changed, 22 insertions, 47 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index 3825d68..afceaf2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -265,6 +265,8 @@ <!-- Bluetooth settings. Message for disconnecting from all profiles of a bluetooth device. [CHAR LIMIT=NONE] --> <string name="bluetooth_disconnect_all_profiles">This will end your connection with:<br><b><xliff:g id="device_name">%1$s</xliff:g></b></string> + <!-- Bluetooth Visibility message. This message informs the user that their device is now visible to other bluetooth devices. [CHAR LIMIT=50] --> + <string name="bluetooth_is_visible_message"><xliff:g id="device_name">%1$s</xliff:g> is now visible to nearby devices.</string> <!-- Bluetooth broadcasting settings, option to enable/disable broadcasting --> <string name="bluetooth_broadcasting">Broadcasting</string> <!-- Bluetooth settings. Dialog title to disable a single profile of a device. [CHAR LIMIT=40] --> @@ -1103,7 +1105,7 @@ <!-- Bluetooth settings: The title of the preference (list item) that initiates a scan for devices --> <string name="bluetooth_preference_scan_title">Scan for devices</string> <!-- Bluetooth settings: The title of the action button that initiates a search for nearby devices [CHAR LIMIT=20] --> - <string name="bluetooth_search_for_devices">Search for devices</string> + <string name="bluetooth_search_for_devices">Refresh</string> <!-- Bluetooth settings: The title of the action button while a search for nearby devices is in progress [CHAR LIMIT=20] --> <string name="bluetooth_searching_for_devices">Searching\u2026</string> <!-- Bluetooth settings: The sub heading for device settings. [CHAR LIMIT=30] --> diff --git a/src/com/android/settings/bluetooth/BluetoothSettings.java b/src/com/android/settings/bluetooth/BluetoothSettings.java index 8eee272..0bcac62 100755 --- a/src/com/android/settings/bluetooth/BluetoothSettings.java +++ b/src/com/android/settings/bluetooth/BluetoothSettings.java @@ -57,16 +57,14 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem private static final int MENU_ID_SCAN = Menu.FIRST; private static final int MENU_ID_RENAME_DEVICE = Menu.FIRST + 1; - private static final int MENU_ID_VISIBILITY_TIMEOUT = Menu.FIRST + 2; - private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 3; - private static final int MENU_ID_MESSAGE_ACCESS = Menu.FIRST + 4; + private static final int MENU_ID_SHOW_RECEIVED = Menu.FIRST + 2; + private static final int MENU_ID_MESSAGE_ACCESS = Menu.FIRST + 3; /* Private intent to show the list of received files */ private static final String BTOPP_ACTION_OPEN_RECEIVED_FILES = "android.btopp.intent.action.OPEN_RECEIVED_FILES"; private BluetoothEnabler mBluetoothEnabler; - private BluetoothDiscoverableEnabler mDiscoverableEnabler; private PreferenceGroup mPairedDevicesCategory; private PreferenceGroup mAvailableDevicesCategory; @@ -142,13 +140,13 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } super.onResume(); - if (mDiscoverableEnabler != null) { - mDiscoverableEnabler.resume(getActivity()); - } getActivity().registerReceiver(mReceiver, mIntentFilter); if (mLocalAdapter != null) { updateContent(mLocalAdapter.getBluetoothState(), mActivityStarted); } + + // Make the device visible to other devices. + mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE); } @Override @@ -158,9 +156,9 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem mBluetoothEnabler.pause(); } getActivity().unregisterReceiver(mReceiver); - if (mDiscoverableEnabler != null) { - mDiscoverableEnabler.pause(); - } + + // Make the device only visible to connected devices. + mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE); } @Override @@ -179,9 +177,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem menu.add(Menu.NONE, MENU_ID_RENAME_DEVICE, 0, R.string.bluetooth_rename_device) .setEnabled(bluetoothIsEnabled) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); - menu.add(Menu.NONE, MENU_ID_VISIBILITY_TIMEOUT, 0, R.string.bluetooth_visibility_timeout) - .setEnabled(bluetoothIsEnabled) - .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); menu.add(Menu.NONE, MENU_ID_SHOW_RECEIVED, 0, R.string.bluetooth_show_received_files) .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // Message Access API is still not finished, once completed we undo this check. @@ -207,11 +202,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem getFragmentManager(), "rename device"); return true; - case MENU_ID_VISIBILITY_TIMEOUT: - new BluetoothVisibilityTimeoutFragment().show( - getFragmentManager(), "visibility timeout"); - return true; - case MENU_ID_SHOW_RECEIVED: Intent intent = new Intent(BTOPP_ACTION_OPEN_RECEIVED_FILES); getActivity().sendBroadcast(intent); @@ -262,30 +252,6 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem preferenceScreen.setOrderingAsAdded(true); mDevicePreferenceMap.clear(); - // This device - if (mMyDevicePreference == null) { - mMyDevicePreference = new Preference(getActivity()); - } - mMyDevicePreference.setTitle(mLocalAdapter.getName()); - if (getResources().getBoolean(com.android.internal.R.bool.config_voice_capable)) { - mMyDevicePreference.setIcon(R.drawable.ic_bt_cellphone); // for phones - } else { - mMyDevicePreference.setIcon(R.drawable.ic_bt_laptop); // for tablets, etc. - } - mMyDevicePreference.setPersistent(false); - mMyDevicePreference.setEnabled(true); - preferenceScreen.addPreference(mMyDevicePreference); - - if (!isRestrictedAndNotPinProtected()) { - if (mDiscoverableEnabler == null) { - mDiscoverableEnabler = new BluetoothDiscoverableEnabler(mLocalAdapter, - mMyDevicePreference); - mDiscoverableEnabler.resume(getActivity()); - LocalBluetoothManager.getInstance(getActivity()).setDiscoverableEnabler( - mDiscoverableEnabler); - } - } - // Paired devices category if (mPairedDevicesCategory == null) { mPairedDevicesCategory = new PreferenceCategory(getActivity()); @@ -297,13 +263,10 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem BluetoothDeviceFilter.BONDED_DEVICE_FILTER); int numberOfPairedDevices = mPairedDevicesCategory.getPreferenceCount(); - if (mDiscoverableEnabler != null) { - mDiscoverableEnabler.setNumberOfPairedDevices(numberOfPairedDevices); - } - // Available devices category if (mAvailableDevicesCategory == null) { mAvailableDevicesCategory = new BluetoothProgressCategory(getActivity()); + mAvailableDevicesCategory.setSelectable(false); } else { mAvailableDevicesCategory.removeAll(); } @@ -331,6 +294,16 @@ public final class BluetoothSettings extends DeviceListPreferenceFragment implem } } } + + if (mMyDevicePreference == null) { + mMyDevicePreference = new Preference(getActivity()); + } + mMyDevicePreference.setSummary(getResources().getString( + R.string.bluetooth_is_visible_message, mLocalAdapter.getName())); + mMyDevicePreference.setSelectable(false); + mMyDevicePreference.setEnabled(false); + preferenceScreen.addPreference(mMyDevicePreference); + getActivity().invalidateOptionsMenu(); return; // not break |