Skip to content

Commit 70980fb

Browse files
committed
Merge pull request timehop#108 from djdmbrwsk/master
itemIsObscuredByHeader() padding fix
2 parents 056196a + 901c0d0 commit 70980fb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/src/main/java/com/timehop/stickyheadersrecyclerview/HeaderPositionCalculator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ private boolean itemIsObscuredByHeader(RecyclerView parent, View item, View head
228228

229229
if (orientation == LinearLayoutManager.VERTICAL) {
230230
int itemTop = item.getTop() - layoutParams.topMargin;
231-
int headerBottom = header.getBottom() + mTempRect1.bottom + mTempRect1.top;
232-
if (itemTop > headerBottom) {
231+
int headerBottom = getListTop(parent) + header.getBottom() + mTempRect1.bottom + mTempRect1.top;
232+
if (itemTop >= headerBottom) {
233233
return false;
234234
}
235235
} else {
236236
int itemLeft = item.getLeft() - layoutParams.leftMargin;
237-
int headerRight = header.getRight() + mTempRect1.right + mTempRect1.left;
238-
if (itemLeft > headerRight) {
237+
int headerRight = getListLeft(parent) + header.getRight() + mTempRect1.right + mTempRect1.left;
238+
if (itemLeft >= headerRight) {
239239
return false;
240240
}
241241
}

0 commit comments

Comments
 (0)