Solve stutter when swiping All Apps the first time

Bug: 6024062
Change-Id: I6e05e9916389b1d90bd59443a04720fbf2338f5e
This commit is contained in:
Michael Jurka
2012-05-14 23:13:15 -07:00
parent ceca4ff189
commit 5e368ffbad
2 changed files with 6 additions and 2 deletions

View File

@@ -811,6 +811,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
onSyncWidgetPageItems(d);
}
mDeferredSyncWidgetPageItems.clear();
mForceDrawAllChildrenNextFrame = !toWorkspace;
}
@Override
@@ -1514,7 +1515,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
@Override
protected void onPageEndMoving() {
super.onPageEndMoving();
mForceDrawAllChildrenNextFrame = true;
// We reset the save index when we change pages so that it will be recalculated on next
// rotation
mSaveInstanceStateItemIndex = -1;

View File

@@ -133,6 +133,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected boolean mAllowOverScroll = true;
protected int mUnboundedScrollX;
protected int[] mTempVisiblePagesRange = new int[2];
protected boolean mForceDrawAllChildrenNextFrame;
// mOverScrollX is equal to getScrollX() when we're within the normal scroll range. Otherwise
// it is equal to the scaled overscroll position. We use a separate value so as to prevent
@@ -796,13 +797,15 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// View.INVISIBLE, preventing re-drawing of their hardware layer
for (int i = getChildCount() - 1; i >= 0; i--) {
final View v = getPageAt(i);
if (leftScreen <= i && i <= rightScreen && shouldDrawChild(v)) {
if (mForceDrawAllChildrenNextFrame ||
(leftScreen <= i && i <= rightScreen && shouldDrawChild(v))) {
v.setVisibility(VISIBLE);
drawChild(canvas, v, drawingTime);
} else {
v.setVisibility(INVISIBLE);
}
}
mForceDrawAllChildrenNextFrame = false;
canvas.restore();
}
}