From 77395cc39c88af0bb20ea18af532c87e934fb187 Mon Sep 17 00:00:00 2001 From: Michael Chan Date: Wed, 2 Sep 2009 12:30:05 -0700 Subject: [PATCH] b/2050798 Bluetooth Passkeys should always be 6 digits so show leading zeros if needed. Removed extra new lines in the passkey and pin dialogs because the string didn't fit in landscape mode. (scrollbars to appeared) --- res/values/strings.xml | 6 +++--- .../android/settings/bluetooth/BluetoothPairingDialog.java | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 2af9b187db5..a73f9105a0e 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -513,11 +513,11 @@ Bluetooth device info - %1$s\n\nType PIN to pair.\n(Try 0000 or 1234.) + %1$s\nType PIN to pair.\n(Try 0000 or 1234.) - %1$s\n\nType passkey to pair.\n + %1$s\nType passkey to pair.\n - To pair with \u0022%1$s\u0022, confirm that it is showing the passkey: %2$d. + To pair with \u0022%1$s\u0022, confirm that it is showing the passkey: %2$s. Pair diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java index 1e0da903a0d..ac5dfbaa584 100644 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java @@ -53,7 +53,7 @@ public class BluetoothPairingDialog extends AlertActivity implements DialogInter private LocalBluetoothManager mLocalManager; private BluetoothDevice mDevice; private int mType; - private int mConfirmationPasskey; + private String mConfirmationPasskey; private EditText mPairingView; private Button mOkButton; @@ -95,12 +95,13 @@ public class BluetoothPairingDialog extends AlertActivity implements DialogInter } else if (mType == BluetoothDevice.PAIRING_VARIANT_PASSKEY) { createUserEntryDialog(); } else if (mType == BluetoothDevice.PAIRING_VARIANT_CONFIRMATION){ - mConfirmationPasskey = + int passkey = intent.getIntExtra(BluetoothIntent.PASSKEY, BluetoothClass.ERROR); - if (mConfirmationPasskey == BluetoothClass.ERROR) { + if (passkey == BluetoothClass.ERROR) { Log.e(TAG, "Invalid ConfirmationPasskey received, not showing any dialog"); return; } + mConfirmationPasskey = String.format("%06d", passkey); createConfirmationDialog(); } else { Log.e(TAG, "Incorrect pairing type received, not showing any dialog");