From 1335c36c15bbd92ee43b0f4a228b604422711b05 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 25 Apr 2019 12:53:20 -0700 Subject: [PATCH] Don't layout empty tasks in layout anim if we have the actual content. When we load the task content (icons, snapshots, etc), oftentimes, we are still in the middle of the layout animation where items are fading in from bottom to top. At this point, we start a second content-fill animation from bottom to top that fades from empty => filled after the first animation. However, we can improve this so that empty views aren't shown for a split second for some of the later laid out views. If the first animation has not finished and we would animate a content change from empty => filled but the view is currently still not visible, we should just complete the content transition on the spot so that the layout animation lays out the filled version instead. Bug: 131339235 Test: Go to recents, observe lay out animation does not continue to lay out the empty view first Change-Id: I936a81e6cf8b3552cdee90c183fc841f50ec9ea8 --- .../src/com/android/quickstep/ContentFillItemAnimator.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java index 1b6f2e34d9..9282345532 100644 --- a/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java +++ b/go/quickstep/src/com/android/quickstep/ContentFillItemAnimator.java @@ -161,6 +161,13 @@ public final class ContentFillItemAnimator extends SimpleItemAnimator { private void animateChangeImpl(ViewHolder viewHolder, long startDelay) { TaskItemView itemView = (TaskItemView) viewHolder.itemView; + if (itemView.getAlpha() == 0) { + // View is still not visible, so we can finish the change immediately. + CONTENT_TRANSITION_PROGRESS.set(itemView, 1.0f); + dispatchChangeFinished(viewHolder, true /* oldItem */); + dispatchFinishedWhenDone(); + return; + } final ObjectAnimator anim = ObjectAnimator.ofFloat(itemView, CONTENT_TRANSITION_PROGRESS, 0.0f, 1.0f); anim.setDuration(ITEM_CHANGE_DURATION).setStartDelay(startDelay);