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:
Tony
2019-03-15 16:55:53 -05:00
parent a761a0d585
commit bfc9dde03e
11 changed files with 23 additions and 104 deletions

View File

@@ -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.
*