Update lock pattern for landscape
- Using GlifLayout api to set title and description - Hide the header area for landscape mode Bug: 179317709 Test: visual verified 1) Settings -> Security -> Screen lock -> Pattern 2) Try setting screen lock if there's no pattern 3) Rotate the screen during the settings flow and see if there's an empty space leaving in the left side 4) Settings -> Security -> Fingerprint 5) Device will display a confirm lock pattern page 6) Rotate the screen and see if there's an empty space left Change-Id: I16f614eceb873f40b7c48583223aedcbcbd7447d
This commit is contained in:
@@ -48,13 +48,13 @@
|
||||
android:src="@drawable/ic_enterprise" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/headerText"
|
||||
android:id="@+id/suc_layout_title"
|
||||
style="@style/SudGlifHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sud_layout_description"
|
||||
android:id="@+id/sud_layout_subtitle"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -48,14 +48,14 @@
|
||||
android:src="@drawable/ic_lock" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/headerText"
|
||||
android:id="@+id/suc_layout_title"
|
||||
style="@style/SudGlifHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
style="@style/SudDescription.Glif"
|
||||
android:id="@+id/sud_layout_description"
|
||||
android:id="@+id/sud_layout_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="?attr/sudMarginStart"
|
||||
|
@@ -42,13 +42,13 @@
|
||||
android:src="@drawable/ic_enterprise" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/headerText"
|
||||
android:id="@+id/suc_layout_title"
|
||||
style="@style/SudGlifHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/sud_layout_description"
|
||||
android:id="@+id/sud_layout_subtitle"
|
||||
style="@style/SudDescription.Glif"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@@ -41,14 +41,14 @@
|
||||
android:src="@drawable/ic_lock" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/headerText"
|
||||
android:id="@+id/suc_layout_title"
|
||||
style="@style/SudGlifHeaderTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
style="@style/SudDescription.Glif"
|
||||
android:id="@+id/sud_layout_description"
|
||||
android:id="@+id/sud_layout_subtitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="?attr/sudMarginStart"
|
||||
|
@@ -32,6 +32,7 @@ import android.util.Pair;
|
||||
import android.util.TypedValue;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ScrollView;
|
||||
@@ -508,6 +509,12 @@ public class ChooseLockPattern extends SettingsActivity {
|
||||
Bundle savedInstanceState) {
|
||||
final GlifLayout layout = (GlifLayout) inflater.inflate(
|
||||
R.layout.choose_lock_pattern, container, false);
|
||||
switch(getContext().getDisplay().getRotation()) {
|
||||
case Surface.ROTATION_90:
|
||||
case Surface.ROTATION_270:
|
||||
layout.setLandscapeHeaderAreaVisible(false /* visible */);
|
||||
break;
|
||||
}
|
||||
layout.setHeaderText(getActivity().getTitle());
|
||||
if (getResources().getBoolean(R.bool.config_lock_pattern_minimal_ui)) {
|
||||
View iconView = layout.findViewById(R.id.sud_layout_icon);
|
||||
|
@@ -28,6 +28,7 @@ import android.os.UserManager;
|
||||
import android.os.storage.StorageManager;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.animation.AnimationUtils;
|
||||
@@ -45,6 +46,8 @@ import com.android.settingslib.animation.AppearAnimationCreator;
|
||||
import com.android.settingslib.animation.AppearAnimationUtils;
|
||||
import com.android.settingslib.animation.DisappearAnimationUtils;
|
||||
|
||||
import com.google.android.setupdesign.GlifLayout;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -90,8 +93,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
private boolean mDisappearing = false;
|
||||
private CountDownTimer mCountdownTimer;
|
||||
|
||||
private TextView mHeaderTextView;
|
||||
private TextView mDetailsTextView;
|
||||
private GlifLayout mGlifLayout;
|
||||
|
||||
// caller-supplied text for various prompts
|
||||
private CharSequence mHeaderText;
|
||||
@@ -117,9 +119,14 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
: R.layout.confirm_lock_pattern,
|
||||
container,
|
||||
false);
|
||||
mHeaderTextView = (TextView) view.findViewById(R.id.headerText);
|
||||
mGlifLayout = view.findViewById(R.id.setup_wizard_layout);
|
||||
switch(getContext().getDisplay().getRotation()) {
|
||||
case Surface.ROTATION_90:
|
||||
case Surface.ROTATION_270:
|
||||
mGlifLayout.setLandscapeHeaderAreaVisible(false /* visible */);
|
||||
break;
|
||||
}
|
||||
mLockPatternView = (LockPatternView) view.findViewById(R.id.lockPattern);
|
||||
mDetailsTextView = (TextView) view.findViewById(R.id.sud_layout_description);
|
||||
mErrorTextView = (TextView) view.findViewById(R.id.errorText);
|
||||
|
||||
mIsManagedProfile = UserManager.get(getActivity()).isManagedProfile(mEffectiveUserId);
|
||||
@@ -177,7 +184,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
return (float)(numRows - row) / numRows;
|
||||
}
|
||||
});
|
||||
setAccessibilityTitle(mHeaderTextView.getText());
|
||||
setAccessibilityTitle(mGlifLayout.getHeaderText());
|
||||
|
||||
mCredentialCheckResultTracker = (CredentialCheckResultTracker) getFragmentManager()
|
||||
.findFragmentByTag(FRAGMENT_TAG_CHECK_LOCK_RESULT);
|
||||
@@ -242,13 +249,13 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
@Override
|
||||
public void prepareEnterAnimation() {
|
||||
super.prepareEnterAnimation();
|
||||
mHeaderTextView.setAlpha(0f);
|
||||
mGlifLayout.getHeaderTextView().setAlpha(0f);
|
||||
mCancelButton.setAlpha(0f);
|
||||
if (mForgotButton != null) {
|
||||
mForgotButton.setAlpha(0f);
|
||||
}
|
||||
mLockPatternView.setAlpha(0f);
|
||||
mDetailsTextView.setAlpha(0f);
|
||||
mGlifLayout.getDescriptionTextView().setAlpha(0f);
|
||||
}
|
||||
|
||||
private int getDefaultDetails() {
|
||||
@@ -269,8 +276,9 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
|
||||
private Object[][] getActiveViews() {
|
||||
ArrayList<ArrayList<Object>> result = new ArrayList<>();
|
||||
result.add(new ArrayList<>(Collections.singletonList(mHeaderTextView)));
|
||||
result.add(new ArrayList<>(Collections.singletonList(mDetailsTextView)));
|
||||
result.add(new ArrayList<>(Collections.singletonList(mGlifLayout.getHeaderTextView())));
|
||||
result.add(new ArrayList<>(
|
||||
Collections.singletonList(mGlifLayout.getDescriptionTextView())));
|
||||
if (mCancelButton.getVisibility() == View.VISIBLE) {
|
||||
result.add(new ArrayList<>(Collections.singletonList(mCancelButton)));
|
||||
}
|
||||
@@ -306,14 +314,14 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
switch (stage) {
|
||||
case NeedToUnlock:
|
||||
if (mHeaderText != null) {
|
||||
mHeaderTextView.setText(mHeaderText);
|
||||
mGlifLayout.setHeaderText(mHeaderText);
|
||||
} else {
|
||||
mHeaderTextView.setText(getDefaultHeader());
|
||||
mGlifLayout.setHeaderText(getDefaultHeader());
|
||||
}
|
||||
if (mDetailsText != null) {
|
||||
mDetailsTextView.setText(mDetailsText);
|
||||
mGlifLayout.setDescriptionText(mDetailsText);
|
||||
} else {
|
||||
mDetailsTextView.setText(getDefaultDetails());
|
||||
mGlifLayout.setDescriptionText(getDefaultDetails());
|
||||
}
|
||||
mErrorTextView.setText("");
|
||||
updateErrorMessage(
|
||||
@@ -341,7 +349,7 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
|
||||
|
||||
// Always announce the header for accessibility. This is a no-op
|
||||
// when accessibility is disabled.
|
||||
mHeaderTextView.announceForAccessibility(mHeaderTextView.getText());
|
||||
mGlifLayout.getHeaderTextView().announceForAccessibility(mGlifLayout.getHeaderText());
|
||||
}
|
||||
|
||||
private int getDefaultHeader() {
|
||||
|
Reference in New Issue
Block a user