Merge "Update strings for pattern screens"

This commit is contained in:
TreeHugger Robot
2017-09-19 03:57:59 +00:00
committed by Android (Google) Code Review
5 changed files with 46 additions and 9 deletions

View File

@@ -48,6 +48,7 @@
style="@style/SuwGlifIcon" style="@style/SuwGlifIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="?attr/suwGlifHeaderGravity"
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:src="@drawable/ic_lock"/> android:src="@drawable/ic_lock"/>
@@ -71,13 +72,20 @@
android:layout_marginStart="0dp" android:layout_marginStart="0dp"
android:layout_marginEnd="0dp"/> android:layout_marginEnd="0dp"/>
<TextView
android:id="@+id/message"
style="@style/SuwDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="2" />
<!-- header message --> <!-- header message -->
<TextView <TextView
android:id="@+id/headerText" android:id="@+id/headerText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="16dp" android:layout_marginTop="16dp"
android:gravity="start|bottom" android:gravity="?attr/suwGlifHeaderGravity"
android:textSize="18sp"/> android:textSize="18sp"/>
</LinearLayout> </LinearLayout>

View File

@@ -44,6 +44,7 @@
style="@style/SuwGlifIcon" style="@style/SuwGlifIcon"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="?attr/suwGlifHeaderGravity"
android:src="@drawable/ic_lock" /> android:src="@drawable/ic_lock" />
<TextView <TextView

View File

@@ -68,6 +68,13 @@
android:paddingLeft="0dp" android:paddingLeft="0dp"
android:paddingRight="0dp"> android:paddingRight="0dp">
<TextView
android:id="@+id/message"
style="@style/SuwDescription.Glif"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minLines="2" />
<TextView android:id="@+id/headerText" <TextView android:id="@+id/headerText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@@ -3437,14 +3437,14 @@
<string name="lockpassword_choose_your_password_message">For security, set a password</string> <string name="lockpassword_choose_your_password_message">For security, set a password</string>
<!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_password_header_for_fingerprint">To use fingerprint, set password</string> <string name="lockpassword_choose_your_password_header_for_fingerprint">To use fingerprint, set password</string>
<!-- Header on first screen of choose pattern flow [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pattern_header">Choose your pattern</string>
<!-- Header on first screen of choose pattern as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose pattern as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pattern_header_for_fingerprint">To use fingerprint, set pattern</string> <string name="lockpassword_choose_your_pattern_header_for_fingerprint">To use fingerprint, set pattern</string>
<!-- Message on first screen of choose PIN flow [CHAR LIMIT=NONE] --> <!-- Message on first screen of choose PIN flow [CHAR LIMIT=NONE] -->
<string name="lockpassword_choose_your_pin_message">For security, set a PIN</string> <string name="lockpassword_choose_your_pin_message">For security, set a PIN</string>
<!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] --> <!-- Header on first screen of choose password/PIN as backup for fingerprint flow. If this string cannot be translated in under 40 characters, please translate "Set fingerprint backup" [CHAR LIMIT=40] -->
<string name="lockpassword_choose_your_pin_header_for_fingerprint">To use fingerprint, set PIN</string> <string name="lockpassword_choose_your_pin_header_for_fingerprint">To use fingerprint, set PIN</string>
<!-- Message on first screen of choose pattern flow [CHAR LIMIT=NONE] -->
<string name="lockpassword_choose_your_pattern_message">For security, set a pattern</string>
<!-- Header on password confirm screen [CHAR LIMIT=40] --> <!-- Header on password confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_confirm_your_password_header">Re-enter your password</string> <string name="lockpassword_confirm_your_password_header">Re-enter your password</string>
<!-- Header on pattern confirm screen [CHAR LIMIT=30] --> <!-- Header on pattern confirm screen [CHAR LIMIT=30] -->

View File

