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

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

Change-Id: I968f0912f84df2eb4eafde38854153b496c69504
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:04:57 +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());