Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 374f81c4 authored by guangl's avatar guangl
Browse files

Settings: Pattern display incompletely under split screen

LockPatternView's size is fixed.
Zoom out LockPatternView's size under MultiWindowMode.

Change-Id: If0b9f85d8c9654aa43807d18a6cd224c0ba12fa0
CRs-Fixed: 1062159
parent 453baf4b
Loading
Loading
Loading
Loading
+25 −0
Original line number Diff line number Diff line
@@ -100,6 +100,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {

        private AppearAnimationUtils mAppearAnimationUtils;
        private DisappearAnimationUtils mDisappearAnimationUtils;
        private boolean mIsScale = false;
        private final float mScale = 0.65f;

        // required constructor for fragments
        public ConfirmLockPatternFragment() {
@@ -122,6 +124,8 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
            mLeftSpacerLandscape = view.findViewById(R.id.leftSpacer);
            mRightSpacerLandscape = view.findViewById(R.id.rightSpacer);

            resizePattern();

            // make it so unhandled touch events within the unlock screen go to the
            // lock pattern view.
            final LinearLayoutWithDefaultTouchRecepient topLayout
@@ -215,6 +219,27 @@ public class ConfirmLockPattern extends ConfirmDeviceCredentialBaseActivity {
            mCredentialCheckResultTracker.setListener(this);
        }

        private void resizePattern() {
            if ((getActivity() != null) && getActivity().isInMultiWindowMode()) {
                mIsScale = true;
                ViewGroup.LayoutParams lp = mLockPatternView.getLayoutParams();
                lp.width *=  mScale;
                lp.height *= mScale;
                mLockPatternView.setLayoutParams(lp);
            }
        }

        @Override
        public void onMultiWindowModeChanged(boolean isInMultiWindowMode) {
            super.onMultiWindowModeChanged(isInMultiWindowMode);
            if (!isInMultiWindowMode && mIsScale) {
                ViewGroup.LayoutParams lp = mLockPatternView.getLayoutParams();
                lp.width /=  mScale;
                lp.height /= mScale;
                mLockPatternView.setLayoutParams(lp);
            }
        }

        @Override
        protected void onShowError() {
        }