Skip to content

Commit

Permalink
Fixed #268 - Sticky headers don't work when all headers are initially…
Browse files Browse the repository at this point in the history
… collapsed
  • Loading branch information
davideas committed Jan 15, 2017
1 parent 3833159 commit 0f6a77f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,9 @@ private void initializeRecyclerView(Bundle savedInstanceState) {
Utils.getColorAccent(getActivity()), (MainActivity) getActivity());
// Experimenting NEW features (v5.0.0)
mAdapter.setLongPressDragEnabled(true) //Enable long press to drag items
.setHandleDragEnabled(true); //Enable handle drag
//.setDisplayHeadersAtStartUp(true); //Show Headers at startUp: (not necessary if Headers are also Expandable)
.setHandleDragEnabled(true) //Enable handle drag
//.setDisplayHeadersAtStartUp(true); //Show Headers at startUp: (not necessary if Headers are also Expandable AND expanded at startup)
.setStickyHeaders(true);

SwipeRefreshLayout swipeRefreshLayout = (SwipeRefreshLayout) getView().findViewById(R.id.swipeRefreshLayout);
swipeRefreshLayout.setEnabled(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,13 @@ public FlexibleAdapter expandItemsAtStartUp() {
multiRange = true;
while (position < getItemCount()) {
T item = getItem(position);
if (!headersShown && isHeader(item) && !item.isHidden()) {
headersShown = true;
}
if (isExpanded(item)) {
expand(position, false, true);
if (!headersShown && isHeader(item) && !item.isHidden())
headersShown = true;
}
position++;
position++; //+1 Check also subItems with expanded = true
}
multiRange = false;
setScrollAnimate(false);
Expand Down

0 comments on commit 0f6a77f

Please sign in to comment.