dvdciri / dvdciri/MultiChoiceRecyclerView

If updating adapter item list later on through notifyDataSetChanged, invalid state

Open
#49 8 comments 0 reactions 0 assignees View on GitHub
bug enhancement
Dominant language
Java
Stars
349
Forks
68
PR merge metrics
No merged PRs in 30d

Description

### Context
When passing an empty list to the adapter and updating the last later on, through notifyDataSetChanged, the adapter will end up saving not all the list of items, but only the one that are bind to a view (because of the internal logic of the MultiChoiceAdapter). This is putting the app in an invalid state because when we go to selectAll items, for instance, the MultiChoiceAdapter knows only about those binded items and not the non-binded ones.

### Possible solution
It might be necessary to ask the user in the MultiChoiceAdapter constructor or somewhere else, maybe forcing it through an abstract method, to provide the item size list.

Or it might just work that when we found an item not in the list of items, we re-call `getItemCount()` method of the Adapter and re-init the list the new `INACTIVE` items.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.