Fix Bluetooth enable dialog to match Android style guide.
When an app requests to enable Bluetooth and/or Bluetooth discovery, we show a dialog for user confirmation. Remove the dialog title, update the message text and button labels to be more descriptive, and use the standard dialog layout instead of a custom layout. Also fixes the button layout on the Bluetooth permission test app so that the "Discoverable" button doesn't wrap to two lines. Bug: 6001468 Change-Id: I731e2f31b4c822395fc3f83584a092550d9ae7d3
This commit is contained in:
@@ -36,6 +36,9 @@ public class BluetoothRequestPermissionTest extends Activity {
|
||||
BluetoothAdapter mAdapter;
|
||||
private ArrayAdapter<String> mMsgAdapter;
|
||||
|
||||
// Discoverable button alternates between 20 second timeout and no timeout.
|
||||
private boolean mDiscoveryWithTimeout = true;
|
||||
|
||||
private class BtOnClickListener implements OnClickListener {
|
||||
final boolean mEnableOnly; // enable or enable + discoverable
|
||||
|
||||
@@ -103,7 +106,10 @@ public class BluetoothRequestPermissionTest extends Activity {
|
||||
} else {
|
||||
addMsg("Starting activity to enable bt + discovery");
|
||||
i.setAction(BluetoothAdapter.ACTION_REQUEST_DISCOVERABLE);
|
||||
i.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, 20);
|
||||
// Discoverability duration toggles between 20 seconds and no timeout.
|
||||
int timeout = (mDiscoveryWithTimeout ? 20 : 0);
|
||||
i.putExtra(BluetoothAdapter.EXTRA_DISCOVERABLE_DURATION, timeout);
|
||||
mDiscoveryWithTimeout = !mDiscoveryWithTimeout;
|
||||
}
|
||||
startActivityForResult(i, 1);
|
||||
}
|
||||
|
Reference in New Issue
Block a user