From 857b3fbb7e1cc7603139d03d46cb1d08c737a338 Mon Sep 17 00:00:00 2001 From: Jon Miranda Date: Wed, 10 Jul 2019 11:04:40 -0700 Subject: [PATCH] Fix bug where app icons are clipped when transitioning from app to home. Bug: 135636137 Change-Id: Icaba06ed27b3196371730a5a4c5d3382cedc7000 --- .../util/StaggeredWorkspaceAnim.java | 40 +++++++++++++++++-- .../launcher3/anim/SpringObjectAnimator.java | 5 ++- 2 files changed, 41 insertions(+), 4 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java index 07e96869ed..45d12fd77e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/util/StaggeredWorkspaceAnim.java @@ -16,6 +16,8 @@ package com.android.quickstep.util; import android.animation.Animator; +import android.animation.Animator.AnimatorListener; +import android.animation.AnimatorListenerAdapter; import android.animation.ObjectAnimator; import android.view.View; import android.view.ViewGroup; @@ -29,6 +31,7 @@ import com.android.launcher3.LauncherState; import com.android.launcher3.LauncherStateManager.AnimationConfig; import com.android.launcher3.R; import com.android.launcher3.ShortcutAndWidgetContainer; +import com.android.launcher3.Workspace; import com.android.launcher3.anim.AnimatorSetBuilder; import com.android.launcher3.anim.PropertySetter; import com.android.launcher3.anim.SpringObjectAnimator; @@ -79,9 +82,19 @@ public class StaggeredWorkspaceAnim { .getDimensionPixelSize(R.dimen.swipe_up_max_workspace_trans_y); DeviceProfile grid = launcher.getDeviceProfile(); - ShortcutAndWidgetContainer currentPage = ((CellLayout) launcher.getWorkspace() - .getChildAt(launcher.getWorkspace().getCurrentPage())) - .getShortcutsAndWidgets(); + Workspace workspace = launcher.getWorkspace(); + CellLayout cellLayout = (CellLayout) workspace.getChildAt(workspace.getCurrentPage()); + ShortcutAndWidgetContainer currentPage = cellLayout.getShortcutsAndWidgets(); + + boolean workspaceClipChildren = workspace.getClipChildren(); + boolean workspaceClipToPadding = workspace.getClipToPadding(); + boolean cellLayoutClipChildren = cellLayout.getClipChildren(); + boolean cellLayoutClipToPadding = cellLayout.getClipToPadding(); + + workspace.setClipChildren(false); + workspace.setClipToPadding(false); + cellLayout.setClipChildren(false); + cellLayout.setClipToPadding(false); // Hotseat and QSB takes up two additional rows. int totalRows = grid.inv.numRows + (grid.isVerticalBarLayout() ? 0 : 2); @@ -111,6 +124,27 @@ public class StaggeredWorkspaceAnim { addWorkspaceScrimAnimationForState(launcher, BACKGROUND_APP, 0); addWorkspaceScrimAnimationForState(launcher, NORMAL, ALPHA_DURATION_MS); + + AnimatorListener resetClipListener = new AnimatorListenerAdapter() { + int numAnimations = mAnimators.size(); + + @Override + public void onAnimationEnd(Animator animation) { + numAnimations--; + if (numAnimations > 0) { + return; + } + + workspace.setClipChildren(workspaceClipChildren); + workspace.setClipToPadding(workspaceClipToPadding); + cellLayout.setClipChildren(cellLayoutClipChildren); + cellLayout.setClipToPadding(cellLayoutClipToPadding); + } + }; + + for (Animator a : mAnimators) { + a.addListener(resetClipListener); + } } /** diff --git a/src/com/android/launcher3/anim/SpringObjectAnimator.java b/src/com/android/launcher3/anim/SpringObjectAnimator.java index 395fed259a..91a31069c1 100644 --- a/src/com/android/launcher3/anim/SpringObjectAnimator.java +++ b/src/com/android/launcher3/anim/SpringObjectAnimator.java @@ -96,7 +96,10 @@ public class SpringObjectAnimator extends ValueAnimator { } }); - mSpring.addUpdateListener((animation, value, velocity) -> mSpringEnded = false); + mSpring.addUpdateListener((animation, value, velocity) -> { + mSpringEnded = false; + mEnded = false; + }); mSpring.addEndListener((animation, canceled, value, velocity) -> { mSpringEnded = true; tryEnding();