manas-chaudhari / android-mvvm

MVVM on Android using RxJava and Data Binding
Apache License 2.0
501 stars 81 forks source link

Reactive list for recyclerview/viewpager #50

Open mike-mathieu opened 7 years ago

mike-mathieu commented 7 years ago

How about using a reactive list for populating the RecyclerViews and ViewPagers? Such as if you wanted to add or remove items from a list without redisplaying the entire list. Something like this.

Again, awesome library.

manas-chaudhari commented 7 years ago

This is a great idea. It would also enable building an adapter that creates animates the changes in RecyclerView. I think ReactiveList implementation should be a separate library. If there are already existing implementations, support can be integrated as an optional module. With #40, one of the options that I am considering is using databinding.ObservableList as the base for setting up adapters. ObservableList implements the necessary callbacks mentioned by you. As its part of databinding, it won't impose any additional dependency on library consumers. However, there are concerns (mentioned on that issue) which need to be addressed before this approach is implemented.

mike-mathieu commented 7 years ago

Hmm yes if I understand correctly I think ObservableList will do just what's needed, perfect.