Merge "Fixing widget size cache loop end-boundary" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-06-28 05:19:32 +00:00
committed by Android (Google) Code Review
@@ -173,11 +173,12 @@ public class WidgetsRecyclerView extends FastScrollRecyclerView implements OnIte
@Override
protected int getItemsHeight(int untilIndex) {
// Initialize cache
int childCount = Math.min(getChildCount(), getAdapter().getItemCount());
int childCount = getChildCount();
int startPosition;
if (childCount > 0
&& ((startPosition = getChildAdapterPosition(getChildAt(0))) != NO_POSITION)) {
for (int i = 0; i < childCount; i++) {
int loopCount = Math.min(getChildCount(), getAdapter().getItemCount() - startPosition);
for (int i = 0; i < loopCount; i++) {
mCachedSizes.put(
mAdapter.getItemViewType(startPosition + i),
getChildAt(i).getMeasuredHeight());