Merge "Fix PATTERN UI to align PIN&PASSWORD screen" into pi-dev

This commit is contained in:
Jyun LuoLai
2018-03-23 00:56:00 +00:00
committed by Android (Google) Code Review
5 changed files with 35 additions and 1 deletions

View File

@@ -82,7 +82,7 @@
android:minLines="2" android:minLines="2"
android:gravity="center" android:gravity="center"
android:paddingHorizontal="?attr/suwMarginSides" android:paddingHorizontal="?attr/suwMarginSides"
android:textSize="18sp" /> android:textSize="12sp" />
<com.android.setupwizardlib.view.FillContentLayout <com.android.setupwizardlib.view.FillContentLayout
style="@style/LockPatternContainerStyle" style="@style/LockPatternContainerStyle"

View File

@@ -128,5 +128,7 @@
<color name="homepage_generic_icon_background">#1A73E8</color> <color name="homepage_generic_icon_background">#1A73E8</color>
<!-- End of dashboard/homepage icon background colors --> <!-- End of dashboard/homepage icon background colors -->
<color name="glif_error_color">@*android:color/material_red_A700</color>
</resources> </resources>

View File

@@ -3531,6 +3531,8 @@
<string name="lockpassword_confirm_passwords_dont_match">Passwords don\u2019t match</string> <string name="lockpassword_confirm_passwords_dont_match">Passwords don\u2019t match</string>
<!-- Header on pin confirm screen if second pin doesn't match the first. [CHAR LIMIT=30]--> <!-- Header on pin confirm screen if second pin doesn't match the first. [CHAR LIMIT=30]-->
<string name="lockpassword_confirm_pins_dont_match">PINs don\u2019t match</string> <string name="lockpassword_confirm_pins_dont_match">PINs don\u2019t match</string>
<!-- Header on pattern confirm screen [CHAR LIMIT=40] -->
<string name="lockpassword_draw_your_pattern_again_header">Draw your pattern again</string>
<!-- Header shown to ask the user to select an unlock method [CHAR LIMIT=30] --> <!-- Header shown to ask the user to select an unlock method [CHAR LIMIT=30] -->
<string name="lockpassword_choose_lock_generic_header">Unlock selection</string> <string name="lockpassword_choose_lock_generic_header">Unlock selection</string>
<!-- Toast shown if setting password was successful --> <!-- Toast shown if setting password was successful -->

View File

@@ -53,6 +53,7 @@
<item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item> <item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
<item name="*android:colorError">@color/glif_error_color</item>
</style> </style>
<style name="GlifV2Theme" parent="SuwThemeGlifV2"> <style name="GlifV2Theme" parent="SuwThemeGlifV2">
@@ -88,6 +89,7 @@
<item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item> <item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
<item name="*android:colorError">@color/glif_error_color</item>
</style> </style>
<style name="GlifV3Theme" parent="SuwThemeGlifV3"> <style name="GlifV3Theme" parent="SuwThemeGlifV3">
@@ -123,6 +125,7 @@
<item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item> <item name="preferenceTheme">@style/PreferenceTheme.SetupWizard</item>
<item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item> <item name="*android:lockPatternStyle">@style/LockPatternStyle.Setup</item>
<item name="*android:colorError">@color/glif_error_color</item>
</style> </style>
<style name="SetupWizardTheme.Transparent" parent="GlifTheme"> <style name="SetupWizardTheme.Transparent" parent="GlifTheme">

View File

@@ -20,9 +20,11 @@ import android.app.Activity;
import android.app.Fragment; import android.app.Fragment;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList;
import android.content.res.Resources.Theme; import android.content.res.Resources.Theme;
import android.os.Bundle; import android.os.Bundle;
import android.util.Log; import android.util.Log;
import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -171,6 +173,7 @@ public class ChooseLockPattern extends SettingsActivity {
private String mCurrentPattern; private String mCurrentPattern;
private boolean mHasChallenge; private boolean mHasChallenge;
private long mChallenge; private long mChallenge;
protected TextView mTitleText;
protected TextView mHeaderText; protected TextView mHeaderText;
protected TextView mMessageText; protected TextView mMessageText;
protected LockPatternView mLockPatternView; protected LockPatternView mLockPatternView;
@@ -179,6 +182,7 @@ public class ChooseLockPattern extends SettingsActivity {
private TextView mFooterRightButton; private TextView mFooterRightButton;
protected List<LockPatternView.Cell> mChosenPattern = null; protected List<LockPatternView.Cell> mChosenPattern = null;
private boolean mHideDrawer = false; private boolean mHideDrawer = false;
private ColorStateList mDefaultHeaderColorList;
// ScrollView that contains title and header, only exist in land mode // ScrollView that contains title and header, only exist in land mode
private ScrollView mTitleHeaderScrollView; private ScrollView mTitleHeaderScrollView;
@@ -265,6 +269,9 @@ public class ChooseLockPattern extends SettingsActivity {
private void patternInProgress() { private void patternInProgress() {
mHeaderText.setText(R.string.lockpattern_recording_inprogress); mHeaderText.setText(R.string.lockpattern_recording_inprogress);
if (mDefaultHeaderColorList != null) {
mHeaderText.setTextColor(mDefaultHeaderColorList);
}
mFooterText.setText(""); mFooterText.setText("");
mFooterLeftButton.setEnabled(false); mFooterLeftButton.setEnabled(false);
mFooterRightButton.setEnabled(false); mFooterRightButton.setEnabled(false);
@@ -465,10 +472,13 @@ public class ChooseLockPattern extends SettingsActivity {
return layout; return layout;
} }
@Override @Override
public void onViewCreated(View view, Bundle savedInstanceState) { public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
mTitleText = view.findViewById(R.id.suw_layout_title);
mHeaderText = (TextView) view.findViewById(R.id.headerText); mHeaderText = (TextView) view.findViewById(R.id.headerText);
mDefaultHeaderColorList = mHeaderText.getTextColors();
mMessageText = view.findViewById(R.id.message); 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);
@@ -664,6 +674,23 @@ public class ChooseLockPattern extends SettingsActivity {
mFooterText.setText(stage.footerMessage); mFooterText.setText(stage.footerMessage);
} }
if (stage == Stage.ConfirmWrong || stage == Stage.ChoiceTooShort) {
TypedValue typedValue = new TypedValue();
Theme theme = getActivity().getTheme();
theme.resolveAttribute(R.attr.colorError, typedValue, true);
mHeaderText.setTextColor(typedValue.data);
} else {
if (mDefaultHeaderColorList != null) {
mHeaderText.setTextColor(mDefaultHeaderColorList);
}
if (stage == Stage.NeedToConfirm && mForFingerprint) {
mHeaderText.setText("");
mTitleText.setText(R.string.lockpassword_draw_your_pattern_again_header);
}
}
updateFooterLeftButton(stage, mFooterLeftButton); updateFooterLeftButton(stage, mFooterLeftButton);
setRightButtonText(stage.rightMode.text); setRightButtonText(stage.rightMode.text);