AsyncListUtil-Example icon indicating copy to clipboard operation
AsyncListUtil-Example copied to clipboard

adding filtering to recyclerview adapter with listutil

Open yetanothercoder opened this issue 7 years ago • 0 comments

I've found some caveats when trying to add filtering to such adapter: We implemented search via SearchView and on each text change (new search) we have to re-init AsyncListUtil itself (otherwise list is not updated fully, there were many bugs with not cleared items etc.)

Here is adapter code (and all project code there in branch)

Not sure - if listUtil is defined as field of RecyclerView.Adapter is it necessary marking it as volatile to be visible for all threads? And when creating and assigning new AsyncListUtil - must any listeners (e.g. OnScrollListener) attached to recycler view be re-attached?

p.s. create SO topic too: https://codereview.stackexchange.com/questions/191818/reloading-asynclistutil-in-recyclerview-adapter-on-searchview-update

Thanks.

yetanothercoder avatar Apr 11 '18 19:04 yetanothercoder