Removing custom dispatchDraw logic and letting the system handle

selecting appropriate children for drawing.

> System already skips children which are outside the bounds. Originally
this logic was added because workspace layout is larger than the screen, and
we need to selectivly skip more children. But over time we have added many
special conditions and at present workspace actually draws more children than
needed at any given time.
> Fixing bug, where onBeginPageMoving was getting called during folder open

Bug: 12116740
Change-Id: Idee18ee9cd9d348ebc4dfd82f4ff6df14e0d22d2
This commit is contained in:
Sunny Goyal
2016-10-26 13:06:08 -07:00
parent 35fe7be54e
commit 9ccafbff26
4 changed files with 90 additions and 203 deletions
@@ -60,7 +60,6 @@ public class PinchAnimationManager {
private final Animator[] mAnimators = new Animator[4];
private final int[] mVisiblePageRange = new int[2];
private Launcher mLauncher;
private Workspace mWorkspace;
@@ -181,17 +180,13 @@ public class PinchAnimationManager {
}
private void setOverviewPanelsAlpha(float alpha, int duration) {
mWorkspace.getVisiblePages(mVisiblePageRange);
for (int i = mVisiblePageRange[0]; i <= mVisiblePageRange[1]; i++) {
View page = mWorkspace.getPageAt(i);
if (!mWorkspace.shouldDrawChild(page)) {
continue;
}
int childCount = mWorkspace.getChildCount();
for (int i = 0; i < childCount; i++) {
final CellLayout cl = (CellLayout) mWorkspace.getChildAt(i);
if (duration == 0) {
((CellLayout) page).setBackgroundAlpha(alpha);
cl.setBackgroundAlpha(alpha);
} else {
ObjectAnimator.ofFloat(page, "backgroundAlpha", alpha)
.setDuration(duration).start();
ObjectAnimator.ofFloat(cl, "backgroundAlpha", alpha).setDuration(duration).start();
}
}
}