diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java b/go/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java index 5382607a14..cec12a8d18 100644 --- a/go/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java +++ b/go/quickstep/src/com/android/launcher3/uioverrides/OverviewState.java @@ -43,7 +43,7 @@ public class OverviewState extends LauncherState { } @Override - public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { + public float[] getOverviewScaleAndTranslationY(Launcher launcher) { return new float[] {1f, 0f}; } diff --git a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 784af7d11a..0b12ab052e 100644 --- a/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/go/quickstep/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -16,16 +16,15 @@ package com.android.launcher3.uioverrides; import static com.android.quickstep.views.IconRecentsView.CONTENT_ALPHA; -import static com.android.quickstep.views.IconRecentsView.TRANSLATION_Y_FACTOR; import android.util.FloatProperty; -import androidx.annotation.NonNull; - import com.android.launcher3.Launcher; import com.android.launcher3.LauncherRecentsToActivityHelper; import com.android.quickstep.views.IconRecentsView; +import androidx.annotation.NonNull; + /** * State handler for Go's {@link IconRecentsView}. */ @@ -38,11 +37,6 @@ public final class RecentsViewStateController extends new LauncherRecentsToActivityHelper(launcher)); } - @Override - FloatProperty getTranslationYFactorProperty() { - return TRANSLATION_Y_FACTOR; - } - @Override FloatProperty getContentAlphaProperty() { return CONTENT_ALPHA; diff --git a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java index 3fdaefe156..504f640069 100644 --- a/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java +++ b/go/quickstep/src/com/android/quickstep/views/IconRecentsView.java @@ -46,20 +46,6 @@ import com.android.quickstep.TaskSwipeCallback; */ public final class IconRecentsView extends FrameLayout { - public static final FloatProperty TRANSLATION_Y_FACTOR = - new FloatProperty("translationYFactor") { - - @Override - public void setValue(IconRecentsView view, float v) { - view.setTranslationYFactor(v); - } - - @Override - public Float get(IconRecentsView view) { - return view.mTranslationYFactor; - } - }; - public static final FloatProperty CONTENT_ALPHA = new FloatProperty("contentAlpha") { @Override @@ -91,7 +77,6 @@ public final class IconRecentsView extends FrameLayout { private final TaskInputController mTaskInputController; private RecentsToActivityHelper mActivityHelper; - private float mTranslationYFactor; private RecyclerView mTaskRecyclerView; private View mEmptyView; @@ -170,15 +155,6 @@ public final class IconRecentsView extends FrameLayout { return view.getThumbnailView(); } - public void setTranslationYFactor(float translationFactor) { - mTranslationYFactor = translationFactor; - setTranslationY(computeTranslationYForFactor(mTranslationYFactor)); - } - - private float computeTranslationYForFactor(float translationYFactor) { - return translationYFactor * (getPaddingBottom() - getPaddingTop()); - } - /** * Update the content view so that the appropriate view is shown based off the current list * of tasks. diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java index fdb80da387..f7127537a5 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/BackgroundAppState.java @@ -52,7 +52,7 @@ public class BackgroundAppState extends OverviewState { } @Override - public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { + public float[] getOverviewScaleAndTranslationY(Launcher launcher) { // Initialize the recents view scale to what it would be when starting swipe up RecentsView recentsView = launcher.getOverviewPanel(); recentsView.getTaskSize(sTempRect); diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewState.java index 79e127a8d7..2360eebc46 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/OverviewState.java @@ -69,7 +69,7 @@ public class OverviewState extends LauncherState { } @Override - public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { + public float[] getOverviewScaleAndTranslationY(Launcher launcher) { return new float[] {1f, 0f}; } diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java index 0b3bd6c792..0d5574fa91 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/RecentsViewStateController.java @@ -15,7 +15,6 @@ */ package com.android.launcher3.uioverrides; -import static com.android.quickstep.views.LauncherRecentsView.TRANSLATION_Y_FACTOR; import static com.android.quickstep.views.RecentsView.CONTENT_ALPHA; import android.animation.ValueAnimator; @@ -23,8 +22,6 @@ import android.annotation.TargetApi; import android.os.Build; import android.util.FloatProperty; -import androidx.annotation.NonNull; - import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; @@ -32,6 +29,8 @@ import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.quickstep.views.LauncherRecentsView; import com.android.quickstep.views.RecentsView; +import androidx.annotation.NonNull; + /** * State handler for handling UI changes for {@link LauncherRecentsView}. In addition to managing * the basic view properties, this class also manages changes in the task visuals. @@ -79,11 +78,6 @@ public final class RecentsViewStateController extends } } - @Override - FloatProperty getTranslationYFactorProperty() { - return TRANSLATION_Y_FACTOR; - } - @Override FloatProperty getContentAlphaProperty() { return CONTENT_ALPHA; diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java index e95e2a0de5..20a22e98a1 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/LauncherActivityControllerHelper.java @@ -56,9 +56,7 @@ import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.SpringObjectAnimator; import com.android.launcher3.compat.AccessibilityManagerCompat; import com.android.launcher3.config.FeatureFlags; -import com.android.launcher3.dragndrop.DragLayer; import com.android.launcher3.userevent.nano.LauncherLogProto; -import com.android.launcher3.util.MultiValueAlpha.AlphaProperty; import com.android.launcher3.views.FloatingIconView; import com.android.quickstep.util.ClipAnimationHelper; import com.android.quickstep.util.LayoutUtils; @@ -308,7 +306,7 @@ public final class LauncherActivityControllerHelper implements ActivityControlHe // starting to line up the side pages during swipe up) float prevRvScale = recentsView.getScaleX(); float prevRvTransY = recentsView.getTranslationY(); - float targetRvScale = endState.getOverviewScaleAndTranslationYFactor(launcher)[0]; + float targetRvScale = endState.getOverviewScaleAndTranslationY(launcher)[0]; SCALE_PROPERTY.set(recentsView, targetRvScale); recentsView.setTranslationY(0); ClipAnimationHelper clipHelper = new ClipAnimationHelper(launcher); diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java index 97bce5eb98..8f2a2d7258 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/LauncherRecentsView.java @@ -56,27 +56,6 @@ import com.android.quickstep.util.LayoutUtils; @TargetApi(Build.VERSION_CODES.O) public class LauncherRecentsView extends RecentsView { - public static final FloatProperty TRANSLATION_Y_FACTOR = - new FloatProperty("translationYFactor") { - - @Override - public void setValue(LauncherRecentsView view, float v) { - view.setTranslationYFactor(v); - } - - @Override - public Float get(LauncherRecentsView view) { - return view.mTranslationYFactor; - } - }; - - /** - * A ratio representing the view's relative placement within its padded space. For example, 0 - * is top aligned and 0.5 is centered vertically. - */ - @ViewDebug.ExportedProperty(category = "launcher") - private float mTranslationYFactor; - private final TransformParams mTransformParams = new TransformParams(); private ChipsContainer mChipsContainer; @@ -103,12 +82,6 @@ public class LauncherRecentsView extends RecentsView { } } - @Override - protected void onLayout(boolean changed, int left, int top, int right, int bottom) { - super.onLayout(changed, left, top, right, bottom); - setTranslationYFactor(mTranslationYFactor); - } - @Override protected void onAttachedToWindow() { super.onAttachedToWindow(); @@ -117,9 +90,9 @@ public class LauncherRecentsView extends RecentsView { params.bottomMargin = mActivity.getDeviceProfile().chipHintBottomMarginPx; } - public void setTranslationYFactor(float translationFactor) { - mTranslationYFactor = translationFactor; - setTranslationY(computeTranslationYForFactor(mTranslationYFactor)); + @Override + public void setTranslationY(float translationY) { + super.setTranslationY(translationY); if (ENABLE_QUICKSTEP_LIVE_TILE.get()) { LauncherState state = mActivity.getStateManager().getState(); if (state == OVERVIEW || state == ALL_APPS) { @@ -128,10 +101,6 @@ public class LauncherRecentsView extends RecentsView { } } - public float computeTranslationYForFactor(float translationYFactor) { - return translationYFactor * (getPaddingBottom() - getPaddingTop()); - } - public void setHintVisibility(float v) { if (mChipsContainer != null && ENABLE_HINTS_IN_OVERVIEW.get()) { mChipsContainer.setHintVisibility(v); diff --git a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java index 1eaa8bc92c..5ae562e8bd 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java +++ b/quickstep/src/com/android/launcher3/uioverrides/AllAppsState.java @@ -78,8 +78,9 @@ public class AllAppsState extends LauncherState { } @Override - public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { - return new float[] {0.9f, -0.2f}; + public float[] getOverviewScaleAndTranslationY(Launcher launcher) { + float slightParallax = -launcher.getDeviceProfile().allAppsCellHeightPx * 0.3f; + return new float[] {0.9f, slightParallax}; } @Override diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index df9dbe4119..e74d84dc28 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -26,8 +26,6 @@ import android.util.FloatProperty; import android.view.View; import android.view.animation.Interpolator; -import androidx.annotation.NonNull; - import com.android.launcher3.Launcher; import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; @@ -35,6 +33,8 @@ import com.android.launcher3.LauncherStateManager.StateHandler; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; +import androidx.annotation.NonNull; + /** * State handler for recents view. Manages UI changes and animations for recents view based off the * current {@link LauncherState}. @@ -53,9 +53,9 @@ public abstract class BaseRecentsViewStateController @Override public void setState(@NonNull LauncherState state) { - float[] scaleTranslationYFactor = state.getOverviewScaleAndTranslationYFactor(mLauncher); - SCALE_PROPERTY.set(mRecentsView, scaleTranslationYFactor[0]); - getTranslationYFactorProperty().set(mRecentsView, scaleTranslationYFactor[1]); + float[] scaleTranslationY = state.getOverviewScaleAndTranslationY(mLauncher); + SCALE_PROPERTY.set(mRecentsView, scaleTranslationY[0]); + mRecentsView.setTranslationY(scaleTranslationY[1]); getContentAlphaProperty().set(mRecentsView, state.overviewUi ? 1f : 0); } @@ -79,11 +79,11 @@ public abstract class BaseRecentsViewStateController void setStateWithAnimationInternal(@NonNull final LauncherState toState, @NonNull AnimatorSetBuilder builder, @NonNull AnimationConfig config) { PropertySetter setter = config.getPropertySetter(builder); - float[] scaleTranslationYFactor = toState.getOverviewScaleAndTranslationYFactor(mLauncher); + float[] scaleTranslationY = toState.getOverviewScaleAndTranslationY(mLauncher); Interpolator scaleAndTransYInterpolator = getScaleAndTransYInterpolator(toState, builder); - setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleTranslationYFactor[0], + setter.setFloat(mRecentsView, SCALE_PROPERTY, scaleTranslationY[0], scaleAndTransYInterpolator); - setter.setFloat(mRecentsView, getTranslationYFactorProperty(), scaleTranslationYFactor[1], + setter.setFloat(mRecentsView, View.TRANSLATION_Y, scaleTranslationY[1], scaleAndTransYInterpolator); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, builder.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); @@ -101,13 +101,6 @@ public abstract class BaseRecentsViewStateController return builder.getInterpolator(ANIM_OVERVIEW_SCALE, LINEAR); } - /** - * Get property for translation Y factor for the recents view. - * - * @return the float property for the recents view - */ - abstract FloatProperty getTranslationYFactorProperty(); - /** * Get property for content alpha for the recents view. * diff --git a/src/com/android/launcher3/LauncherState.java b/src/com/android/launcher3/LauncherState.java index cee1c26ef4..875288a55c 100644 --- a/src/com/android/launcher3/LauncherState.java +++ b/src/com/android/launcher3/LauncherState.java @@ -192,13 +192,7 @@ public class LauncherState { return getWorkspaceScaleAndTranslation(launcher); } - /** - * Returns 2 floats designating how to transition overview: - * scale for the current and adjacent pages - * translationY factor where 0 is top aligned and 0.5 is centered vertically - */ - public float[] getOverviewScaleAndTranslationYFactor(Launcher launcher) { - // TODO: Simplify to use a constant value instead of a factor. + public float[] getOverviewScaleAndTranslationY(Launcher launcher) { return new float[] {1.1f, 0f}; }