mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Change overview animation to scale instead of translationX
As you swipe up to overview from home, workspace scales down and fades out as before, and now recents scales down from 1.2f on top of it. The interpolators are set such that the workspace animation is seen before the recents animation. Also, we don't scale down all of recents, only the visible pages (current and adjacent). Change-Id: I5f8bfe8cafeaa41d26873c63549735d7bdff2bce
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package com.android.launcher3.uioverrides;
|
||||
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.AnimatorSetBuilder.ANIM_OVERVIEW_TRANSLATION;
|
||||
import static com.android.launcher3.anim.Interpolators.AGGRESSIVE_EASE_IN_OUT;
|
||||
import static com.android.launcher3.anim.Interpolators.LINEAR;
|
||||
import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_X_FACTOR;
|
||||
import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR;
|
||||
import static com.android.quickstep.views.RecentsView.ADJACENT_SCALE;
|
||||
import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
@@ -30,7 +30,6 @@ import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.LauncherState;
|
||||
import com.android.launcher3.LauncherStateManager.AnimationConfig;
|
||||
import com.android.launcher3.LauncherStateManager.StateHandler;
|
||||
import com.android.launcher3.PagedView;
|
||||
import com.android.launcher3.anim.AnimatorSetBuilder;
|
||||
import com.android.launcher3.anim.PropertySetter;
|
||||
import com.android.quickstep.views.LauncherRecentsView;
|
||||
@@ -49,9 +48,9 @@ public class RecentsViewStateController implements StateHandler {
|
||||
@Override
|
||||
public void setState(LauncherState state) {
|
||||
mRecentsView.setContentAlpha(state.overviewUi ? 1 : 0);
|
||||
float[] translationFactor = state.getOverviewTranslationFactor(mLauncher);
|
||||
mRecentsView.setTranslationXFactor(translationFactor[0]);
|
||||
mRecentsView.setTranslationYFactor(translationFactor[1]);
|
||||
float[] scaleTranslationYFactor = state.getOverviewScaleAndTranslationYFactor(mLauncher);
|
||||
mRecentsView.setAdjacentScale(scaleTranslationYFactor[0]);
|
||||
mRecentsView.setTranslationYFactor(scaleTranslationYFactor[1]);
|
||||
if (state.overviewUi) {
|
||||
mRecentsView.updateEmptyMessage();
|
||||
mRecentsView.resetTaskVisuals();
|
||||
@@ -61,28 +60,18 @@ public class RecentsViewStateController implements StateHandler {
|
||||
@Override
|
||||
public void setStateWithAnimation(final LauncherState toState,
|
||||
AnimatorSetBuilder builder, AnimationConfig config) {
|
||||
|
||||
// Scroll to the workspace card before changing to the NORMAL state.
|
||||
LauncherState fromState = mLauncher.getStateManager().getState();
|
||||
int currPage = mRecentsView.getCurrentPage();
|
||||
if (fromState.overviewUi && toState == NORMAL && currPage != 0 && !config.userControlled) {
|
||||
int maxSnapDuration = PagedView.SLOW_PAGE_SNAP_ANIMATION_DURATION;
|
||||
int durationPerPage = maxSnapDuration / 10;
|
||||
int snapDuration = Math.min(maxSnapDuration, durationPerPage * currPage);
|
||||
mRecentsView.snapToPage(0, snapDuration);
|
||||
// Let the snapping animation play for a bit before we translate off screen.
|
||||
builder.setStartDelay(snapDuration / 4);
|
||||
}
|
||||
|
||||
PropertySetter setter = config.getProperSetter(builder);
|
||||
float[] translationFactor = toState.getOverviewTranslationFactor(mLauncher);
|
||||
setter.setFloat(mRecentsView, TRANSLATION_X_FACTOR,
|
||||
translationFactor[0],
|
||||
float[] scaleTranslationYFactor = toState.getOverviewScaleAndTranslationYFactor(mLauncher);
|
||||
setter.setFloat(mRecentsView, ADJACENT_SCALE, scaleTranslationYFactor[0],
|
||||
builder.getInterpolator(ANIM_OVERVIEW_TRANSLATION, LINEAR));
|
||||
setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR,
|
||||
translationFactor[1],
|
||||
setter.setFloat(mRecentsView, TRANSLATION_Y_FACTOR, scaleTranslationYFactor[1],
|
||||
builder.getInterpolator(ANIM_OVERVIEW_TRANSLATION, LINEAR));
|
||||
setter.setFloat(mRecentsView, CONTENT_ALPHA, toState.overviewUi ? 1 : 0, LINEAR);
|
||||
setter.setFloat(mRecentsView, CONTENT_ALPHA, toState.overviewUi ? 1 : 0,
|
||||
AGGRESSIVE_EASE_IN_OUT);
|
||||
|
||||
if (!toState.overviewUi) {
|
||||
builder.addOnFinishRunnable(mRecentsView::resetTaskVisuals);
|
||||
}
|
||||
|
||||
if (toState.overviewUi) {
|
||||
ValueAnimator updateAnim = ValueAnimator.ofFloat(0, 1);
|
||||
|
||||
Reference in New Issue
Block a user