recyclerview-animators icon indicating copy to clipboard operation
recyclerview-animators copied to clipboard

Propagate notify* events from wrapped adapter to AnimationAdapter

Open mheras opened this issue 10 years ago • 6 comments

It would be great if the notify* events could be propagated from the wrapper adapter to the AnimationAdapter, so that we can see the animation if we call any of those methods in the wrapper adapter.

mheras avatar Jul 08 '15 17:07 mheras

@mheras

hi.

Do you have any good idea?

wasabeef avatar Jul 09 '15 01:07 wasabeef

@wasabeef indeed: Make the AnimationAdapter an observer of the wrapped adapter. You can implement an inner class by subclassing RecyclerView.AdapterDataObserver so that you listen any notify* method call. Then, on each implemented method, you forward the event to all your registered observers (AnimationAdapter's observers). And that's all. Now the developer can call any notify* method on the wrapped adapter, and still make the RecyclerView aware of that :)

If you need an example of the implementation, do not hesitate to look here: https://github.com/mheras/RecyclerViewBoilerplate/blob/master/lib/src/main/java/com/mato/recyclerview/boilerplate/HeaderFooterAdapter.java

mheras avatar Jul 09 '15 01:07 mheras

@wasabeef and of course this also makes possible to chain your AnimationAdapter with any other adapter implementations (like mine, as posted in my previous comment).

mheras avatar Jul 09 '15 01:07 mheras

@wasabeef Have you had the chance to add this functionality to the lib?

mheras avatar Sep 02 '15 13:09 mheras

@mheras

Hi. I woud like you to pull-request. It I wanna merge :shipit:

wasabeef avatar Sep 03 '15 02:09 wasabeef

I need this functionality too.

Zeliret avatar Oct 15 '15 11:10 Zeliret