Merge "Tuning app open/close animation." into ub-launcher3-qt-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
958cc0657f
@@ -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>
|
||||
+12
-2
@@ -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;
|
||||
@@ -1140,16 +1141,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 */);
|
||||
|
||||
|
||||
+16
-4
@@ -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;
|
||||
|
||||
+6
-7
@@ -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()
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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") {
|
||||
|
||||
Reference in New Issue
Block a user