Recycling Center is a library designed to support a pattern: reactive, unidirectional data flow using immutable ViewModels. It combines the reactive data flow of RxJava with the efficient UI of a RecyclerView, and supports UI composition via Sections of Views and ViewModels.
Recycling Center uses several primitives to create an efficient RecyclerView
.
See the Adding a Custom View guide for how they fit together, and
a code sample to see it in action.
- AdapterViewType: Each view in the RecyclerView has an enumerated type.
- AdapterViewModel: Contains all the data needed to render a view, ideally including any formatting.
- ViewBinding:
Binding code that connects a
ViewModel
to itsView
.
A ViewFactory
creates a View
from an AdapterViewType
. The ViewFactory supports background-inflated
views from a
ViewPrefetcher.
The Recycling Center RecyclerView.Adapter
adhere to the
ViewModelAdapter interface.
There are a few different adapters for different use-cases:
- BindingViewModelAdapter: Basic adapter mapping a List of ViewModels in a RecyclerView.
- SectionedRecyclerViewAdapter: A sectioned ViewModelAdapter.
- ObservableViewModelSectionAdapter:
A sectioned adapter powered by
RxJava
Observables.
Instead of Lists of ViewModels, the Recycling Center uses a
Seekable
interface to bring content to an Adapter. This simplified interface
supports simple list-based binding via
Seekables.copyOf(list)
or efficient, fluid binding from a Cursor
or other seekable stream of data.