diff --git a/lib/src/main/java/ca/barrenechea/widget/recyclerview/decoration/StickyHeaderDecoration.java b/lib/src/main/java/ca/barrenechea/widget/recyclerview/decoration/StickyHeaderDecoration.java index d3fe752..2cc590c 100644 --- a/lib/src/main/java/ca/barrenechea/widget/recyclerview/decoration/StickyHeaderDecoration.java +++ b/lib/src/main/java/ca/barrenechea/widget/recyclerview/decoration/StickyHeaderDecoration.java @@ -79,17 +79,7 @@ private boolean showHeaderAboveItem(int itemAdapterPosition) { if (itemAdapterPosition == 0) { return true; } - - for (int pos = itemAdapterPosition; pos >= 0; pos--) { - long posHeaderId = mAdapter.getHeaderId(pos); - - if (posHeaderId != mAdapter.getHeaderId(itemAdapterPosition)) { - if (pos + 1 == itemAdapterPosition) { - return true; - } - } - } - return false; + return mAdapter.getHeaderId(itemAdapterPosition - 1) != mAdapter.getHeaderId(itemAdapterPosition); } /**