Replace translationYFactor with just translationY
Now that we don't have quick scrub, the only state that has a non-zero translation is all apps, which just uses that to have a slight parallax. This is much simpler to define in terms of pixels like other states do. Change-Id: I108c8505d85591399256b3475f7566ff51e2c5ad
This commit is contained in:
parent
a761a0d585
commit
bfc9dde03e
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
|
@ -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<IconRecentsView> getTranslationYFactorProperty() {
|
||||
return TRANSLATION_Y_FACTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
FloatProperty<IconRecentsView> getContentAlphaProperty() {
|
||||
return CONTENT_ALPHA;
|
||||
|
|
|
@ -46,20 +46,6 @@ import com.android.quickstep.TaskSwipeCallback;
|
|||
*/
|
||||
public final class IconRecentsView extends FrameLayout {
|
||||
|
||||
public static final FloatProperty<IconRecentsView> TRANSLATION_Y_FACTOR =
|
||||
new FloatProperty<IconRecentsView>("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<IconRecentsView> CONTENT_ALPHA =
|
||||
new FloatProperty<IconRecentsView>("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.
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
|
@ -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<LauncherRecentsView> getTranslationYFactorProperty() {
|
||||
return TRANSLATION_Y_FACTOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
FloatProperty<RecentsView> getContentAlphaProperty() {
|
||||
return CONTENT_ALPHA;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -56,27 +56,6 @@ import com.android.quickstep.util.LayoutUtils;
|
|||
@TargetApi(Build.VERSION_CODES.O)
|
||||
public class LauncherRecentsView extends RecentsView<Launcher> {
|
||||
|
||||
public static final FloatProperty<LauncherRecentsView> TRANSLATION_Y_FACTOR =
|
||||
new FloatProperty<LauncherRecentsView>("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<Launcher> {
|
|||
}
|
||||
}
|
||||
|
||||
@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<Launcher> {
|
|||
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<Launcher> {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<T extends View>
|
|||
|
||||
@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<T extends View>
|
|||
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<T extends View>
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -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};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue