Polish app => recents animation (1/N)

As part of building out a better remote app to overview animation, we
first separate out the logic so that we only do the default layout
animation when coming from a Launcher state (i.e. from home or all
apps) and only then, so coming from an app no longer leads to the tasks
animating.

We do this with a simple flag that indicates that recents will be
using a remote animation.

Bug: 132112131
Test: Go to app, go to recents. No layout animation.
Test: Go to home, go to recents. Layout animation works as normal
Change-Id: I30988d944571fd5317d0c9d13e2a99b167c1291b
This commit is contained in:
Kevin 2019-05-07 16:56:12 -07:00
parent 33a2946b7f
commit f95e84a385
3 changed files with 18 additions and 1 deletions

View File

@ -45,6 +45,7 @@ public final class FallbackActivityControllerHelper extends
@Override
public AnimationFactory prepareRecentsUI(RecentsActivity activity, boolean activityVisible,
boolean animateActivity, Consumer<AnimatorPlaybackController> callback) {
// TODO: Logic for setting remote animation
if (activityVisible) {
return (transitionLength) -> { };
}

View File

@ -40,6 +40,7 @@ public final class LauncherActivityControllerHelper extends GoActivityControlHel
boolean activityVisible, boolean animateActivity,
Consumer<AnimatorPlaybackController> callback) {
LauncherState fromState = activity.getStateManager().getState();
activity.<IconRecentsView>getOverviewPanel().setUsingRemoteAnimation(true);
//TODO: Implement this based off where the recents view needs to be for app => recents anim.
return new AnimationFactory() {
@Override
@ -87,6 +88,7 @@ public final class LauncherActivityControllerHelper extends GoActivityControlHel
if (launcher == null) {
return false;
}
launcher.<IconRecentsView>getOverviewPanel().setUsingRemoteAnimation(false);
launcher.getUserEventDispatcher().logActionCommand(
LauncherLogProto.Action.Command.RECENTS_BUTTON,
getContainerType(),

View File

@ -125,6 +125,7 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
private View mEmptyView;
private View mContentView;
private boolean mTransitionedFromApp;
private boolean mUsingRemoteAnimation;
private AnimatorSet mLayoutAnimation;
private final ArraySet<View> mLayingOutViews = new ArraySet<>();
private Rect mInsets;
@ -276,7 +277,9 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
// not be scrollable.
mTaskLayoutManager.scrollToPositionWithOffset(TASKS_START_POSITION, 0 /* offset */);
}
scheduleFadeInLayoutAnimation();
if (!mUsingRemoteAnimation) {
scheduleFadeInLayoutAnimation();
}
// Load any task changes
if (!mTaskLoader.needsToLoad()) {
return;
@ -314,6 +317,17 @@ public final class IconRecentsView extends FrameLayout implements Insettable {
mTransitionedFromApp = transitionedFromApp;
}
/**
* Set whether we're using a custom remote animation. If so, we will not do the default layout
* animation when entering recents and instead wait for the remote app surface to be ready to
* use.
*
* @param usingRemoteAnimation true if doing a remote animation, false o/w
*/
public void setUsingRemoteAnimation(boolean usingRemoteAnimation) {
mUsingRemoteAnimation = usingRemoteAnimation;
}
/**
* Handles input from the overview button. Launch the most recent task unless we just came from
* the app. In that case, we launch the next most recent.