Fix some Bluetooth settings bugs.

- Remove BluetoothFindNearby.java (no longer used)
- Show message when Bluetooth is turning off
- Fix case where device name sometimes didn't show when turning BT on
- Disable "Rename device" and "Visibility timeout" menus when BT is off
- Remove "Got onDeviceAdded, but cachedDevice already exists" log message
- Never show "Rename device" in action menu (bug 5064378)
- Show discovery time remaining as "m:ss", not "mm:ss" (bug 5064104)

Bug: 5064378
Bug: 5064104
Change-Id: I79609dfdad61993a28cff64c9e082870ff74d180
This commit is contained in:
Jake Hamby
2011-07-19 20:03:25 -07:00
parent 672b3c6576
commit 49cfe8a3c8
5 changed files with 36 additions and 95 deletions

View File

@@ -144,12 +144,24 @@ final class BluetoothDiscoverableEnabler implements Preference.OnPreferenceClick
if (getDiscoverableTimeout() == DISCOVERABLE_TIMEOUT_NEVER) {
mDiscoveryPreference.setSummary(R.string.bluetooth_is_discoverable_always);
} else {
String textTimeout = DateUtils.formatElapsedTime(timeout);
String textTimeout = formatTimeRemaining(timeout);
mDiscoveryPreference.setSummary(mContext.getString(R.string.bluetooth_is_discoverable,
textTimeout));
}
}
private static String formatTimeRemaining(int timeout) {
StringBuilder sb = new StringBuilder(6); // "mmm:ss"
int min = timeout / 60;
sb.append(min).append(':');
int sec = timeout - (min * 60);
if (sec < 10) {
sb.append('0');
}
sb.append(sec);
return sb.toString();
}
void setDiscoverableTimeout(int index) {
String timeoutValue;
switch (index) {