RecyclerView-MultipleViewTypesAdapter
RecyclerView-MultipleViewTypesAdapter copied to clipboard
How to delete binder?
Hi, if you have 3 binders in your recyclerview like your example and i want to delete binder 2. How should i do this?
Thanks in advance!
Yilzer
I had the same issue and ended up creating a FlexibleListBindAdapter like this
public class FlexibleListBindAdapter extends DataBindAdapter {
and then implement the missing method
public void removeBinder(DataBinder binder) {
mBinderList.remove(binder);
}
This works fine
PS if you later will want to put it back (e.g. show/hide binder items depending on some checkbox) - you may just return 0 or mDataSet.size() from overriding DataBinder.getItemCount and then call notifyBinderDataSetChanged()
@slott I didn't see a way for algorithm to see that you really removed binder. If you delete binder the way you suggested in https://github.com/yqritc/RecyclerView-MultipleViewTypesAdapter/issues/16#issuecomment-275601464 Then you are just removing an item from mBinderList which is a regular List in ListBindAdapter. You can just read the algorithm in ListBindAdapter and try to understand how to notify it about a change
https://github.com/yqritc/RecyclerView-MultipleViewTypesAdapter/issues/11#issuecomment-167453751