diff options
author | Kevin <kevhan@google.com> | 2019-02-21 11:11:35 -0800 |
---|---|---|
committer | Kevin <kevhan@google.com> | 2019-02-21 13:04:58 -0800 |
commit | 61cc109a7209ef18fc93c5b2f1ef406a12e27b8f (patch) | |
tree | b559cadabc8c5e0f82b15ff56a7ee3d79a3c00ab | |
parent | ba7d8e2ac41dac499a5a35a8278eaf97bc224839 (diff) | |
download | android_packages_apps_Trebuchet-61cc109a7209ef18fc93c5b2f1ef406a12e27b8f.tar.gz android_packages_apps_Trebuchet-61cc109a7209ef18fc93c5b2f1ef406a12e27b8f.tar.bz2 android_packages_apps_Trebuchet-61cc109a7209ef18fc93c5b2f1ef406a12e27b8f.zip |
Split AppToOverviewAnimation for Go
Split AppToOverviewAnimationProvider between a Go recents version and
non-Go version as the animation from the app to recents will be
different for Go recents.
Bug: 114136250
Test: Manual test NexusLauncher, l3goWithQuickstep, l3goIconRecents
Change-Id: Iefdafd3838579b780817568b8c707098b79a8cdb
-rw-r--r-- | go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java | 88 | ||||
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java (renamed from quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java) | 0 |
2 files changed, 88 insertions, 0 deletions
diff --git a/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java new file mode 100644 index 000000000..f199643bc --- /dev/null +++ b/go/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.android.quickstep; + +import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN; + +import android.animation.AnimatorSet; +import android.animation.ValueAnimator; +import android.util.Log; + +import com.android.launcher3.BaseDraggingActivity; +import com.android.quickstep.util.RemoteAnimationProvider; +import com.android.systemui.shared.system.RemoteAnimationTargetCompat; + +/** + * Provider for the atomic remote window animation from the app to the overview. + * + * @param <T> activity that contains the overview + */ +final class AppToOverviewAnimationProvider<T extends BaseDraggingActivity> implements + RemoteAnimationProvider { + + private static final long RECENTS_LAUNCH_DURATION = 250; + private static final String TAG = "AppToOverviewAnimationProvider"; + + private final ActivityControlHelper<T> mHelper; + + AppToOverviewAnimationProvider(ActivityControlHelper<T> helper, int targetTaskId) { + mHelper = helper; + } + + /** + * Callback for when the activity is ready/initialized. + * + * @param activity the activity that is ready + * @param wasVisible true if it was visible before + */ + boolean onActivityReady(T activity, Boolean wasVisible) { + ActivityControlHelper.AnimationFactory factory = + mHelper.prepareRecentsUI(activity, wasVisible, + false /* animate activity */, (controller) -> { + controller.dispatchOnStart(); + ValueAnimator anim = controller.getAnimationPlayer() + .setDuration(RECENTS_LAUNCH_DURATION); + anim.setInterpolator(FAST_OUT_SLOW_IN); + anim.start(); + }); + factory.onRemoteAnimationReceived(null); + factory.createActivityController(RECENTS_LAUNCH_DURATION); + return false; + } + + /** + * Create remote window animation from the currently running app to the overview panel. + * + * @param targetCompats the target apps + * @return animation from app to overview + */ + @Override + public AnimatorSet createWindowAnimation(RemoteAnimationTargetCompat[] targetCompats) { + //TODO: Implement the overview to app window animation for Go. + AnimatorSet anim = new AnimatorSet(); + anim.play(ValueAnimator.ofInt(0, 1).setDuration(RECENTS_LAUNCH_DURATION)); + return anim; + } + + /** + * Get duration of animation from app to overview. + * + * @return duration of animation + */ + long getRecentsLaunchDuration() { + return RECENTS_LAUNCH_DURATION; + } +} diff --git a/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java index e5747dc71..e5747dc71 100644 --- a/quickstep/src/com/android/quickstep/AppToOverviewAnimationProvider.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/AppToOverviewAnimationProvider.java |