Modified the Bluetooth 2.1 Passkey confirmation dialog
- Changed the Passkey confirmation to show Pair/Don't Pair. - Fixed the problem where the Ok button was showing up as Pair for the error dialog box. - Disable the toasts when pairing failed in this case. Will need to check if this causes regression in other cases.
This commit is contained in:
@@ -515,7 +515,11 @@
|
|||||||
<!-- Message when bluetooth dialog for passkey entry is showing -->
|
<!-- Message when bluetooth dialog for passkey entry is showing -->
|
||||||
<string name="bluetooth_enter_passkey_msg"><xliff:g id="device_name">%1$s</xliff:g>\n\nType passkey to pair.\n</string>
|
<string name="bluetooth_enter_passkey_msg"><xliff:g id="device_name">%1$s</xliff:g>\n\nType passkey to pair.\n</string>
|
||||||
<!-- Message when bluetooth dialog for confirmation of passkey is showing -->
|
<!-- Message when bluetooth dialog for confirmation of passkey is showing -->
|
||||||
<string name="bluetooth_confirm_passkey_msg">\n Passkey: <xliff:g id="passkey">%2$d</xliff:g>\n\nIs the same passkey displayed on: <xliff:g id="device_name">%1$s</xliff:g> ?\n</string>
|
<string name="bluetooth_confirm_passkey_msg">To pair with \u0022<xliff:g id="device_name">%1$s</xliff:g>\u0022, confirm that it is showing the passkey: <xliff:g id="passkey">%2$d</xliff:g>.</string>
|
||||||
|
<!-- Button text for accepting an incoming pairing request -->
|
||||||
|
<string name="bluetooth_pairing_accept">Pair</string>
|
||||||
|
<!-- Button text for declining an incoming pairing request -->
|
||||||
|
<string name="bluetooth_pairing_decline">Don\u0027t Pair</string>
|
||||||
|
|
||||||
<!-- Title for BT error dialogs. -->
|
<!-- Title for BT error dialogs. -->
|
||||||
<string name="bluetooth_error_title">Attention</string>
|
<string name="bluetooth_error_title">Attention</string>
|
||||||
|
@@ -79,8 +79,7 @@ public class BluetoothEventRedirector {
|
|||||||
mManager.getLocalDeviceManager().onBondingStateChanged(address, bondState);
|
mManager.getLocalDeviceManager().onBondingStateChanged(address, bondState);
|
||||||
if (bondState == BluetoothDevice.BOND_NOT_BONDED) {
|
if (bondState == BluetoothDevice.BOND_NOT_BONDED) {
|
||||||
int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR);
|
int reason = intent.getIntExtra(BluetoothIntent.REASON, BluetoothError.ERROR);
|
||||||
if (reason == BluetoothDevice.UNBOND_REASON_AUTH_FAILED ||
|
if (reason == BluetoothDevice.UNBOND_REASON_AUTH_REJECTED ||
|
||||||
reason == BluetoothDevice.UNBOND_REASON_AUTH_REJECTED ||
|
|
||||||
reason == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN) {
|
reason == BluetoothDevice.UNBOND_REASON_REMOTE_DEVICE_DOWN) {
|
||||||
mManager.getLocalDeviceManager().onBondingError(address, reason);
|
mManager.getLocalDeviceManager().onBondingError(address, reason);
|
||||||
}
|
}
|
||||||
|
@@ -160,9 +160,9 @@ public class BluetoothPairingDialog extends AlertActivity implements DialogInter
|
|||||||
p.mIconId = android.R.drawable.ic_dialog_info;
|
p.mIconId = android.R.drawable.ic_dialog_info;
|
||||||
p.mTitle = getString(R.string.bluetooth_pin_entry);
|
p.mTitle = getString(R.string.bluetooth_pin_entry);
|
||||||
p.mView = createView();
|
p.mView = createView();
|
||||||
p.mPositiveButtonText = getString(android.R.string.yes);
|
p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept);
|
||||||
p.mPositiveButtonListener = this;
|
p.mPositiveButtonListener = this;
|
||||||
p.mNegativeButtonText = getString(android.R.string.no);
|
p.mNegativeButtonText = getString(R.string.bluetooth_pairing_decline);
|
||||||
p.mNegativeButtonListener = this;
|
p.mNegativeButtonListener = this;
|
||||||
setupAlert();
|
setupAlert();
|
||||||
}
|
}
|
||||||
@@ -191,8 +191,6 @@ public class BluetoothPairingDialog extends AlertActivity implements DialogInter
|
|||||||
unregisterReceiver(mReceiver);
|
unregisterReceiver(mReceiver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
if (s.length() > 0) {
|
if (s.length() > 0) {
|
||||||
mOkButton.setEnabled(true);
|
mOkButton.setEnabled(true);
|
||||||
@@ -212,6 +210,7 @@ public class BluetoothPairingDialog extends AlertActivity implements DialogInter
|
|||||||
|
|
||||||
mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
|
mOkButton = mAlert.getButton(DialogInterface.BUTTON_POSITIVE);
|
||||||
mOkButton.setEnabled(true);
|
mOkButton.setEnabled(true);
|
||||||
|
mOkButton.setText(android.R.string.ok);
|
||||||
mAlert.getButton(DialogInterface.BUTTON_NEGATIVE).setVisibility(View.GONE);
|
mAlert.getButton(DialogInterface.BUTTON_NEGATIVE).setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user