Change header in choose lock password
Instead of a separate headerText view, change the header in the GlifLayout directly. Test: Manual. Existing tests pass Bug: 38180862 Change-Id: I02d692870f5e2230ccae87a5ac2aee4def8f61af
This commit is contained in:
@@ -32,20 +32,11 @@
|
|||||||
android:gravity="center_horizontal"
|
android:gravity="center_horizontal"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<!-- header text ('Enter Pin') -->
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/headerText"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:accessibilityLiveRegion="polite"
|
|
||||||
android:gravity="center"
|
|
||||||
android:lines="2"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceMedium"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/password_container"
|
android:id="@+id/password_container"
|
||||||
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:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
|
@@ -185,8 +185,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
private ChooseLockSettingsHelper mChooseLockSettingsHelper;
|
||||||
private Stage mUiStage = Stage.Introduction;
|
private Stage mUiStage = Stage.Introduction;
|
||||||
private PasswordRequirementAdapter mPasswordRequirementAdapter;
|
private PasswordRequirementAdapter mPasswordRequirementAdapter;
|
||||||
|
private GlifLayout mLayout;
|
||||||
|
|
||||||
private TextView mHeaderText;
|
|
||||||
private String mFirstPin;
|
private String mFirstPin;
|
||||||
private RecyclerView mPasswordRestrictionView;
|
private RecyclerView mPasswordRestrictionView;
|
||||||
protected boolean mIsAlphaMode;
|
protected boolean mIsAlphaMode;
|
||||||
@@ -292,6 +292,8 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
public void onViewCreated(View view, Bundle savedInstanceState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onViewCreated(view, savedInstanceState);
|
||||||
|
|
||||||
|
mLayout = (GlifLayout) view;
|
||||||
|
|
||||||
// Make the password container consume the optical insets so the edit text is aligned
|
// Make the password container consume the optical insets so the edit text is aligned
|
||||||
// with the sides of the parent visually.
|
// with the sides of the parent visually.
|
||||||
ViewGroup container = view.findViewById(R.id.password_container);
|
ViewGroup container = view.findViewById(R.id.password_container);
|
||||||
@@ -316,7 +318,6 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
mPasswordEntryInputDisabler = new TextViewInputDisabler(mPasswordEntry);
|
mPasswordEntryInputDisabler = new TextViewInputDisabler(mPasswordEntry);
|
||||||
|
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
mHeaderText = (TextView) view.findViewById(R.id.headerText);
|
|
||||||
|
|
||||||
int currentType = mPasswordEntry.getInputType();
|
int currentType = mPasswordEntry.getInputType();
|
||||||
mPasswordEntry.setInputType(mIsAlphaMode ? currentType
|
mPasswordEntry.setInputType(mIsAlphaMode ? currentType
|
||||||
@@ -360,7 +361,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
: R.string.lockpassword_choose_your_pin_header;
|
: R.string.lockpassword_choose_your_pin_header;
|
||||||
CharSequence title = getText(id);
|
CharSequence title = getText(id);
|
||||||
sa.setTitle(title);
|
sa.setTitle(title);
|
||||||
((GlifLayout) view).setHeaderText(title);
|
mLayout.setHeaderText(title);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -479,7 +480,7 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
// If the stage changed, announce the header for accessibility. This
|
// If the stage changed, announce the header for accessibility. This
|
||||||
// is a no-op when accessibility is disabled.
|
// is a no-op when accessibility is disabled.
|
||||||
if (previousStage != stage) {
|
if (previousStage != stage) {
|
||||||
mHeaderText.announceForAccessibility(mHeaderText.getText());
|
mLayout.announceForAccessibility(mLayout.getHeaderText());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -788,11 +789,11 @@ public class ChooseLockPassword extends SettingsActivity {
|
|||||||
|
|
||||||
private void setHeaderText(String text) {
|
private void setHeaderText(String text) {
|
||||||
// Only set the text if it is different than the existing one to avoid announcing again.
|
// Only set the text if it is different than the existing one to avoid announcing again.
|
||||||
if (!TextUtils.isEmpty(mHeaderText.getText())
|
if (!TextUtils.isEmpty(mLayout.getHeaderText())
|
||||||
&& mHeaderText.getText().toString().equals(text)) {
|
&& mLayout.getHeaderText().toString().equals(text)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mHeaderText.setText(text);
|
mLayout.setHeaderText(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void afterTextChanged(Editable s) {
|
public void afterTextChanged(Editable s) {
|
||||||
|
Reference in New Issue
Block a user