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

Commit f685c7e5 authored by Tony Wickham's avatar Tony Wickham Committed by Android (Google) Code Review
Browse files

Merge "Actually call LauncherTransitionable.onLauncherTransitionStep()." into...

Merge "Actually call LauncherTransitionable.onLauncherTransitionStep()." into ub-launcher3-burnaby-polish
parents fa3c369c 0bb211a9
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -3792,6 +3792,7 @@ public class Launcher extends Activity
     *
     * Implementation of the method from LauncherModel.Callbacks.
     */
    @Override
    public void bindItems(final ArrayList<ItemInfo> shortcuts, final int start, final int end,
                          final boolean forceAnimateIcons) {
        Runnable r = new Runnable() {
+18 −18
Original line number Diff line number Diff line
@@ -24,7 +24,6 @@ import android.animation.ValueAnimator;
import android.annotation.TargetApi;
import android.os.Build;
import android.view.View;
import android.view.ViewAnimationUtils;
import android.view.ViewTreeObserver;

import com.android.launcher3.util.UiThreadCircularReveal;
@@ -60,6 +59,7 @@ public class LauncherAnimUtils {
    public static void startAnimationAfterNextDraw(final Animator animator, final View view) {
        view.getViewTreeObserver().addOnDrawListener(new ViewTreeObserver.OnDrawListener() {
            private boolean mStarted = false;

            public void onDraw() {
                if (mStarted) return;
                mStarted = true;
+27 −1
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.content.res.Resources;
import android.util.Log;
@@ -229,6 +230,8 @@ public class LauncherStateTransitionAnimation {
        startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
                animated ? revealDuration : 0, overlaySearchBarView);

        Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView);

        if (animated && initialized) {
            // Setup the reveal view animation
            int width = revealView.getMeasuredWidth();
@@ -342,11 +345,12 @@ public class LauncherStateTransitionAnimation {
                animation.play(workspaceAnim);
            }

            animation.play(updateTransitionStepAnim);

            // Dispatch the prepare transition signal
            dispatchOnLauncherTransitionPrepare(fromView, animated, false);
            dispatchOnLauncherTransitionPrepare(toView, animated, false);


            final AnimatorSet stateAnimation = animation;
            final Runnable startAnimRunnable = new Runnable() {
                public void run() {
@@ -401,6 +405,24 @@ public class LauncherStateTransitionAnimation {
        }
    }

    /**
     * Returns an Animator that calls {@link #dispatchOnLauncherTransitionStep(View, float)} on
     * {@param fromView} and {@param toView} as the animation interpolates.
     *
     * This is a bit hacky: we create a dummy ValueAnimator just for the AnimatorUpdateListener.
     */
    private Animator dispatchOnLauncherTransitionStepAnim(final View fromView, final View toView) {
        ValueAnimator updateAnimator = ValueAnimator.ofFloat(0, 1);
        updateAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override
            public void onAnimationUpdate(ValueAnimator animation) {
                dispatchOnLauncherTransitionStep(fromView, animation.getAnimatedFraction());
                dispatchOnLauncherTransitionStep(toView, animation.getAnimatedFraction());
            }
        });
        return updateAnimator;
    }

    /**
     * Starts and animation to the workspace from the apps view.
     */
@@ -509,12 +531,16 @@ public class LauncherStateTransitionAnimation {
        startWorkspaceSearchBarAnimation(animation, fromWorkspaceState, toWorkspaceState,
                animated ? revealDuration : 0, overlaySearchBarView);

        Animator updateTransitionStepAnim = dispatchOnLauncherTransitionStepAnim(fromView, toView);

        if (animated && initialized) {
            // Play the workspace animation
            if (workspaceAnim != null) {
                animation.play(workspaceAnim);
            }

            animation.play(updateTransitionStepAnim);

            // hideAppsCustomizeHelper is called in some cases when it is already hidden
            // don't perform all these no-op animations. In particularly, this was causing
            // the all-apps button to pop in and out.