mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 11:18:21 +00:00
Add Z scaling during unfold to launcher
The unfold progresses are mapped to 0.85 - 1 range and set as a scale for launcher. In case of multiple scale animations for workspace and hotseat, they are combined using MultiScaleProperty (e.g. opening an app while unfolding/going to all apps while unfolding). Note that this is a pretty difficult scenario to be in. If that happens, we multiply all values and bound the result between the max and min values. Bug: 217368525 Test: atest MultiScalePropertyTest and manually Change-Id: I6131c39f36deade0b7280c72edda2d72045344e9
This commit is contained in:
@@ -18,7 +18,8 @@ package com.android.launcher3;
|
||||
|
||||
import static androidx.dynamicanimation.animation.DynamicAnimation.MIN_VISIBLE_CHANGE_SCALE;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_WORKSPACE_STATE;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_ALPHA;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_X;
|
||||
import static com.android.launcher3.LauncherAnimUtils.VIEW_TRANSLATE_Y;
|
||||
@@ -42,6 +43,7 @@ import static com.android.launcher3.states.StateAnimationConfig.ANIM_WORKSPACE_T
|
||||
import static com.android.launcher3.states.StateAnimationConfig.SKIP_SCRIM;
|
||||
|
||||
import android.animation.ValueAnimator;
|
||||
import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
@@ -62,6 +64,9 @@ import com.android.systemui.plugins.ResourceProvider;
|
||||
*/
|
||||
public class WorkspaceStateTransitionAnimation {
|
||||
|
||||
private static final FloatProperty<View> WORKSPACE_STATE_SCALE_PROPERTY =
|
||||
SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_WORKSPACE_STATE);
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private final Workspace mWorkspace;
|
||||
|
||||
@@ -117,7 +122,8 @@ public class WorkspaceStateTransitionAnimation {
|
||||
((PendingAnimation) propertySetter).add(getSpringScaleAnimator(mLauncher,
|
||||
mWorkspace, mNewScale));
|
||||
} else {
|
||||
propertySetter.setFloat(mWorkspace, SCALE_PROPERTY, mNewScale, scaleInterpolator);
|
||||
propertySetter.setFloat(mWorkspace, WORKSPACE_STATE_SCALE_PROPERTY, mNewScale,
|
||||
scaleInterpolator);
|
||||
}
|
||||
|
||||
mWorkspace.setPivotToScaleWithSelf(hotseat);
|
||||
@@ -128,7 +134,7 @@ public class WorkspaceStateTransitionAnimation {
|
||||
} else {
|
||||
Interpolator hotseatScaleInterpolator = config.getInterpolator(ANIM_HOTSEAT_SCALE,
|
||||
scaleInterpolator);
|
||||
propertySetter.setFloat(hotseat, SCALE_PROPERTY, hotseatScale,
|
||||
propertySetter.setFloat(hotseat, WORKSPACE_STATE_SCALE_PROPERTY, hotseatScale,
|
||||
hotseatScaleInterpolator);
|
||||
}
|
||||
|
||||
@@ -205,9 +211,9 @@ public class WorkspaceStateTransitionAnimation {
|
||||
.setDampingRatio(damping)
|
||||
.setMinimumVisibleChange(MIN_VISIBLE_CHANGE_SCALE)
|
||||
.setEndValue(scale)
|
||||
.setStartValue(SCALE_PROPERTY.get(v))
|
||||
.setStartValue(WORKSPACE_STATE_SCALE_PROPERTY.get(v))
|
||||
.setStartVelocity(velocityPxPerS)
|
||||
.build(v, SCALE_PROPERTY);
|
||||
.build(v, WORKSPACE_STATE_SCALE_PROPERTY);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user