Closed yccheok closed 5 years ago
Hi @yccheok, the current alternative to getSectionCount()
is getCopyOfSectionsMap().size()
but yes, let's add a getSectionCount()
with an implementation of sections.size()
.
Regarding getSection(index)
, it's a little more complex as sections is currently a LinkedHashMap and it does not track index position. I would look for alternatives from Guava or Apache Commons.
Also there is this solution in #28 that I never had time to have a proper look at. Not sure it would be good to have the index in the Section class as proposed there, it would get out of sync if the Section index gets changed and the adapter is not notified.
Is your feature request related to a problem? Please describe. Sometimes, number of Sections can changed dynamically, and we need to get Nth Section, to turn on and turn off header. Instead of keeping separate List of Section within the app, it is better if we can get such information directly from
SectionedRecyclerViewAdapter
Describe the solution you'd like Provide a
getSectionCount()
function, andgetSection(int index)
function inSectionedRecyclerViewAdapter
Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.
Additional context Currently,
Map<String, Section> sections
is being used inSectionedRecyclerViewAdapter
. Not sure we need an additionalList<Section> sectionList
to serve the above purpose.