summaryrefslogtreecommitdiff
path: root/quickstep
diff options
context:
space:
mode:
authorNicolo' Mazzucato <nicomazz@google.com>2022-02-21 18:11:23 +0100
committerNicolo' Mazzucato <nicomazz@google.com>2022-02-22 18:27:26 +0100
commit5765d42ada91f94b65a44ae982a2a3e714e65427 (patch)
treee676f4b8da5657c4e5402f85f5fd21550caf4026 /quickstep
parente424f57dcbf6d8a38df09fed8652c23f3dc23cb3 (diff)
downloadLauncher3-5765d42ada91f94b65a44ae982a2a3e714e65427.tar.gz
Fix jump in animation for hotseat while re-arranging icons
While re-arranging icons the hotseat remains in scale 1.0f, while the workspace reduces it's scale (as defined by SpringLoadedState.java). Previously, the code to aggregate animations was assuming hotseat and workspace always had the same scale. MultiScaleProperty.get() was being used to set the starting value of the animation. Previously, it was returning the last aggregated value. However, this value was correct only for the workspace, but not for the hotseat. Returning the current view scale makes it always correct. Bug: 220271046 Test: Dragged icons from hotseat to workspace, and verified animation didn't jump Change-Id: Ic01776c1d8e3967624626ed7c44d194a06295790
Diffstat (limited to 'quickstep')
-rw-r--r--quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java5
-rw-r--r--quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java15
-rw-r--r--quickstep/src/com/android/quickstep/util/WorkspaceRevealAnim.java21
3 files changed, 25 insertions, 16 deletions
diff --git a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
index 75cf5cb3a5..bd7e5de866 100644
--- a/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
+++ b/quickstep/src/com/android/launcher3/uioverrides/states/QuickstepAtomicAnimationFactory.java
@@ -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();
}
diff --git a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java
index 333df10dde..3b5804634a 100644
--- a/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java
+++ b/quickstep/src/com/android/quickstep/util/LauncherUnfoldAnimationController.java
@@ -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;
@@ -147,8 +150,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);
}
}
}
diff --git a/quickstep/src/com/android/quickstep/util/WorkspaceRevealAnim.java b/quickstep/src/com/android/quickstep/util/WorkspaceRevealAnim.java
index 8659b687c3..5326d2bb66 100644
--- a/quickstep/src/com/android/quickstep/util/WorkspaceRevealAnim.java
+++ b/quickstep/src/com/android/quickstep/util/WorkspaceRevealAnim.java
@@ -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);
}
});