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

Commit 1cbcbf3f authored by Doris Liu's avatar Doris Liu Committed by Android (Google) Code Review
Browse files

Merge "Make sure the correct AnimatorListeners gets called"

parents c3ae08ab 6f2276bf
Loading
Loading
Loading
Loading
+7 −7
Original line number Original line Diff line number Diff line
@@ -704,7 +704,7 @@ public final class AnimatorSet extends Animator {
    }
    }




    private class AnimatorSetListener implements AnimatorListener {
    private static class AnimatorSetListener implements AnimatorListener {


        private AnimatorSet mAnimatorSet;
        private AnimatorSet mAnimatorSet;


@@ -714,7 +714,7 @@ public final class AnimatorSet extends Animator {


        public void onAnimationCancel(Animator animation) {
        public void onAnimationCancel(Animator animation) {


            if (!mTerminated) {
            if (!mAnimatorSet.mTerminated) {
                // Listeners are already notified of the AnimatorSet canceling in cancel().
                // Listeners are already notified of the AnimatorSet canceling in cancel().
                // The logic below only kicks in when animations end normally
                // The logic below only kicks in when animations end normally
                if (mAnimatorSet.mPlayingSet.size() == 0) {
                if (mAnimatorSet.mPlayingSet.size() == 0) {
@@ -736,7 +736,7 @@ public final class AnimatorSet extends Animator {
            Node animNode = mAnimatorSet.mNodeMap.get(animation);
            Node animNode = mAnimatorSet.mNodeMap.get(animation);
            animNode.mEnded = true;
            animNode.mEnded = true;


            if (!mTerminated) {
            if (!mAnimatorSet.mTerminated) {
                List<Node> children = animNode.mChildNodes;
                List<Node> children = animNode.mChildNodes;
                // Start children animations, if any.
                // Start children animations, if any.
                int childrenSize = children == null ? 0 : children.size();
                int childrenSize = children == null ? 0 : children.size();
@@ -749,9 +749,9 @@ public final class AnimatorSet extends Animator {
                // end(); the logic below only kicks in when animations end normally
                // end(); the logic below only kicks in when animations end normally
                boolean allDone = true;
                boolean allDone = true;
                // Traverse the tree and find if there's any unfinished node
                // Traverse the tree and find if there's any unfinished node
                int size = mNodes.size();
                int size = mAnimatorSet.mNodes.size();
                for (int i = 0; i < size; i++) {
                for (int i = 0; i < size; i++) {
                    if (!mNodes.get(i).mEnded) {
                    if (!mAnimatorSet.mNodes.get(i).mEnded) {
                        allDone = false;
                        allDone = false;
                        break;
                        break;
                    }
                    }
@@ -759,9 +759,9 @@ public final class AnimatorSet extends Animator {
                if (allDone) {
                if (allDone) {
                    // If this was the last child animation to end, then notify listeners that this
                    // If this was the last child animation to end, then notify listeners that this
                    // AnimatorSet has ended
                    // AnimatorSet has ended
                    if (mListeners != null) {
                    if (mAnimatorSet.mListeners != null) {
                        ArrayList<AnimatorListener> tmpListeners =
                        ArrayList<AnimatorListener> tmpListeners =
                                (ArrayList<AnimatorListener>) mListeners.clone();
                                (ArrayList<AnimatorListener>) mAnimatorSet.mListeners.clone();
                        int numListeners = tmpListeners.size();
                        int numListeners = tmpListeners.size();
                        for (int i = 0; i < numListeners; ++i) {
                        for (int i = 0; i < numListeners; ++i) {
                            tmpListeners.get(i).onAnimationEnd(mAnimatorSet);
                            tmpListeners.get(i).onAnimationEnd(mAnimatorSet);