Merge "Only return true in getPageScrolls if it actually changes" into sc-dev

This commit is contained in:
Alex Chau
2021-04-23 10:37:14 +00:00
committed by Android (Google) Code Review
@@ -3241,8 +3241,8 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
@Override @Override
protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren, protected boolean getPageScrolls(int[] outPageScrolls, boolean layoutChildren,
ComputePageScrollsLogic scrollLogic) { ComputePageScrollsLogic scrollLogic) {
boolean pageScrollChanged = super.getPageScrolls(outPageScrolls, layoutChildren, int[] newPageScrolls = new int[outPageScrolls.length];
scrollLogic); super.getPageScrolls(newPageScrolls, layoutChildren, scrollLogic);
boolean showAsFullscreen = showAsFullscreen(); boolean showAsFullscreen = showAsFullscreen();
boolean showAsGrid = showAsGrid(); boolean showAsGrid = showAsGrid();
@@ -3254,6 +3254,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff); mClearAllButton.setScrollOffsetPrimary(mIsRtl ? clearAllWidthDiff : -clearAllWidthDiff);
} }
boolean pageScrollChanged = false;
final int childCount = getChildCount(); final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) { for (int i = 0; i < childCount; i++) {
View child = getChildAt(i); View child = getChildAt(i);
@@ -3265,9 +3266,10 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
showAsGrid); showAsGrid);
} }
if (scrollDiff != 0) { final int pageScroll = newPageScrolls[i] + (int) scrollDiff;
outPageScrolls[i] += scrollDiff; if (outPageScrolls[i] != pageScroll) {
pageScrollChanged = true; pageScrollChanged = true;
outPageScrolls[i] = pageScroll;
} }
} }
return pageScrollChanged; return pageScrollChanged;