Skip to content

Commit 34ac0ec

Browse files
mnlmatopaulfthomas
authored andcommitted
Automated g4 rollback of changelist 458265064
PiperOrigin-RevId: 461012017
1 parent e968929 commit 34ac0ec

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/java/com/google/android/material/divider/MaterialDividerItemDecoration.java

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -317,18 +317,16 @@ private void drawForVerticalOrientation(@NonNull Canvas canvas, @NonNull Recycle
317317
left += isRtl ? insetEnd : insetStart;
318318
right -= isRtl ? insetStart : insetEnd;
319319

320-
int itemCount = parent.getAdapter() == null ? 0 : parent.getAdapter().getItemCount();
321-
int dividerCount = lastItemDecorated ? itemCount : itemCount - 1;
320+
int childCount = parent.getChildCount();
321+
int dividerCount = lastItemDecorated ? childCount : childCount - 1;
322322
for (int i = 0; i < dividerCount; i++) {
323323
View child = parent.getChildAt(i);
324-
if (child != null) {
325-
parent.getDecoratedBoundsWithMargins(child, tempRect);
326-
// Take into consideration any translationY added to the view.
327-
int bottom = tempRect.bottom + Math.round(child.getTranslationY());
328-
int top = bottom - dividerDrawable.getIntrinsicHeight() - thickness;
329-
dividerDrawable.setBounds(left, top, right, bottom);
330-
dividerDrawable.draw(canvas);
331-
}
324+
parent.getDecoratedBoundsWithMargins(child, tempRect);
325+
// Take into consideration any translationY added to the view.
326+
int bottom = tempRect.bottom + Math.round(child.getTranslationY());
327+
int top = bottom - dividerDrawable.getIntrinsicHeight() - thickness;
328+
dividerDrawable.setBounds(left, top, right, bottom);
329+
dividerDrawable.draw(canvas);
332330
}
333331
canvas.restore();
334332
}

0 commit comments

Comments
 (0)