diff --git a/res/layout/bluetooth_pin_confirm.xml b/res/layout/bluetooth_pin_confirm.xml index 2968b38828a..ebdf65de78f 100644 --- a/res/layout/bluetooth_pin_confirm.xml +++ b/res/layout/bluetooth_pin_confirm.xml @@ -29,31 +29,11 @@ android:layout_width="match_parent" android:orientation="vertical"> - - - - + android:textAppearance="@android:style/TextAppearance.Material.Body1" + android:textColor="@*android:color/secondary_text_material_light" /> diff --git a/res/values/strings.xml b/res/values/strings.xml index faa0c1ca170..fbd84abefd4 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1138,12 +1138,10 @@ - Bluetooth pairing request + Pair with %1$s? - - Device - Pairing code + Bluetooth pairing code Type the pairing code then press Return or Enter @@ -1172,7 +1170,7 @@ To pair with:<br><b>%1$s</b><br><br>Type on it:<br><b>%2$s</b>, then press Return or Enter. - Grant access to your contacts and call history when connected. + Allow %1$s to access your contacts and call history diff --git a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java index 29cac62eadd..7fa31b3f04a 100755 --- a/src/com/android/settings/bluetooth/BluetoothPairingDialog.java +++ b/src/com/android/settings/bluetooth/BluetoothPairingDialog.java @@ -168,7 +168,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createUserEntryDialog() { final AlertController.AlertParams p = mAlertParams; - p.mTitle = getString(R.string.bluetooth_pairing_request); + p.mTitle = getString(R.string.bluetooth_pairing_request, + mCachedDeviceManager.getName(mDevice)); p.mView = createPinEntryView(); p.mPositiveButtonText = getString(android.R.string.ok); p.mPositiveButtonListener = this; @@ -182,13 +183,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createPinEntryView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_entry, null); - TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); TextView messageViewCaptionHint = (TextView) view.findViewById(R.id.pin_values_hint); - TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView messageView2 = (TextView) view.findViewById(R.id.message_below_pin); CheckBox alphanumericPin = (CheckBox) view.findViewById(R.id.alphanumeric_pin); CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_entry_pin); + contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, + mCachedDeviceManager.getName(mDevice))); + if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { + contactSharing.setChecked(true); + } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ + contactSharing.setChecked(false); + } else { + contactSharing.setChecked(true); + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); + } + contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { @@ -209,8 +219,7 @@ public final class BluetoothPairingDialog extends AlertActivity implements mPairingView.addTextChangedListener(this); alphanumericPin.setOnCheckedChangeListener(this); - int messageId1; - int messageId2; + int messageId; int messageIdHint = R.string.bluetooth_pin_values_hint; int maxLength; switch (mType) { @@ -218,15 +227,13 @@ public final class BluetoothPairingDialog extends AlertActivity implements messageIdHint = R.string.bluetooth_pin_values_hint_16_digits; // FALLTHROUGH case BluetoothDevice.PAIRING_VARIANT_PIN: - messageId1 = R.string.bluetooth_enter_pin_msg; - messageId2 = R.string.bluetooth_enter_pin_other_device; + messageId = R.string.bluetooth_enter_pin_other_device; // Maximum of 16 characters in a PIN maxLength = BLUETOOTH_PIN_MAX_LENGTH; break; case BluetoothDevice.PAIRING_VARIANT_PASSKEY: - messageId1 = R.string.bluetooth_enter_pin_msg; - messageId2 = R.string.bluetooth_enter_passkey_other_device; + messageId = R.string.bluetooth_enter_passkey_other_device; // Maximum of 6 digits for passkey maxLength = BLUETOOTH_PASSKEY_MAX_LENGTH; alphanumericPin.setVisibility(View.GONE); @@ -237,10 +244,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; } - messageViewCaption.setText(messageId1); messageViewCaptionHint.setText(messageIdHint); - messageViewContent.setText(mCachedDeviceManager.getName(mDevice)); - messageView2.setText(messageId2); + messageView2.setText(messageId); mPairingView.setInputType(InputType.TYPE_CLASS_NUMBER); mPairingView.setFilters(new InputFilter[] { new LengthFilter(maxLength) }); @@ -250,15 +255,22 @@ public final class BluetoothPairingDialog extends AlertActivity implements private View createView() { View view = getLayoutInflater().inflate(R.layout.bluetooth_pin_confirm, null); - // Escape device name to avoid HTML injection. - String name = Html.escapeHtml(mCachedDeviceManager.getName(mDevice)); - TextView messageViewCaption = (TextView) view.findViewById(R.id.message_caption); - TextView messageViewContent = (TextView) view.findViewById(R.id.message_subhead); TextView pairingViewCaption = (TextView) view.findViewById(R.id.pairing_caption); TextView pairingViewContent = (TextView) view.findViewById(R.id.pairing_subhead); TextView messagePairing = (TextView) view.findViewById(R.id.pairing_code_message); CheckBox contactSharing = (CheckBox) view.findViewById( R.id.phonebook_sharing_message_confirm_pin); + contactSharing.setText(getString(R.string.bluetooth_pairing_shares_phonebook, + mCachedDeviceManager.getName(mDevice))); + if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_ALLOWED) { + contactSharing.setChecked(true); + } else if (mDevice.getPhonebookAccessPermission() == BluetoothDevice.ACCESS_REJECTED){ + contactSharing.setChecked(false); + } else { + contactSharing.setChecked(true); + mDevice.setPhonebookAccessPermission(BluetoothDevice.ACCESS_ALLOWED); + } + contactSharing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean isChecked) { @@ -283,14 +295,12 @@ public final class BluetoothPairingDialog extends AlertActivity implements case BluetoothDevice.PAIRING_VARIANT_DISPLAY_PIN: messagePairing.setVisibility(View.VISIBLE); case BluetoothDevice.PAIRING_VARIANT_PASSKEY_CONFIRMATION: - messageCaption = getString(R.string.bluetooth_enter_pin_msg); pairingContent = mPairingKey; break; case BluetoothDevice.PAIRING_VARIANT_CONSENT: case BluetoothDevice.PAIRING_VARIANT_OOB_CONSENT: messagePairing.setVisibility(View.VISIBLE); - messageCaption = getString(R.string.bluetooth_enter_pin_msg); break; default: @@ -298,11 +308,6 @@ public final class BluetoothPairingDialog extends AlertActivity implements return null; } - if (messageViewCaption != null) { - messageViewCaption.setText(messageCaption); - messageViewContent.setText(name); - } - if (pairingContent != null) { pairingViewCaption.setVisibility(View.VISIBLE); pairingViewContent.setVisibility(View.VISIBLE); @@ -314,7 +319,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConfirmationDialog() { final AlertController.AlertParams p = mAlertParams; - p.mTitle = getString(R.string.bluetooth_pairing_request); + p.mTitle = getString(R.string.bluetooth_pairing_request, + mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; @@ -325,7 +331,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createConsentDialog() { final AlertController.AlertParams p = mAlertParams; - p.mTitle = getString(R.string.bluetooth_pairing_request); + p.mTitle = getString(R.string.bluetooth_pairing_request, + mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mPositiveButtonText = getString(R.string.bluetooth_pairing_accept); p.mPositiveButtonListener = this; @@ -336,7 +343,8 @@ public final class BluetoothPairingDialog extends AlertActivity implements private void createDisplayPasskeyOrPinDialog() { final AlertController.AlertParams p = mAlertParams; - p.mTitle = getString(R.string.bluetooth_pairing_request); + p.mTitle = getString(R.string.bluetooth_pairing_request, + mCachedDeviceManager.getName(mDevice)); p.mView = createView(); p.mNegativeButtonText = getString(android.R.string.cancel); p.mNegativeButtonListener = this;