diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2018-05-04 22:53:05 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2018-05-04 22:53:05 +0000 |
commit | 1094dbe79d91c5847c538516141ea87dfc1b97e7 (patch) | |
tree | 7acde7dc9240691fbf5d141a9bfa66b081ac55d9 | |
parent | 04b60811f9ff554fa3b62ab4a6c66fbc5f07a26f (diff) | |
parent | 610a36271f0b4376de15e461002c393365d70d8b (diff) | |
download | android_packages_apps_Trebuchet-1094dbe79d91c5847c538516141ea87dfc1b97e7.tar.gz android_packages_apps_Trebuchet-1094dbe79d91c5847c538516141ea87dfc1b97e7.tar.bz2 android_packages_apps_Trebuchet-1094dbe79d91c5847c538516141ea87dfc1b97e7.zip |
Merge changes from topic "am-592c3e7d-f088-4cba-97db-ec5807b14b5c" into ub-launcher3-master
* changes:
[automerger] Tweaks to opening app window animation. am: ce1402132a
Tweaks to opening app window animation.
-rw-r--r-- | quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java index 34635bf38..4963f5d1a 100644 --- a/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java +++ b/quickstep/src/com/android/launcher3/LauncherAppTransitionManagerImpl.java @@ -94,7 +94,12 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag private static final int APP_LAUNCH_DURATION = 500; // Use a shorter duration for x or y translation to create a curve effect - private static final int APP_LAUNCH_CURVED_DURATION = 233; + private static final int APP_LAUNCH_CURVED_DURATION = APP_LAUNCH_DURATION / 2; + // We scale the durations for the downward app launch animations (minus the scale animation). + private static final float APP_LAUNCH_DOWN_DUR_SCALE_FACTOR = 0.8f; + private static final int APP_LAUNCH_ALPHA_START_DELAY = 32; + private static final int APP_LAUNCH_ALPHA_DURATION = 50; + public static final int RECENTS_LAUNCH_DURATION = 336; private static final int LAUNCHER_RESUME_START_DELAY = 100; private static final int CLOSING_TRANSITION_DURATION_MS = 350; @@ -420,10 +425,17 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag ObjectAnimator x = ObjectAnimator.ofFloat(mFloatingView, View.TRANSLATION_X, 0f, dX); ObjectAnimator y = ObjectAnimator.ofFloat(mFloatingView, View.TRANSLATION_Y, 0f, dY); - // Adjust the duration to change the "curve" of the app icon to the center. - boolean isBelowCenterY = lp.topMargin < centerY; - x.setDuration(isBelowCenterY ? APP_LAUNCH_DURATION : APP_LAUNCH_CURVED_DURATION); - y.setDuration(isBelowCenterY ? APP_LAUNCH_CURVED_DURATION : APP_LAUNCH_DURATION); + // Use upward animation for apps that are either on the bottom half of the screen, or are + // relatively close to the center. + boolean useUpwardAnimation = lp.topMargin > centerY + || Math.abs(dY) < mLauncher.getDeviceProfile().cellHeightPx; + if (useUpwardAnimation) { + x.setDuration(APP_LAUNCH_CURVED_DURATION); + y.setDuration(APP_LAUNCH_DURATION); + } else { + x.setDuration((long) (APP_LAUNCH_DOWN_DUR_SCALE_FACTOR * APP_LAUNCH_DURATION)); + y.setDuration((long) (APP_LAUNCH_DOWN_DUR_SCALE_FACTOR * APP_LAUNCH_CURVED_DURATION)); + } x.setInterpolator(AGGRESSIVE_EASE); y.setInterpolator(AGGRESSIVE_EASE); appIconAnimatorSet.play(x); @@ -436,13 +448,20 @@ public class LauncherAppTransitionManagerImpl extends LauncherAppTransitionManag float scale = Math.max(maxScaleX, maxScaleY); ObjectAnimator scaleAnim = ObjectAnimator .ofFloat(mFloatingView, SCALE_PROPERTY, startScale, scale); - scaleAnim.setDuration(APP_LAUNCH_DURATION).setInterpolator(Interpolators.EXAGGERATED_EASE); + scaleAnim.setDuration(APP_LAUNCH_DURATION) + .setInterpolator(Interpolators.EXAGGERATED_EASE); appIconAnimatorSet.play(scaleAnim); // Fade out the app icon. ObjectAnimator alpha = ObjectAnimator.ofFloat(mFloatingView, View.ALPHA, 1f, 0f); - alpha.setStartDelay(32); - alpha.setDuration(50); + if (useUpwardAnimation) { + alpha.setStartDelay(APP_LAUNCH_ALPHA_START_DELAY); + alpha.setDuration(APP_LAUNCH_ALPHA_DURATION); + } else { + alpha.setStartDelay((long) (APP_LAUNCH_DOWN_DUR_SCALE_FACTOR + * APP_LAUNCH_ALPHA_START_DELAY)); + alpha.setDuration((long) (APP_LAUNCH_DOWN_DUR_SCALE_FACTOR * APP_LAUNCH_ALPHA_DURATION)); + } alpha.setInterpolator(LINEAR); appIconAnimatorSet.play(alpha); |