Skip to content
This repository has been archived by the owner on Jun 9, 2020. It is now read-only.

Commit

Permalink
Merge pull request #61 from ptwoms/Fix-overlapping-section-headers
Browse files Browse the repository at this point in the history
Attempt to fix the overlapping section headers when the list view reach ...
  • Loading branch information
Sergej Shafarenka committed Feb 8, 2015
2 parents 2640017 + cd8308a commit 241d916
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions library/src/com/hb/views/PinnedSectionListView.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,9 +278,14 @@ void ensureShadowForPosition(int sectionPosition, int firstVisibleItem, int visi

int findFirstVisibleSectionPosition(int firstVisibleItem, int visibleItemCount) {
ListAdapter adapter = getAdapter();

if (firstVisibleItem + visibleItemCount >= adapter.getCount()) return -1; // dataset has changed, no candidate


int adapterDataCount = adapter.getCount();
if (getLastVisiblePosition() >= adapterDataCount) return -1; // dataset has changed, no candidate

if (firstVisibleItem+visibleItemCount >= adapterDataCount){//added to prevent index Outofbound (in case)
visibleItemCount = adapterDataCount-firstVisibleItem;
}

for (int childIndex = 0; childIndex < visibleItemCount; childIndex++) {
int position = firstVisibleItem + childIndex;
int viewType = adapter.getItemViewType(position);
Expand Down

0 comments on commit 241d916

Please sign in to comment.