@@ -141,7 +141,7 @@ public class ChooseLockPattern extends SettingsActivity {
boolean forFingerprint = getIntent() boolean forFingerprint = getIntent()
.getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false); .getBooleanExtra(ChooseLockSettingsHelper.EXTRA_KEY_FOR_FINGERPRINT, false);
setTitle(forFingerprint ? R.string.lockpassword_choose_your_pattern_header_for_fingerprint setTitle(forFingerprint ? R.string.lockpassword_choose_your_pattern_header_for_fingerprint
: R.string.lockpassword_choose_your_pattern_header); : R.string.lockpassword_choose_your_screen_lock_header);
LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent); LinearLayout layout = (LinearLayout) findViewById(R.id.content_parent);
layout.setFitsSystemWindows(false); layout.setFitsSystemWindows(false);
} }
@@ -172,6 +172,7 @@ public class ChooseLockPattern extends SettingsActivity {
private boolean mHasChallenge; private boolean mHasChallenge;
private long mChallenge; private long mChallenge;
protected TextView mHeaderText; protected TextView mHeaderText;
protected TextView mMessageText;
protected LockPatternView mLockPatternView; protected LockPatternView mLockPatternView;
protected TextView mFooterText; protected TextView mFooterText;
private TextView mFooterLeftButton; private TextView mFooterLeftButton;
@@ -338,44 +339,55 @@ public class ChooseLockPattern extends SettingsActivity {
protected enum Stage { protected enum Stage {
Introduction( Introduction(
R.string.lock_settings_picker_fingerprint_added_security_message,
R.string.lockpassword_choose_your_pattern_message,
R.string.lockpattern_recording_intro_header, R.string.lockpattern_recording_intro_header,
LeftButtonMode.Cancel, RightButtonMode.ContinueDisabled, LeftButtonMode.Cancel, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
HelpScreen( HelpScreen(
R.string.lockpattern_settings_help_how_to_record, ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_settings_help_how_to_record,
LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false), LeftButtonMode.Gone, RightButtonMode.Ok, ID_EMPTY_MESSAGE, false),
ChoiceTooShort( ChoiceTooShort(
R.string.lock_settings_picker_fingerprint_added_security_message,
R.string.lockpassword_choose_your_pattern_message,
R.string.lockpattern_recording_incorrect_too_short, R.string.lockpattern_recording_incorrect_too_short,
LeftButtonMode.Retry, RightButtonMode.ContinueDisabled, LeftButtonMode.Retry, RightButtonMode.ContinueDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
FirstChoiceValid( FirstChoiceValid(
R.string.lock_settings_picker_fingerprint_added_security_message,
R.string.lockpassword_choose_your_pattern_message,
R.string.lockpattern_pattern_entered_header, R.string.lockpattern_pattern_entered_header,
LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false), LeftButtonMode.Retry, RightButtonMode.Continue, ID_EMPTY_MESSAGE, false),
NeedToConfirm( NeedToConfirm(
R.string.lockpattern_need_to_confirm, ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_confirm,
LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled, LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
ConfirmWrong( ConfirmWrong(
R.string.lockpattern_need_to_unlock_wrong, ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_need_to_unlock_wrong,
LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled, LeftButtonMode.Cancel, RightButtonMode.ConfirmDisabled,
ID_EMPTY_MESSAGE, true), ID_EMPTY_MESSAGE, true),
ChoiceConfirmed( ChoiceConfirmed(
R.string.lockpattern_pattern_confirmed_header, ID_EMPTY_MESSAGE, ID_EMPTY_MESSAGE, R.string.lockpattern_pattern_confirmed_header,
LeftButtonMode.Cancel, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false); LeftButtonMode.Cancel, RightButtonMode.Confirm, ID_EMPTY_MESSAGE, false);
/** /**
* @param messageForFingerprint The message displayed at the top, above header for
* fingerprint flow.
* @param message The message displayed at the top.
* @param headerMessage The message displayed at the top. * @param headerMessage The message displayed at the top.
* @param leftMode The mode of the left button. * @param leftMode The mode of the left button.
* @param rightMode The mode of the right button. * @param rightMode The mode of the right button.
* @param footerMessage The footer message. * @param footerMessage The footer message.
* @param patternEnabled Whether the pattern widget is enabled. * @param patternEnabled Whether the pattern widget is enabled.
*/ */
Stage(int headerMessage, Stage(int messageForFingerprint, int message, int headerMessage,
LeftButtonMode leftMode, LeftButtonMode leftMode,
RightButtonMode rightMode, RightButtonMode rightMode,
int footerMessage, boolean patternEnabled) { int footerMessage, boolean patternEnabled) {
this.headerMessage = headerMessage; this.headerMessage = headerMessage;
this.messageForFingerprint = messageForFingerprint;
this.message = message;
this.leftMode = leftMode; this.leftMode = leftMode;
this.rightMode = rightMode; this.rightMode = rightMode;
this.footerMessage = footerMessage; this.footerMessage = footerMessage;
@@ -383,6 +395,8 @@ public class ChooseLockPattern extends SettingsActivity {
} }
final int headerMessage; final int headerMessage;
final int messageForFingerprint;
final int message;
final LeftButtonMode leftMode; final LeftButtonMode leftMode;
final RightButtonMode rightMode; final RightButtonMode rightMode;
final int footerMessage; final int footerMessage;
@@ -450,6 +464,7 @@ public class ChooseLockPattern extends SettingsActivity {
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mHeaderText = (TextView) view.findViewById(R.id.headerText); mHeaderText = (TextView) view.findViewById(R.id.headerText);
mMessageText = view.findViewById(R.id.message);
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern); mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener); mLockPatternView.setOnPatternListener(mChooseNewLockPatternListener);
mLockPatternView.setTactileFeedbackEnabled( mLockPatternView.setTactileFeedbackEnabled(
@@ -634,6 +649,12 @@ public class ChooseLockPattern extends SettingsActivity {
} else { } else {
mHeaderText.setText(stage.headerMessage); mHeaderText.setText(stage.headerMessage);
} }
int message = mForFingerprint ? stage.messageForFingerprint : stage.message;
if (message == ID_EMPTY_MESSAGE) {
mMessageText.setText("");
} else {
mMessageText.setText(message);
}
if (stage.footerMessage == ID_EMPTY_MESSAGE) { if (stage.footerMessage == ID_EMPTY_MESSAGE) {
mFooterText.setText(""); mFooterText.setText("");
} else { } else {