diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
commit | 0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch) | |
tree | 2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java | |
parent | 744d192669a148bde24d36bef02deb05c2f7a1fa (diff) | |
parent | 02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff) | |
download | android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2 android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip |
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31
* tag 'android-10.0.0_r31': (218 commits)
Increase drag distance threshold when drag starts from deep press
Fix shortcut componentname in workspace layout logging
Fix shortcut componentname in workspace layout logging
perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity
Persist predicted items when dragged to workspace
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Align badging logic with platform IconDrawableFactory.
Fix bug where icon remains invisible after returning home.
Fix quick switch from home biased towards returning home
Fix recents scale sometimes lagging behind window scale
Fix folder open/close animation when grid size is small.
fix custom shortcut test
Improve quick switch from home by tracking both x and y motion
Move shelf peeking anim code to ShelfPeekAnim class
Fix folder available height calculation
Tapl: AllApps: ensuring a minimal vertical size of an icon
Enable a11y scrolling with item drag
disable custom shortcut test in oop
include predicted_rank in app launch logging
...
Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java')
-rw-r--r-- | quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 1aa5365fd..958ef7d4f 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -18,6 +18,7 @@ package com.android.quickstep.util; import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y; import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; +import static com.android.launcher3.LauncherStateManager.ANIM_ALL; import static com.android.launcher3.anim.Interpolators.LINEAR; import android.animation.Animator; @@ -27,13 +28,11 @@ import android.animation.ObjectAnimator; import android.view.View; import android.view.ViewGroup; -import androidx.annotation.Nullable; - -import com.android.launcher3.BubbleTextView; import com.android.launcher3.CellLayout; import com.android.launcher3.DeviceProfile; import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; +import com.android.launcher3.LauncherStateManager; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.R; import com.android.launcher3.ShortcutAndWidgetContainer; @@ -41,9 +40,8 @@ import com.android.launcher3.Workspace; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.SpringObjectAnimator; -import com.android.launcher3.folder.FolderIcon; import com.android.launcher3.graphics.OverviewScrim; -import com.android.launcher3.views.IconLabelDotView; +import com.android.quickstep.views.RecentsView; import java.util.ArrayList; import java.util.List; @@ -66,18 +64,12 @@ public class StaggeredWorkspaceAnim { private final float mVelocity; private final float mSpringTransY; - // The original view of the {@link FloatingIconView}. - private final View mOriginalView; - private final List<Animator> mAnimators = new ArrayList<>(); - /** - * @param floatingViewOriginalView The FloatingIconView's original view. - */ - public StaggeredWorkspaceAnim(Launcher launcher, @Nullable View floatingViewOriginalView, - float velocity) { + public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) { + prepareToAnimate(launcher); + mVelocity = velocity; - mOriginalView = floatingViewOriginalView; // Scale the translationY based on the initial velocity to better sync the workspace items // with the floating view. @@ -133,8 +125,10 @@ public class StaggeredWorkspaceAnim { addStaggeredAnimationForView(qsb, grid.inv.numRows + 2, totalRows); } - addScrimAnimationForState(launcher, BACKGROUND_APP, 0); - addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); + if (animateOverviewScrim) { + addScrimAnimationForState(launcher, BACKGROUND_APP, 0); + addScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); + } AnimatorListener resetClipListener = new AnimatorListenerAdapter() { int numAnimations = mAnimators.size(); @@ -161,6 +155,21 @@ public class StaggeredWorkspaceAnim { } /** + * Setup workspace with 0 duration to prepare for our staggered animation. + */ + private void prepareToAnimate(Launcher launcher) { + LauncherStateManager stateManager = launcher.getStateManager(); + AnimatorSetBuilder builder = new AnimatorSetBuilder(); + // setRecentsAttachedToAppWindow() will animate recents out. + builder.addFlag(AnimatorSetBuilder.FLAG_DONT_ANIMATE_OVERVIEW); + stateManager.createAtomicAnimation(BACKGROUND_APP, NORMAL, builder, ANIM_ALL, 0); + builder.build().start(); + + // Stop scrolling so that it doesn't interfere with the translation offscreen. + launcher.<RecentsView>getOverviewPanel().getScroller().forceFinished(true); + } + + /** * Starts the animation. */ public void start() { @@ -192,35 +201,12 @@ public class StaggeredWorkspaceAnim { springTransY.setStartDelay(startDelay); mAnimators.add(springTransY); - ObjectAnimator alpha = getAlphaAnimator(v, startDelay); - if (v == mOriginalView) { - // For IconLabelDotViews, we just want the label to fade in. - // Icon, badge, and dots will animate in separately (controlled via FloatingIconView) - if (v instanceof IconLabelDotView) { - alpha.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationStart(Animator animation) { - IconLabelDotView view = (IconLabelDotView) v; - view.setIconVisible(false); - view.setForceHideDot(true); - } - }); - } else { - return; - } - } - v.setAlpha(0); - mAnimators.add(alpha); - } - - private ObjectAnimator getAlphaAnimator(View v, long startDelay) { ObjectAnimator alpha = ObjectAnimator.ofFloat(v, View.ALPHA, 0f, 1f); alpha.setInterpolator(LINEAR); alpha.setDuration(ALPHA_DURATION_MS); alpha.setStartDelay(startDelay); - return alpha; - + mAnimators.add(alpha); } private void addScrimAnimationForState(Launcher launcher, LauncherState state, long duration) { |