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

Commit d6a70b8b authored by Rajeev Kumar's avatar Rajeev Kumar Committed by Android (Google) Code Review
Browse files

Merge "Fix positioning bug in user switcher" into sc-dev

parents fe8d6de4 5b236efc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -76,7 +76,7 @@ public class KeyguardStatusViewController extends ViewController<KeyguardStatusV
        mDozeParameters = dozeParameters;
        mKeyguardStateController = keyguardStateController;
        mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView, keyguardStateController,
                dozeParameters, unlockedScreenOffAnimationController);
                dozeParameters, unlockedScreenOffAnimationController, /* animateYPos= */ true);
        mKeyguardUnlockAnimationController = keyguardUnlockAnimationController;
        mSmartspaceTransitionController = smartspaceTransitionController;

+22 −16
Original line number Diff line number Diff line
@@ -19,6 +19,7 @@ package com.android.keyguard;
import static com.android.systemui.statusbar.StatusBarState.KEYGUARD;

import android.view.View;
import android.view.ViewPropertyAnimator;

import com.android.systemui.animation.Interpolators;
import com.android.systemui.statusbar.StatusBarState;
@@ -40,6 +41,7 @@ public class KeyguardVisibilityHelper {
    private final KeyguardStateController mKeyguardStateController;
    private final DozeParameters mDozeParameters;
    private final UnlockedScreenOffAnimationController mUnlockedScreenOffAnimationController;
    private boolean mAnimateYPos;
    private boolean mKeyguardViewVisibilityAnimating;
    private boolean mLastOccludedState = false;
    private final AnimationProperties mAnimationProperties = new AnimationProperties();
@@ -47,11 +49,13 @@ public class KeyguardVisibilityHelper {
    public KeyguardVisibilityHelper(View view,
            KeyguardStateController keyguardStateController,
            DozeParameters dozeParameters,
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController) {
            UnlockedScreenOffAnimationController unlockedScreenOffAnimationController,
            boolean animateYPos) {
        mView = view;
        mKeyguardStateController = keyguardStateController;
        mDozeParameters = dozeParameters;
        mUnlockedScreenOffAnimationController = unlockedScreenOffAnimationController;
        mAnimateYPos = animateYPos;
    }

    public boolean isVisibilityAnimating() {
@@ -98,23 +102,25 @@ public class KeyguardVisibilityHelper {
        } else if (statusBarState == KEYGUARD) {
            if (keyguardFadingAway) {
                mKeyguardViewVisibilityAnimating = true;
                ViewPropertyAnimator animator = mView.animate()
                        .alpha(0)
                        .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN)
                        .withEndAction(mAnimateKeyguardStatusViewInvisibleEndRunnable);
                if (mAnimateYPos) {
                    float target = mView.getY() - mView.getHeight() * 0.05f;
                    int delay = 0;
                    int duration = 125;
                // We animate the Y properly separately using the PropertyAnimator, as the panel
                // view als needs to update the end position.
                    // We animate the Y property separately using the PropertyAnimator, as the panel
                    // view also needs to update the end position.
                    mAnimationProperties.setDuration(duration).setDelay(delay);
                    PropertyAnimator.cancelAnimation(mView, AnimatableProperty.Y);
                    PropertyAnimator.setProperty(mView, AnimatableProperty.Y, target,
                            mAnimationProperties,
                            true /* animate */);
                mView.animate()
                        .alpha(0)
                        .setInterpolator(Interpolators.FAST_OUT_LINEAR_IN)
                        .setDuration(duration)
                        .setStartDelay(delay)
                        .withEndAction(mAnimateKeyguardStatusViewInvisibleEndRunnable)
                        .start();
                    animator.setDuration(duration)
                            .setStartDelay(delay);
                }
                animator.start();
            } else if (mLastOccludedState && !isOccluded) {
                // An activity was displayed over the lock screen, and has now gone away
                mView.setVisibility(View.VISIBLE);
+2 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ public class KeyguardQsUserSwitchController extends ViewController<UserAvatarVie
        mConfigurationController = configurationController;
        mStatusBarStateController = statusBarStateController;
        mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView,
                keyguardStateController, dozeParameters, unlockedScreenOffAnimationController);
                keyguardStateController, dozeParameters,
                unlockedScreenOffAnimationController,  /* animateYPos= */ false);
        mUserDetailAdapter = new KeyguardUserDetailAdapter(context, userDetailViewAdapterProvider);
    }

+2 −1
Original line number Diff line number Diff line
@@ -173,7 +173,8 @@ public class KeyguardUserSwitcherController extends ViewController<KeyguardUserS
        mAdapter = new KeyguardUserAdapter(mContext, resources, layoutInflater,
                mUserSwitcherController, this);
        mKeyguardVisibilityHelper = new KeyguardVisibilityHelper(mView,
                keyguardStateController, dozeParameters, unlockedScreenOffAnimationController);
                keyguardStateController, dozeParameters,
                unlockedScreenOffAnimationController, /* animateYPos= */ false);
        mBackground = new KeyguardUserSwitcherScrim(context);
    }