Codewaves / Sticky-Header-Grid

Sticky header grid layout manager for RecycleView
MIT License
116 stars 35 forks source link

Removing last item from group does not remove header. #2

Closed ConorGarry closed 7 years ago

ConorGarry commented 7 years ago

So I have a group with sub-items. When I remove the items it works fine with

notifySectionItemRemoved(section, item)

This removes the item, but if it's the last item, the header remains. I have tried

notifySectionHeaderChanged(section);

and I have even tried using the initial RecyclerView adapter's

if (mGroupedList.get(section).postList.size() == 0) { notifyItemRemoved(section);}

Still no luck. Is there anything else I need to do to remove it?

Codewaves commented 7 years ago

Layout doesn't support header visibility control. Header will always be visible, even if section is empty. One of the ways to implement it, is to create custom adapter that removes empty sections or reinserts non empty, with full reload using notifyAllSectionsDataSetChanged().