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

Commit a7e88d68 authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Add end functionality to LayoutTransition"

parents 65e7815d d56c6951
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -793,7 +793,9 @@ public class LayoutTransition {
     * @hide
     */
    public void startChangingAnimations() {
        for (Animator anim : currentChangingAnimations.values()) {
        LinkedHashMap<View, Animator> currentAnimCopy =
                (LinkedHashMap<View, Animator>) currentChangingAnimations.clone();
        for (Animator anim : currentAnimCopy.values()) {
            if (anim instanceof ObjectAnimator) {
                ((ObjectAnimator) anim).setCurrentPlayTime(0);
            }
@@ -801,6 +803,23 @@ public class LayoutTransition {
        }
    }

    /**
     * Ends the animations that are set up for a CHANGING transition. This is a variant of
     * startChangingAnimations() which is called when the window the transition is playing in
     * is not visible. We need to make sure the animations put their targets in their end states
     * and that the transition finishes to remove any mid-process state (such as isRunning()).
     *
     * @hide
     */
    public void endChangingAnimations() {
        LinkedHashMap<View, Animator> currentAnimCopy =
                (LinkedHashMap<View, Animator>) currentChangingAnimations.clone();
        for (Animator anim : currentAnimCopy.values()) {
            anim.start();
            anim.end();
        }
    }

    /**
     * Returns true if animations are running which animate layout-related properties. This
     * essentially means that either CHANGE_APPEARING or CHANGE_DISAPPEARING animations
+13 −7
Original line number Diff line number Diff line
@@ -1575,13 +1575,13 @@ public final class ViewRootImpl extends Handler implements ViewParent,
        boolean cancelDraw = attachInfo.mTreeObserver.dispatchOnPreDraw() ||
                viewVisibility != View.VISIBLE;

        if (!cancelDraw && !newSurface) {
            if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
                for (int i = 0; i < mPendingTransitions.size(); ++i) {
                    mPendingTransitions.get(i).startChangingAnimations();
                }
                mPendingTransitions.clear();
            }
        if (!cancelDraw && !newSurface) {
            mFullRedrawNeeded = false;

            final long drawStartTime;
@@ -1619,7 +1619,13 @@ public final class ViewRootImpl extends Handler implements ViewParent,
                }
            }
        } else {

            // End any pending transitions on this non-visible window
            if (mPendingTransitions != null && mPendingTransitions.size() > 0) {
                for (int i = 0; i < mPendingTransitions.size(); ++i) {
                    mPendingTransitions.get(i).endChangingAnimations();
                }
                mPendingTransitions.clear();
            }
            // We were supposed to report when we are done drawing. Since we canceled the
            // draw, remember it here.
            if ((relayoutResult&WindowManagerImpl.RELAYOUT_FIRST_TIME) != 0) {