diff --git a/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java b/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java index 9c1c687e..2fde7ade 100644 --- a/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java +++ b/library/src/se/emilsjolander/stickylistheaders/StickyListHeadersListView.java @@ -501,7 +501,7 @@ public void onHeaderClick(View header, int itemPosition, long headerId) { private boolean isStartOfSection(int position) { return position == 0 - || mAdapter.getHeaderId(position) == mAdapter + || mAdapter.getHeaderId(position) != mAdapter .getHeaderId(position - 1); } @@ -710,6 +710,7 @@ public void smoothScrollToPosition(int position) { mList.smoothScrollToPosition(position); } else { int offset = mAdapter == null ? 0 : getHeaderOverlap(position); + offset -= mClippingToPadding ? 0 : mPaddingTop; mList.smoothScrollToPositionFromTop(position, offset); } } @@ -724,6 +725,7 @@ public void smoothScrollToPosition(int position, int boundPosition) { public void smoothScrollToPositionFromTop(int position, int offset) { requireSdkVersion(Build.VERSION_CODES.HONEYCOMB); offset += mAdapter == null ? 0 : getHeaderOverlap(position); + offset -= mClippingToPadding ? 0 : mPaddingTop; mList.smoothScrollToPositionFromTop(position, offset); } @@ -732,6 +734,7 @@ public void smoothScrollToPositionFromTop(int position, int offset, int duration) { requireSdkVersion(Build.VERSION_CODES.HONEYCOMB); offset += mAdapter == null ? 0 : getHeaderOverlap(position); + offset -= mClippingToPadding ? 0 : mPaddingTop; mList.smoothScrollToPositionFromTop(position, offset, duration); } @@ -745,6 +748,7 @@ public void setSelectionAfterHeaderView() { public void setSelectionFromTop(int position, int y) { y += mAdapter == null ? 0 : getHeaderOverlap(position); + y -= mClippingToPadding ? 0 : mPaddingTop; mList.setSelectionFromTop(position, y); }