Merge "Fix jump in animation for hotseat while re-arranging icons" into tm-dev am: 49cb99a420
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/16967985 Change-Id: I05ccfa5901e84dd103348ae16dad28cb1edb2408
This commit is contained in:
+3
-2
@@ -22,7 +22,7 @@ import static com.android.launcher3.LauncherState.HINT_STATE;
|
||||
import static com.android.launcher3.LauncherState.HINT_STATE_TWO_BUTTON;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.LauncherState.OVERVIEW;
|
||||
import static com.android.launcher3.WorkspaceStateTransitionAnimation.getSpringScaleAnimator;
|
||||
import static com.android.launcher3.WorkspaceStateTransitionAnimation.getWorkspaceSpringScaleAnimator;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.ACCEL_DEACCEL;
|
||||
import static com.android.launcher3.anim.Interpolators.DEACCEL;
|
||||
@@ -172,7 +172,8 @@ public class QuickstepAtomicAnimationFactory extends
|
||||
} else if (fromState == HINT_STATE && toState == NORMAL) {
|
||||
config.setInterpolator(ANIM_DEPTH, DEACCEL_3);
|
||||
if (mHintToNormalDuration == -1) {
|
||||
ValueAnimator va = getSpringScaleAnimator(mActivity, mActivity.getWorkspace(),
|
||||
ValueAnimator va = getWorkspaceSpringScaleAnimator(mActivity,
|
||||
mActivity.getWorkspace(),
|
||||
toState.getWorkspaceScaleAndTranslation(mActivity).scale);
|
||||
mHintToNormalDuration = (int) va.getDuration();
|
||||
}
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_UNFOLD_ANIMATION;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.WORKSPACE_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.Utilities.comp;
|
||||
|
||||
import android.annotation.Nullable;
|
||||
import android.util.FloatProperty;
|
||||
import android.util.MathUtils;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.WindowManagerGlobal;
|
||||
|
||||
@@ -30,6 +30,7 @@ import androidx.core.view.OneShotPreDrawListener;
|
||||
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.Workspace;
|
||||
import com.android.launcher3.util.HorizontalInsettableView;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider;
|
||||
import com.android.systemui.unfold.UnfoldTransitionProgressProvider.TransitionProgressListener;
|
||||
@@ -44,8 +45,10 @@ public class LauncherUnfoldAnimationController {
|
||||
// Percentage of the width of the quick search bar that will be reduced
|
||||
// from the both sides of the bar when progress is 0
|
||||
private static final float MAX_WIDTH_INSET_FRACTION = 0.15f;
|
||||
private static final FloatProperty<View> UNFOLD_SCALE_PROPERTY =
|
||||
SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_UNFOLD_ANIMATION);
|
||||
private static final FloatProperty<Workspace> WORKSPACE_SCALE_PROPERTY =
|
||||
WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_UNFOLD_ANIMATION);
|
||||
private static final FloatProperty<Hotseat> HOTSEAT_SCALE_PROPERTY =
|
||||
HOTSEAT_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_UNFOLD_ANIMATION);
|
||||
|
||||
private final Launcher mLauncher;
|
||||
private final ScopedUnfoldTransitionProgressProvider mProgressProvider;
|
||||
@@ -154,8 +157,8 @@ public class LauncherUnfoldAnimationController {
|
||||
}
|
||||
|
||||
private void setScale(float value) {
|
||||
UNFOLD_SCALE_PROPERTY.setValue(mLauncher.getWorkspace(), value);
|
||||
UNFOLD_SCALE_PROPERTY.setValue(mLauncher.getHotseat(), value);
|
||||
WORKSPACE_SCALE_PROPERTY.setValue(mLauncher.getWorkspace(), value);
|
||||
HOTSEAT_SCALE_PROPERTY.setValue(mLauncher.getHotseat(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,8 +15,9 @@
|
||||
*/
|
||||
package com.android.quickstep.util;
|
||||
|
||||
import static com.android.launcher3.LauncherAnimUtils.HOTSEAT_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_INDEX_REVEAL_ANIM;
|
||||
import static com.android.launcher3.LauncherAnimUtils.SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherAnimUtils.WORKSPACE_SCALE_PROPERTY_FACTORY;
|
||||
import static com.android.launcher3.LauncherState.BACKGROUND_APP;
|
||||
import static com.android.launcher3.LauncherState.NORMAL;
|
||||
import static com.android.launcher3.anim.PropertySetter.NO_ANIM_PROPERTY_SETTER;
|
||||
@@ -32,6 +33,7 @@ import android.util.FloatProperty;
|
||||
import android.view.View;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.Hotseat;
|
||||
import com.android.launcher3.Launcher;
|
||||
import com.android.launcher3.R;
|
||||
import com.android.launcher3.Workspace;
|
||||
@@ -51,8 +53,11 @@ public class WorkspaceRevealAnim {
|
||||
|
||||
// Should be used for animations running alongside this WorkspaceRevealAnim.
|
||||
public static final int DURATION_MS = 350;
|
||||
private static final FloatProperty<View> REVEAL_SCALE_PROPERTY =
|
||||
SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_REVEAL_ANIM);
|
||||
private static final FloatProperty<Workspace> WORKSPACE_SCALE_PROPERTY =
|
||||
WORKSPACE_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_REVEAL_ANIM);
|
||||
|
||||
private static final FloatProperty<Hotseat> HOTSEAT_SCALE_PROPERTY =
|
||||
HOTSEAT_SCALE_PROPERTY_FACTORY.get(SCALE_INDEX_REVEAL_ANIM);
|
||||
|
||||
private final float mScaleStart;
|
||||
private final AnimatorSet mAnimators = new AnimatorSet();
|
||||
@@ -67,8 +72,8 @@ public class WorkspaceRevealAnim {
|
||||
workspace.setPivotToScaleWithSelf(launcher.getHotseat());
|
||||
|
||||
// Add reveal animations.
|
||||
addRevealAnimatorsForView(workspace);
|
||||
addRevealAnimatorsForView(launcher.getHotseat());
|
||||
addRevealAnimatorsForView(workspace, WORKSPACE_SCALE_PROPERTY);
|
||||
addRevealAnimatorsForView(launcher.getHotseat(), HOTSEAT_SCALE_PROPERTY);
|
||||
|
||||
// Add overview scrim animation.
|
||||
if (animateOverviewScrim) {
|
||||
@@ -93,8 +98,8 @@ public class WorkspaceRevealAnim {
|
||||
mAnimators.setInterpolator(Interpolators.DECELERATED_EASE);
|
||||
}
|
||||
|
||||
private void addRevealAnimatorsForView(View v) {
|
||||
ObjectAnimator scale = ObjectAnimator.ofFloat(v, REVEAL_SCALE_PROPERTY, mScaleStart, 1f);
|
||||
private <T extends View> void addRevealAnimatorsForView(T v, FloatProperty<T> scaleProperty) {
|
||||
ObjectAnimator scale = ObjectAnimator.ofFloat(v, scaleProperty, mScaleStart, 1f);
|
||||
scale.setDuration(DURATION_MS);
|
||||
scale.setInterpolator(Interpolators.DECELERATED_EASE);
|
||||
mAnimators.play(scale);
|
||||
@@ -107,7 +112,7 @@ public class WorkspaceRevealAnim {
|
||||
mAnimators.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
REVEAL_SCALE_PROPERTY.set(v, 1f);
|
||||
scaleProperty.set(v, 1f);
|
||||
v.setAlpha(1f);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user