Skip to content

Commit 2c58aa6

Browse files
author
Peter Olamit
committed
added header check
1 parent fa4f4d3 commit 2c58aa6

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

receipt/src/main/java/com/hyperwallet/android/receipt/view/ReceiptItemDividerDecorator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,13 @@ public void onDrawOver(@NonNull Canvas c, @NonNull RecyclerView parent, @NonNull
5656
if (child instanceof LinearLayout) { // receipt header
5757
left = ((ViewGroup) ((ViewGroup) child).getChildAt(1)).getChildAt(1).getLeft();
5858
} else { // receipt item
59-
left = ((ViewGroup) child).getChildAt(1).getLeft();
59+
// peek if next is a header then draw line from beginning
60+
if (parent.getChildAt(i + 1) != null
61+
&& parent.getChildAt(i + 1) instanceof LinearLayout) {
62+
left = 0;
63+
} else {
64+
left = ((ViewGroup) child).getChildAt(1).getLeft();
65+
}
6066
}
6167
}
6268
top = child.getBottom() + params.bottomMargin;

0 commit comments

Comments
 (0)