diff --git a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java index 267227dce5..f1250637a8 100644 --- a/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java +++ b/quickstep/src/com/android/quickstep/LauncherSwipeHandlerV2.java @@ -336,8 +336,8 @@ public class LauncherSwipeHandlerV2 extends @Override public void playAtomicAnimation(float velocity) { - new StaggeredWorkspaceAnim(mActivity, velocity, - true /* animateOverviewScrim */).start(); + new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */, + !PROTOTYPE_APP_CLOSE.get()).start(); } @Override diff --git a/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java index 95d56aaca4..97be2b1787 100644 --- a/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java +++ b/quickstep/src/com/android/quickstep/util/RectFSpringAnim2.java @@ -69,12 +69,12 @@ public class RectFSpringAnim2 extends RectFSpringAnim { new FloatPropertyCompat("rectYSpring") { @Override public float getValue(RectFSpringAnim2 anim) { - return anim.mCurrentY; + return anim.mCurrentCenterY; } @Override public void setValue(RectFSpringAnim2 anim, float y) { - anim.mCurrentY = y; + anim.mCurrentCenterY = y; anim.onUpdate(); } }; @@ -100,13 +100,12 @@ public class RectFSpringAnim2 extends RectFSpringAnim { private final List mAnimatorListeners = new ArrayList<>(); private float mCurrentCenterX; - private float mCurrentY; + private float mCurrentCenterY; private float mTargetX; private float mTargetY; // If true, tracking the bottom of the rects, else tracking the top. - private final boolean mTrackingBottomY; private float mProgress; private SpringAnimation mRectXAnim; private SpringAnimation mRectYAnim; @@ -139,11 +138,10 @@ public class RectFSpringAnim2 extends RectFSpringAnim { mStartRect = startRect; mTargetRect = targetRect; - mTrackingBottomY = startRect.bottom < targetRect.bottom; - mCurrentY = mTrackingBottomY ? mStartRect.bottom : mStartRect.top; + mCurrentCenterY = mStartRect.centerY(); mCurrentCenterX = mStartRect.centerX(); - mTargetY = mTrackingBottomY ? mTargetRect.bottom : mTargetRect.top; + mTargetY = mTargetRect.centerY(); mTargetX = mTargetRect.centerX(); ResourceProvider rp = DynamicResource.provider(context); @@ -157,12 +155,6 @@ public class RectFSpringAnim2 extends RectFSpringAnim { mHomeTransYEnd = dpToPx(rp.getFloat(R.dimen.swipe_up_trans_y_dp)); mScaleStart = rp.getFloat(R.dimen.swipe_up_scale_start); - - if (!mTrackingBottomY) { - mYStiffness *= rp.getFloat(R.dimen.swipe_up_rect_2_y_stiffness_low_swipe_multiplier); - mDuration *= rp.getFloat(R.dimen.swipe_up_low_swipe_duration_multiplier); - } - mCloseInterpolator = getAppCloseInterpolator(context); // End on a "round-enough" radius so that the shape reveal doesn't have to do too much @@ -180,11 +172,8 @@ public class RectFSpringAnim2 extends RectFSpringAnim { } if (mRectYAnim != null) { - if (mTrackingBottomY && mTargetY != mTargetRect.bottom) { - mTargetY = mTargetRect.bottom; - mRectYAnim.animateToFinalPosition(mTargetY); - } else if (!mTrackingBottomY && mTargetY != mTargetRect.top) { - mTargetY = mTargetRect.top; + if (mTargetY != mTargetRect.centerY()) { + mTargetY = mTargetRect.centerY(); mRectYAnim.animateToFinalPosition(mTargetY); } } @@ -220,9 +209,9 @@ public class RectFSpringAnim2 extends RectFSpringAnim { })); mRectYAnim = new SpringAnimation(this, RECT_Y) - .setStartValue(mCurrentY) - .setMinValue(Math.min(0, mCurrentY)) - .setMaxValue(Math.max(dp.heightPx, mCurrentY)) + .setStartValue(mCurrentCenterY) + .setMinValue(Math.min(0, mCurrentCenterY)) + .setMaxValue(Math.max(dp.heightPx, mCurrentCenterY)) .setStartVelocity(velocityPxPerMs.y * 1000) .setSpring(new SpringForce(mTargetY) .setStiffness(mYStiffness) @@ -336,13 +325,11 @@ public class RectFSpringAnim2 extends RectFSpringAnim { mTargetRect.width()); float currentHeight = Utilities.mapRange(rectProgress, mStartRect.height(), mTargetRect.height()); - if (mTrackingBottomY) { - mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY - currentHeight, - mCurrentCenterX + currentWidth / 2, mCurrentY); - } else { - mCurrentRect.set(mCurrentCenterX - currentWidth / 2, mCurrentY, - mCurrentCenterX + currentWidth / 2, mCurrentY + currentHeight); - } + + mCurrentRect.set(mCurrentCenterX - currentWidth / 2, + mCurrentCenterY - currentHeight / 2, + mCurrentCenterX + currentWidth / 2, + mCurrentCenterY + currentHeight / 2); float currentPlayTime = mRectScaleAnimEnded ? mRectScaleAnim.getDuration() : mRectScaleAnim.getCurrentPlayTime(); diff --git a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 0ea1fcac76..d430028f8c 100644 --- a/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -20,7 +20,6 @@ import static com.android.launcher3.LauncherState.BACKGROUND_APP; import static com.android.launcher3.LauncherState.NORMAL; import static com.android.launcher3.anim.Interpolators.LINEAR; import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER; -import static com.android.launcher3.config.FeatureFlags.PROTOTYPE_APP_CLOSE; import static com.android.launcher3.states.StateAnimationConfig.SKIP_DEPTH_CONTROLLER; import static com.android.launcher3.states.StateAnimationConfig.SKIP_OVERVIEW; import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM; @@ -71,6 +70,11 @@ public class StaggeredWorkspaceAnim { private final AnimatorSet mAnimators = new AnimatorSet(); public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) { + this(launcher, velocity, animateOverviewScrim, true); + } + + public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim, + boolean staggerWorkspace) { prepareToAnimate(launcher, animateOverviewScrim); mVelocity = velocity; @@ -81,53 +85,66 @@ public class StaggeredWorkspaceAnim { mSpringTransY = transFactor * launcher.getResources() .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y); - DeviceProfile grid = launcher.getDeviceProfile(); - Workspace workspace = launcher.getWorkspace(); - Hotseat hotseat = launcher.getHotseat(); + if (staggerWorkspace) { + DeviceProfile grid = launcher.getDeviceProfile(); + Workspace workspace = launcher.getWorkspace(); + Hotseat hotseat = launcher.getHotseat(); - // Hotseat and QSB takes up two additional rows. - int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2); + // Hotseat and QSB takes up two additional rows. + int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2); - // Add animation for all the visible workspace pages - workspace.forEachVisiblePage(page -> addAnimationForPage((CellLayout) page, totalRows)); + // Add animation for all the visible workspace pages + workspace.forEachVisiblePage(page -> addAnimationForPage((CellLayout) page, totalRows)); - boolean workspaceClipChildren = workspace.getClipChildren(); - boolean workspaceClipToPadding = workspace.getClipToPadding(); - boolean hotseatClipChildren = hotseat.getClipChildren(); - boolean hotseatClipToPadding = hotseat.getClipToPadding(); + boolean workspaceClipChildren = workspace.getClipChildren(); + boolean workspaceClipToPadding = workspace.getClipToPadding(); + boolean hotseatClipChildren = hotseat.getClipChildren(); + boolean hotseatClipToPadding = hotseat.getClipToPadding(); - workspace.setClipChildren(false); - workspace.setClipToPadding(false); - hotseat.setClipChildren(false); - hotseat.setClipToPadding(false); + workspace.setClipChildren(false); + workspace.setClipToPadding(false); + hotseat.setClipChildren(false); + hotseat.setClipToPadding(false); - // Set up springs for the hotseat and qsb. - ViewGroup hotseatIcons = hotseat.getShortcutsAndWidgets(); - if (grid.isVerticalBarLayout()) { - for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) { - View child = hotseatIcons.getChildAt(i); - CellLayout.LayoutParams lp = ((CellLayout.LayoutParams) child.getLayoutParams()); - addStaggeredAnimationForView(child, lp.cellY + 1, totalRows); - } - } else { - final int hotseatRow, qsbRow, taskbarRow; - if (grid.isTaskbarPresent) { - qsbRow = grid.inv.numRows + 1; - hotseatRow = grid.inv.numRows + 2; + // Set up springs for the hotseat and qsb. + ViewGroup hotseatIcons = hotseat.getShortcutsAndWidgets(); + if (grid.isVerticalBarLayout()) { + for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) { + View child = hotseatIcons.getChildAt(i); + CellLayout.LayoutParams lp = + ((CellLayout.LayoutParams) child.getLayoutParams()); + addStaggeredAnimationForView(child, lp.cellY + 1, totalRows); + } } else { - hotseatRow = grid.inv.numRows + 1; - qsbRow = grid.inv.numRows + 2; - } - // Taskbar and hotseat overlap. - taskbarRow = hotseatRow; + final int hotseatRow, qsbRow, taskbarRow; + if (grid.isTaskbarPresent) { + qsbRow = grid.inv.numRows + 1; + hotseatRow = grid.inv.numRows + 2; + } else { + hotseatRow = grid.inv.numRows + 1; + qsbRow = grid.inv.numRows + 2; + } + // Taskbar and hotseat overlap. + taskbarRow = hotseatRow; - for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) { - View child = hotseatIcons.getChildAt(i); - addStaggeredAnimationForView(child, hotseatRow, totalRows); + for (int i = hotseatIcons.getChildCount() - 1; i >= 0; i--) { + View child = hotseatIcons.getChildAt(i); + addStaggeredAnimationForView(child, hotseatRow, totalRows); + } + + addStaggeredAnimationForView(hotseat.getQsb(), qsbRow, totalRows); + addStaggeredAnimationForView(hotseat.getTaskbarView(), taskbarRow, totalRows); } - addStaggeredAnimationForView(hotseat.getQsb(), qsbRow, totalRows); - addStaggeredAnimationForView(hotseat.getTaskbarView(), taskbarRow, totalRows); + mAnimators.addListener(new AnimatorListenerAdapter() { + @Override + public void onAnimationEnd(Animator animation) { + workspace.setClipChildren(workspaceClipChildren); + workspace.setClipToPadding(workspaceClipToPadding); + hotseat.setClipChildren(hotseatClipChildren); + hotseat.setClipToPadding(hotseatClipToPadding); + } + }); } if (animateOverviewScrim) { @@ -141,15 +158,6 @@ public class StaggeredWorkspaceAnim { mAnimators.play(launcher.getRootView().getSysUiScrim().createSysuiMultiplierAnim(0f, 1f) .setDuration(DURATION_MS)); - mAnimators.addListener(new AnimatorListenerAdapter() { - @Override - public void onAnimationEnd(Animator animation) { - workspace.setClipChildren(workspaceClipChildren); - workspace.setClipToPadding(workspaceClipToPadding); - hotseat.setClipChildren(hotseatClipChildren); - hotseat.setClipToPadding(hotseatClipToPadding); - } - }); } private void addAnimationForPage(CellLayout page, int totalRows) { @@ -220,9 +228,6 @@ public class StaggeredWorkspaceAnim { * @param totalRows Total number of rows. */ private void addStaggeredAnimationForView(View v, int row, int totalRows) { - if (PROTOTYPE_APP_CLOSE.get()) { - return; - } // Invert the rows, because we stagger starting from the bottom of the screen. int invertedRow = totalRows - row; // Add 1 to the inverted row so that the bottom most row has a start delay. diff --git a/res/values/config.xml b/res/values/config.xml index e65c65277e..102d4e0c37 100644 --- a/res/values/config.xml +++ b/res/values/config.xml @@ -127,12 +127,12 @@ 1.5 0.98 - 500 + 400 - 3 + 4.5 3 - 0.4 + 0.45 200 0.8 @@ -140,12 +140,12 @@ 1 - 350 + 250 1 - 700 + 600 - 1 + 0.8 1 0.85 diff --git a/src/com/android/launcher3/config/FeatureFlags.java b/src/com/android/launcher3/config/FeatureFlags.java index 7ef43ed4be..0c0c92ed04 100644 --- a/src/com/android/launcher3/config/FeatureFlags.java +++ b/src/com/android/launcher3/config/FeatureFlags.java @@ -238,7 +238,7 @@ public final class FeatureFlags { "Sends a notification whenever launcher encounters an uncaught exception."); public static final BooleanFlag PROTOTYPE_APP_CLOSE = getDebugFlag( - "PROTOTYPE_APP_CLOSE", false, "Enables new app close"); + "PROTOTYPE_APP_CLOSE", true, "Enables new app close"); public static final BooleanFlag ENABLE_WALLPAPER_SCRIM = getDebugFlag( "ENABLE_WALLPAPER_SCRIM", false,