Merge "Fixing widget size cache loop end-boundary" into tm-qpr-dev am: 5d749d93e6

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/19087388

Change-Id: I583a37c3d11d5cb2f9768bd37e391523e16550e1
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2022-06-28 06:01:44 +00:00
committed by Automerger Merge Worker
@@ -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());