mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-05 18:36:49 +00:00
Solve stutter when swiping All Apps the first time
Bug: 6024062 Change-Id: I6e05e9916389b1d90bd59443a04720fbf2338f5e
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user