luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

removeAllSections doesn't clear sectionViewTypeNumbers #169

Closed Fintasys closed 5 years ago

Fintasys commented 5 years ago

When I looked over your code I realized that removeSection remove its Tag from sectionViewTypeNumbers but removeAllSections doesn't.

Not a big thing but still wanted to let you know.

luizgrp commented 5 years ago

@Fintasys thanks for reporting it 👍

Ryanhustler420 commented 5 years ago

When I looked over your code I realized that removeSection remove its Tag from sectionViewTypeNumbers but removeAllSections doesn't.

Not a big thing but still wanted to let you know.

I faced the same issue. i used sectionedRecyclerViewAdapter.notifyDataSetChanged(); and i worked!


int size = sectionedRecyclerViewAdapter.getSectionCount();
for (int i = 0; i < size; i++) {
    Section section = sectionedRecyclerViewAdapter.getSectionForPosition(i);
    sectionedRecyclerViewAdapter.removeSection(section);
    if(sectionedRecyclerViewAdapter.getSectionCount() <= 0) {
          sectionedRecyclerViewAdapter.notifyDataSetChanged();
      }
   }
luizgrp commented 5 years ago

Addressed here.