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:
Jake Hamby
2012-06-11 17:04:14 -07:00
parent e9f89cfbf5
commit 95c1003f1c
6 changed files with 32 additions and 70 deletions

View File

@@ -72,26 +72,20 @@ public class RequestPermissionHelperActivity extends AlertActivity implements
void createDialog() {
final AlertController.AlertParams p = mAlertParams;
p.mIconId = android.R.drawable.ic_dialog_info;
p.mTitle = getString(R.string.bluetooth_permission_request);
View view = getLayoutInflater().inflate(R.layout.bluetooth_discoverable, null);
p.mView = view;
TextView tv = (TextView) view.findViewById(R.id.message);
if (mEnableOnly) {
tv.setText(getString(R.string.bluetooth_ask_enablement));
p.mMessage = getString(R.string.bluetooth_ask_enablement);
} else {
if (mTimeout == BluetoothDiscoverableEnabler.DISCOVERABLE_TIMEOUT_NEVER) {
tv.setText(getString(R.string.bluetooth_ask_enablement_and_lasting_discovery));
p.mMessage = getString(R.string.bluetooth_ask_enablement_and_lasting_discovery);
} else {
tv.setText(getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout));
p.mMessage = getString(R.string.bluetooth_ask_enablement_and_discovery, mTimeout);
}
}
p.mPositiveButtonText = getString(R.string.yes);
p.mPositiveButtonText = getString(R.string.allow);
p.mPositiveButtonListener = this;
p.mNegativeButtonText = getString(R.string.no);
p.mNegativeButtonText = getString(R.string.deny);
p.mNegativeButtonListener = this;
setupAlert();