From b39820dcb672631f0922fe5eea6ad210e3e5ba74 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 9 Mar 2018 10:40:29 -0800 Subject: [PATCH] Clarify Registration Lock reminder Fixes #7484 --- res/layout/registration_lock_reminder_view.xml | 3 ++- res/values/strings.xml | 3 ++- .../securesms/lock/RegistrationLockDialog.java | 9 +++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/res/layout/registration_lock_reminder_view.xml b/res/layout/registration_lock_reminder_view.xml index c36b560972..9006a95ea0 100644 --- a/res/layout/registration_lock_reminder_view.xml +++ b/res/layout/registration_lock_reminder_view.xml @@ -18,6 +18,7 @@ android:layout_height="wrap_content" android:textColor="@color/white" android:textSize="18sp" + android:gravity="center_horizontal" android:text="@string/registration_lock_reminder_view__enter_your_registration_lock_pin"/> @@ -47,6 +48,6 @@ android:paddingRight="20dp" android:textSize="15sp" android:lineSpacingMultiplier="1.3" - tools:text="Registration Lock is enabled for your phone number. I forgot my PIN."/> + tools:text="Reminder: Registration Lock is enabled for your phone number. To help you memorize your Registration Lock PIN, Signal will periodically ask you to confirm it. I forgot my PIN."/> \ No newline at end of file diff --git a/res/values/strings.xml b/res/values/strings.xml index 1c21086b58..f533ce25c2 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1386,7 +1386,7 @@ Registration of this phone number will be possible without your Registration Lock PIN after 7 days have passed since this phone number was last active on Signal. You have %d days remaining. Registration lock PIN This phone number has Registration Lock enabled. Please enter the Registration Lock PIN. - Registration Lock is enabled for your phone number. + Registration Lock is enabled for your phone number. To help you memorize your Registration Lock PIN, Signal will periodically ask you to confirm it. I forgot my PIN. Forgotten PIN? Registration Lock helps protect your phone number from unauthorized registration attempts. This feature can be disabled at any time in your Signal privacy settings @@ -1401,6 +1401,7 @@ Backups Signal is locked TAP TO UNLOCK + Reminder: diff --git a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java index 16d4eef1a0..3cb3ccac6d 100644 --- a/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java +++ b/src/org/thoughtcrime/securesms/lock/RegistrationLockDialog.java @@ -5,6 +5,7 @@ import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.DialogInterface; +import android.graphics.Typeface; import android.os.AsyncTask; import android.support.annotation.NonNull; import android.support.v7.app.AlertDialog; @@ -15,6 +16,7 @@ import android.text.Spanned; import android.text.TextWatcher; import android.text.method.LinkMovementMethod; import android.text.style.ClickableSpan; +import android.text.style.StyleSpan; import android.util.DisplayMetrics; import android.util.Log; import android.view.Display; @@ -55,8 +57,8 @@ public class RegistrationLockDialog { display.getMetrics(metrics); dialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE); - dialog.getWindow().setLayout((int)(metrics.widthPixels * .75), ViewGroup.LayoutParams.WRAP_CONTENT); dialog.show(); + dialog.getWindow().setLayout((int)(metrics.widthPixels * .80), ViewGroup.LayoutParams.WRAP_CONTENT); EditText pinEditText = dialog.findViewById(R.id.pin); TextView reminder = dialog.findViewById(R.id.reminder); @@ -64,6 +66,7 @@ public class RegistrationLockDialog { assert pinEditText != null; assert reminder != null; + SpannableString reminderIntro = new SpannableString(context.getString(R.string.RegistrationLockDialog_reminder)); SpannableString reminderText = new SpannableString(context.getString(R.string.RegistrationLockDialog_registration_lock_is_enabled_for_your_phone_number)); SpannableString forgotText = new SpannableString(context.getString(R.string.RegistrationLockDialog_i_forgot_my_pin)); @@ -79,9 +82,11 @@ public class RegistrationLockDialog { } }; + + reminderIntro.setSpan(new StyleSpan(Typeface.BOLD), 0, reminderIntro.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); forgotText.setSpan(clickableSpan, 0, forgotText.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); - reminder.setText(new SpannableStringBuilder(reminderText).append(" ").append(forgotText)); + reminder.setText(new SpannableStringBuilder(reminderIntro).append(" ").append(reminderText).append(" ").append(forgotText)); reminder.setMovementMethod(LinkMovementMethod.getInstance()); pinEditText.addTextChangedListener(new TextWatcher() {