Skip to content

Commit 433b21b

Browse files
Merge pull request #137 from Omega-R/feature/hotfix
Sticky header call getStickyId with id = -1 bug fixed
2 parents 4f62871 + 3e92ae4 commit 433b21b

File tree

1 file changed

+1
-1
lines changed
  • omegarecyclerviewlibs/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration

1 file changed

+1
-1
lines changed

omegarecyclerviewlibs/src/main/java/com/omega_r/libs/omegarecyclerview/sticky_decoration/StickyDecoration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private long calculateStickerIdAndDrawIt(Canvas canvas, RecyclerView parent, boo
4949
View stickerView = stickyHolder.itemView;
5050
int top = getStickerTop(isReverseLayout, childView, stickerView, layoutPos + 1);
5151

52-
long previousStickyId = mStickyAdapter.getStickyId(adapterPosition - 1);
52+
long previousStickyId = adapterPosition == 0 ? currentStickerId : mStickyAdapter.getStickyId(adapterPosition - 1);
5353

5454
if (layoutPos == 0 && top > 0 && adapterPosition > 0
5555
&& hasSticker(adapterPosition - 1)

0 commit comments

Comments
 (0)