RecyclerView-MultipleViewTypesAdapter icon indicating copy to clipboard operation
RecyclerView-MultipleViewTypesAdapter copied to clipboard

How to delete binder?

Open arkinaforlife opened this issue 7 years ago • 4 comments

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

arkinaforlife avatar Oct 08 '16 22:10 arkinaforlife

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

slott avatar Jan 27 '17 06:01 slott

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()

Deepscorn avatar Mar 01 '18 02:03 Deepscorn

@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

Deepscorn avatar Mar 01 '18 02:03 Deepscorn

https://github.com/yqritc/RecyclerView-MultipleViewTypesAdapter/issues/11#issuecomment-167453751

Deepscorn avatar Mar 01 '18 02:03 Deepscorn