Fix foreground position during widget home animation
The home return animation applies a position animation to all views in the workspace. Since the widget uses a GhostView of the original widget to represent the foreground of the animation, that animation was reflected in the foreground's positioning. The CL creates an ignore list of workspace views to which an animator should not be applied. Bug: 190488979 Test: manual Change-Id: I5a86165e945336693eedd253a02bda1e1eb6662d
This commit is contained in:
@@ -181,6 +181,12 @@ public class LauncherSwipeHandlerV2 extends
|
||||
|
||||
return new FloatingViewHomeAnimationFactory(floatingWidgetView) {
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
protected View getViewIgnoredInWorkspaceRevealAnimation() {
|
||||
return hostView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RectF getWindowTargetRect() {
|
||||
super.getWindowTargetRect();
|
||||
@@ -370,6 +376,16 @@ public class LauncherSwipeHandlerV2 extends
|
||||
}
|
||||
|
||||
private class LauncherHomeAnimationFactory extends HomeAnimationFactory {
|
||||
|
||||
/**
|
||||
* Returns a view which should be excluded from the Workspace animation, or null if there
|
||||
* is no view to exclude.
|
||||
*/
|
||||
@Nullable
|
||||
protected View getViewIgnoredInWorkspaceRevealAnimation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AnimatorPlaybackController createActivityAnimationToHome() {
|
||||
@@ -383,7 +399,8 @@ public class LauncherSwipeHandlerV2 extends
|
||||
@Override
|
||||
public void playAtomicAnimation(float velocity) {
|
||||
if (!PROTOTYPE_APP_CLOSE.get()) {
|
||||
new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */)
|
||||
new StaggeredWorkspaceAnim(mActivity, velocity, true /* animateOverviewScrim */,
|
||||
getViewIgnoredInWorkspaceRevealAnimation())
|
||||
.start();
|
||||
} else if (shouldPlayAtomicWorkspaceReveal()) {
|
||||
new WorkspaceRevealAnim(mActivity, true).start();
|
||||
|
||||
@@ -32,6 +32,8 @@ import android.animation.ValueAnimator;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.BaseQuickstepLauncher;
|
||||
import com.android.launcher3.CellLayout;
|
||||
import com.android.launcher3.DeviceProfile;
|
||||
@@ -68,15 +70,18 @@ public class StaggeredWorkspaceAnim {
|
||||
private final float mSpringTransY;
|
||||
|
||||
private final AnimatorSet mAnimators = new AnimatorSet();
|
||||
private final @Nullable View mIgnoredView;
|
||||
|
||||
public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim) {
|
||||
this(launcher, velocity, animateOverviewScrim, true);
|
||||
public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
|
||||
@Nullable View ignoredView) {
|
||||
this(launcher, velocity, animateOverviewScrim, ignoredView, true);
|
||||
}
|
||||
|
||||
public StaggeredWorkspaceAnim(Launcher launcher, float velocity, boolean animateOverviewScrim,
|
||||
boolean staggerWorkspace) {
|
||||
@Nullable View ignoredView, boolean staggerWorkspace) {
|
||||
prepareToAnimate(launcher, animateOverviewScrim);
|
||||
|
||||
mIgnoredView = ignoredView;
|
||||
mVelocity = velocity;
|
||||
|
||||
// Scale the translationY based on the initial velocity to better sync the workspace items
|
||||
@@ -224,6 +229,7 @@ public class StaggeredWorkspaceAnim {
|
||||
* @param totalRows Total number of rows.
|
||||
*/
|
||||
private void addStaggeredAnimationForView(View v, int row, int totalRows) {
|
||||
if (mIgnoredView != null && mIgnoredView == v) return;
|
||||
// Invert the rows, because we stagger starting from the bottom of the screen.
|
||||
int invertedRow = totalRows - row;
|
||||
// Add 1 to the inverted row so that the bottom most row has a start delay.
|
||||
|
||||
Reference in New Issue
Block a user