summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2019-05-30 17:35:44 -0700
committerJon Miranda <jonmiranda@google.com>2019-05-30 18:43:22 -0700
commitb3c9077c7676015253ee9334ac08f7c3d87f41b4 (patch)
treef86628b71e0fbb23020cde7679728972d4fc4d50
parentf4fa4be5d6df51d29860c4569fb6eb60df367b79 (diff)
downloadandroid_packages_apps_Trebuchet-b3c9077c7676015253ee9334ac08f7c3d87f41b4.tar.gz
android_packages_apps_Trebuchet-b3c9077c7676015253ee9334ac08f7c3d87f41b4.tar.bz2
android_packages_apps_Trebuchet-b3c9077c7676015253ee9334ac08f7c3d87f41b4.zip
Tuning app open/close animation.
* Mostly value changes. * Added a way to round the corners during swipe up to home animation. Bug: 123900446 Change-Id: Id61d241d919ba51ced0633585e36b7d93efe30b0
-rw-r--r--quickstep/recents_ui_overrides/res/values/dimens.xml2
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java14
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java20
-rw-r--r--quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java13
-rw-r--r--quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java7
-rw-r--r--src/com/android/launcher3/anim/FlingSpringAnim.java2
-rw-r--r--src/com/android/launcher3/views/FloatingIconView.java6
7 files changed, 44 insertions, 20 deletions
diff --git a/quickstep/recents_ui_overrides/res/values/dimens.xml b/quickstep/recents_ui_overrides/res/values/dimens.xml
index c80e531e6..863a8ba52 100644
--- a/quickstep/recents_ui_overrides/res/values/dimens.xml
+++ b/quickstep/recents_ui_overrides/res/values/dimens.xml
@@ -27,5 +27,5 @@
<!-- Swipe up to home related -->
<dimen name="swipe_up_fling_min_visible_change">18dp</dimen>
<dimen name="swipe_up_y_overshoot">10dp</dimen>
- <dimen name="swipe_up_max_workspace_trans_y">-80dp</dimen>
+ <dimen name="swipe_up_max_workspace_trans_y">-60dp</dimen>
</resources> \ No newline at end of file
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
index 0d0478ae0..9f446c8ab 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/WindowTransformSwipeHandler.java
@@ -19,6 +19,7 @@ import static com.android.launcher3.BaseActivity.INVISIBLE_BY_STATE_HANDLER;
import static com.android.launcher3.BaseActivity.STATE_HANDLER_INVISIBILITY_FLAGS;
import static com.android.launcher3.Utilities.SINGLE_FRAME_MS;
import static com.android.launcher3.Utilities.postAsyncCallback;
+import static com.android.launcher3.anim.Interpolators.ACCEL_1_5;
import static com.android.launcher3.anim.Interpolators.DEACCEL;
import static com.android.launcher3.anim.Interpolators.FAST_OUT_SLOW_IN;
import static com.android.launcher3.anim.Interpolators.LINEAR;
@@ -1131,16 +1132,25 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity>
AnimatorPlaybackController homeAnim = homeAnimationFactory.createActivityAnimationToHome();
+ // End on a "round-enough" radius so that the shape reveal doesn't have to do too much
+ // rounding at the end of the animation.
+ float startRadius = mClipAnimationHelper.getCurrentCornerRadius();
+ float endRadius = startRect.width() / 6f;
// We want the window alpha to be 0 once this threshold is met, so that the
// FolderIconView can be seen morphing into the icon shape.
final float windowAlphaThreshold = isFloatingIconView ? 1f - SHAPE_PROGRESS_DURATION : 1f;
anim.addOnUpdateListener((currentRect, progress) -> {
homeAnim.setPlayFraction(progress);
- float windowAlpha = Math.max(0, Utilities.mapToRange(progress, 0,
- windowAlphaThreshold, 1f, 0f, Interpolators.LINEAR));
+ float alphaProgress = ACCEL_1_5.getInterpolation(progress);
+ float windowAlpha = Utilities.boundToRange(Utilities.mapToRange(alphaProgress, 0,
+ windowAlphaThreshold, 1.5f, 0f, Interpolators.LINEAR), 0, 1);
mTransformParams.setProgress(progress)
.setCurrentRectAndTargetAlpha(currentRect, windowAlpha);
+ if (isFloatingIconView) {
+ mTransformParams.setCornerRadius(endRadius * progress + startRadius
+ * (1f - progress));
+ }
mClipAnimationHelper.applyTransform(targetSet, mTransformParams,
false /* launcherOnTop */);
diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
index e2fb602d9..aca23e4e4 100644
--- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
+++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/ClipAnimationHelper.java
@@ -197,10 +197,15 @@ public class ClipAnimationHelper {
mTmpMatrix.postTranslate(app.position.x, app.position.y);
mClipRectF.roundOut(crop);
if (mSupportsRoundedCornersOnWindows) {
- float windowCornerRadius = mUseRoundedCornersOnWindows
- ? mWindowCornerRadius : 0;
- cornerRadius = Utilities.mapRange(progress, windowCornerRadius,
- mTaskCornerRadius);
+ if (params.cornerRadius > -1) {
+ cornerRadius = params.cornerRadius;
+ scale = params.currentRect.width() / crop.width();
+ } else {
+ float windowCornerRadius = mUseRoundedCornersOnWindows
+ ? mWindowCornerRadius : 0;
+ cornerRadius = Utilities.mapRange(progress, windowCornerRadius,
+ mTaskCornerRadius);
+ }
mCurrentCornerRadius = cornerRadius;
}
}
@@ -355,6 +360,7 @@ public class ClipAnimationHelper {
@Nullable RectF currentRect;
float targetAlpha;
boolean forLiveTile;
+ float cornerRadius;
SyncRtSurfaceTransactionApplierCompat syncTransactionApplier;
@@ -365,6 +371,7 @@ public class ClipAnimationHelper {
currentRect = null;
targetAlpha = 0;
forLiveTile = false;
+ cornerRadius = -1;
}
public TransformParams setProgress(float progress) {
@@ -373,6 +380,11 @@ public class ClipAnimationHelper {
return this;
}
+ public TransformParams setCornerRadius(float cornerRadius) {
+ this.cornerRadius = cornerRadius;
+ return this;
+ }
+
public TransformParams setCurrentRectAndTargetAlpha(RectF currentRect, float targetAlpha) {
this.currentRect = currentRect;
this.targetAlpha = targetAlpha;
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 93b6e4ba5..837c2dc93 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
@@ -44,14 +44,13 @@ import static com.android.launcher3.anim.Interpolators.LINEAR;
*/
public class StaggeredWorkspaceAnim {
- private static final int APP_CLOSE_ROW_START_DELAY_MS = 16;
- private static final int ALPHA_DURATION_MS = 200;
+ private static final int APP_CLOSE_ROW_START_DELAY_MS = 10;
+ private static final int ALPHA_DURATION_MS = 250;
private static final float MAX_VELOCITY_PX_PER_S = 22f;
- private static final float DAMPING_RATIO =
- (SpringForce.DAMPING_RATIO_MEDIUM_BOUNCY + SpringForce.DAMPING_RATIO_LOW_BOUNCY) / 2f;
- private static final float STIFFNESS = SpringForce.STIFFNESS_LOW;
+ private static final float DAMPING_RATIO = 0.7f;
+ private static final float STIFFNESS = 150f;
private final float mVelocity;
private final float mSpringTransY;
@@ -71,9 +70,9 @@ public class StaggeredWorkspaceAnim {
// Scale the translationY based on the initial velocity to better sync the workspace items
// with the floating view.
- float transFactor = 0.1f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
+ float transFactor = 0.2f + 0.9f * Math.abs(velocity) / MAX_VELOCITY_PX_PER_S;
mSpringTransY = transFactor * launcher.getResources()
- .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);;
+ .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y);
DeviceProfile grid = launcher.getDeviceProfile();
ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace()
diff --git a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
index 79540c164..dcf2e3c15 100644
--- a/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
+++ b/quickstep/src/com/android/launcher3/QuickstepAppTransitionManagerImpl.java
@@ -119,6 +119,9 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
private static final long APP_LAUNCH_ALPHA_DOWN_DURATION =
(long) (APP_LAUNCH_ALPHA_DURATION * APP_LAUNCH_DOWN_DUR_SCALE_FACTOR);
+ private static final long CROP_DURATION = 375;
+ private static final long RADIUS_DURATION = 375;
+
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 = 250;
@@ -494,10 +497,10 @@ public abstract class QuickstepAppTransitionManagerImpl extends LauncherAppTrans
EXAGGERATED_EASE);
FloatProp mIconAlpha = new FloatProp(1f, 0f, APP_LAUNCH_ALPHA_START_DELAY,
alphaDuration, LINEAR);
- FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, APP_LAUNCH_DURATION,
+ FloatProp mCroppedSize = new FloatProp(startCrop, endCrop, 0, CROP_DURATION,
EXAGGERATED_EASE);
FloatProp mWindowRadius = new FloatProp(startCrop / 2f, windowRadius, 0,
- APP_LAUNCH_DURATION, EXAGGERATED_EASE);
+ RADIUS_DURATION, EXAGGERATED_EASE);
@Override
public void onUpdate(float percent) {
diff --git a/src/com/android/launcher3/anim/FlingSpringAnim.java b/src/com/android/launcher3/anim/FlingSpringAnim.java
index f53ea5150..eaf3b1cb2 100644
--- a/src/com/android/launcher3/anim/FlingSpringAnim.java
+++ b/src/com/android/launcher3/anim/FlingSpringAnim.java
@@ -29,7 +29,7 @@ public class FlingSpringAnim {
private static final float FLING_FRICTION = 1.5f;
private static final float SPRING_STIFFNESS = 200;
- private static final float SPRING_DAMPING = 0.85f;
+ private static final float SPRING_DAMPING = 0.8f;
private final FlingAnimation mFlingAnim;
private SpringAnimation mSpringAnim;
diff --git a/src/com/android/launcher3/views/FloatingIconView.java b/src/com/android/launcher3/views/FloatingIconView.java
index 7a6da3eec..e4591b618 100644
--- a/src/com/android/launcher3/views/FloatingIconView.java
+++ b/src/com/android/launcher3/views/FloatingIconView.java
@@ -77,7 +77,7 @@ import androidx.dynamicanimation.animation.SpringForce;
public class FloatingIconView extends View implements
Animator.AnimatorListener, ClipPathView, OnGlobalLayoutListener {
- public static final float SHAPE_PROGRESS_DURATION = 0.15f;
+ public static final float SHAPE_PROGRESS_DURATION = 0.10f;
private static final int FADE_DURATION_MS = 200;
private static final Rect sTmpRect = new Rect();
private static final RectF sTmpRectF = new RectF();
@@ -85,8 +85,8 @@ public class FloatingIconView extends View implements
// We spring the foreground drawable relative to the icon's movement in the DragLayer.
// We then use these two factor values to scale the movement of the fg within this view.
- private static final int FG_TRANS_X_FACTOR = 80;
- private static final int FG_TRANS_Y_FACTOR = 100;
+ private static final int FG_TRANS_X_FACTOR = 60;
+ private static final int FG_TRANS_Y_FACTOR = 75;
private static final FloatPropertyCompat<FloatingIconView> mFgTransYProperty
= new FloatPropertyCompat<FloatingIconView>("FloatingViewFgTransY") {