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

Commit 462222fc authored by Winson Chung's avatar Winson Chung Committed by Android Git Automerger
Browse files

am 10bcc7d9: am 18825966: am 70c2f873: Synchronizing bouncer duration with page scaling duration.

* commit '10bcc7d9':
  Synchronizing bouncer duration with page scaling duration.
parents b57693d7 10bcc7d9
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ public interface ChallengeLayout {
     */
    boolean isBouncing();

    /**
     * Returns the duration of the bounce animation.
     */
    int getBouncerAnimationDuration();

    /**
     * Set a listener that will respond to changes in bouncer state.
     *
+1 −0
Original line number Diff line number Diff line
@@ -207,6 +207,7 @@ public class KeyguardHostView extends KeyguardViewBase {
        ChallengeLayout challenge = slider != null ? slider :
            (ChallengeLayout) findViewById(R.id.multi_pane_challenge);
        challenge.setOnBouncerStateChangedListener(mViewStateManager);
        mAppWidgetContainer.setBouncerAnimationDuration(challenge.getBouncerAnimationDuration());
        mViewStateManager.setPagedView(mAppWidgetContainer);
        mViewStateManager.setChallengeLayout(challenge);
        mSecurityViewContainer = (KeyguardSecurityViewFlipper) findViewById(R.id.view_flipper);
+19 −9
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;

import com.android.internal.widget.LockPatternUtils;
@@ -71,7 +72,7 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
    private int mWidgetToResetAfterFadeOut;

    // Bouncer
    protected int BOUNCER_ZOOM_IN_OUT_DURATION = 250;
    private int mBouncerZoomInOutDuration = 250;
    private float BOUNCER_SCALE_FACTOR = 0.67f;

    // Background worker thread: used here for persistence, also made available to widget frames
@@ -747,6 +748,10 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        }
    }

    void setBouncerAnimationDuration(int duration) {
        mBouncerZoomInOutDuration = duration;
    }

    // Zoom in after the bouncer is dismissed
    void zoomInFromBouncer() {
        if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
@@ -755,10 +760,11 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        final View currentPage = getPageAt(getCurrentPage());
        if (currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f) {
            mZoomInOutAnim = new AnimatorSet();
            mZoomInOutAnim.setDuration(BOUNCER_ZOOM_IN_OUT_DURATION);
            mZoomInOutAnim.playTogether(
                    ObjectAnimator.ofFloat(currentPage, "scaleX", 1f),
                    ObjectAnimator.ofFloat(currentPage , "scaleY", 1f));
            mZoomInOutAnim.setDuration(mBouncerZoomInOutDuration);
            mZoomInOutAnim.setInterpolator(new DecelerateInterpolator(1.5f));
            mZoomInOutAnim.start();
        }
    }
@@ -768,18 +774,22 @@ public class KeyguardWidgetPager extends PagedView implements PagedView.PageSwit
        if (mZoomInOutAnim != null && mZoomInOutAnim.isRunning()) {
            mZoomInOutAnim.cancel();
        }
        View currentPage = getPageAt(getCurrentPage());
        int curPage = getCurrentPage();
        View currentPage = getPageAt(curPage);
        if (shouldSetTopAlignedPivotForWidget(curPage)) {
            currentPage.setPivotY(0);
            // Note: we are working around the issue that setting the x-pivot to the same value as it
            //       was does not actually work.
            currentPage.setPivotX(0);
            currentPage.setPivotX(currentPage.getMeasuredWidth() / 2);
        }
        if (!(currentPage.getScaleX() < 1f || currentPage.getScaleY() < 1f)) {
            mZoomInOutAnim = new AnimatorSet();
            mZoomInOutAnim.setDuration(BOUNCER_ZOOM_IN_OUT_DURATION);
            mZoomInOutAnim.playTogether(
                    ObjectAnimator.ofFloat(currentPage, "scaleX", BOUNCER_SCALE_FACTOR),
                    ObjectAnimator.ofFloat(currentPage, "scaleY", BOUNCER_SCALE_FACTOR));
            mZoomInOutAnim.setDuration(mBouncerZoomInOutDuration);
            mZoomInOutAnim.setInterpolator(new DecelerateInterpolator(1.5f));
            mZoomInOutAnim.start();
        }
    }
+6 −1
Original line number Diff line number Diff line
@@ -40,7 +40,7 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo

    public static final int HORIZONTAL = LinearLayout.HORIZONTAL;
    public static final int VERTICAL = LinearLayout.VERTICAL;
    protected static final int ANIMATE_BOUNCE_DURATION = 750;
    public static final int ANIMATE_BOUNCE_DURATION = 350;

    private KeyguardSecurityContainer mChallengeView;
    private View mUserSwitcherView;
@@ -96,6 +96,11 @@ public class MultiPaneChallengeLayout extends ViewGroup implements ChallengeLayo
    public void showChallenge(boolean b) {
    }

    @Override
    public int getBouncerAnimationDuration() {
        return ANIMATE_BOUNCE_DURATION;
    }

    @Override
    public void showBouncer() {
        if (mIsBouncing) return;
+25 −3
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
    private static final int DRAG_HANDLE_OPEN_ABOVE = 8; // dp
    private static final int DRAG_HANDLE_OPEN_BELOW = 0; // dp

    private static final int HANDLE_ANIMATE_DURATION = 200; // ms
    private static final int HANDLE_ANIMATE_DURATION = 250; // ms

    // Drawn to show the drag handle in closed state; crossfades to the challenge view
    // when challenge is fully visible
@@ -468,6 +468,11 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
        return mIsBouncing;
    }

    @Override
    public int getBouncerAnimationDuration() {
        return HANDLE_ANIMATE_DURATION;
    }

    @Override
    public void showBouncer() {
        if (mIsBouncing) return;
@@ -475,8 +480,16 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
        mIsBouncing = true;
        showChallenge(true);
        if (mScrimView != null) {
            Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 1f);
            anim.setDuration(HANDLE_ANIMATE_DURATION);
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    mScrimView.setVisibility(VISIBLE);
                }
            });
            anim.start();
        }
        if (mChallengeView != null) {
            mChallengeView.showBouncer(HANDLE_ANIMATE_DURATION);
        }
@@ -498,9 +511,18 @@ public class SlidingChallengeLayout extends ViewGroup implements ChallengeLayout
        if (!mIsBouncing) return;
        if (!mWasChallengeShowing) showChallenge(false);
        mIsBouncing = false;

        if (mScrimView != null) {
            Animator anim = ObjectAnimator.ofFloat(mScrimView, "alpha", 0f);
            anim.setDuration(HANDLE_ANIMATE_DURATION);
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    mScrimView.setVisibility(GONE);
                }
            });
            anim.start();
        }
        if (mChallengeView != null) {
            mChallengeView.hideBouncer(HANDLE_ANIMATE_DURATION);
        }