Adapper is a library that simplifies and streamlines the task of mapping collections of data to views that display that data.
Adapper allows you to create Adapters for use with Android's RecyclerView
with minimal effort. Implementation requires only a small handful of constructors and methods that define the dataset and how it binds to an individual view. Adapper handles the rest, including: mapping position within the dataset to position within the RecyclerView
; tracking additions, subtractions, and reorderings; sorting and grouping the data; driving a single ReyclerView
with multiple adapters; tracking selections; and more.
compile 'com.scopely:adapper:1.0.0'
Adapper requires no setup or initialization before use. Adapters created with Adapper can be instantiated when needed and used on regular RecyclerView
s without modification.
Adapper is fairly straightforward to use. ReyclerView
s can be created in Java or in XML as normal. The user can then create an instance of an Adapper and callRecyclerView#setAdapter(adapper)
BaseAdapper
is the core class of the Adapper library. It directly extends RecyclerView.Adapter
and is itself subclassed by several different Adappers depending on the type of data and presentation desired.
ListAdapper
is the most basic and straightforward of the Adappers. It is parameterized in two variables: Model
which is the class type of the data, and GenericView
which is the class type of the View
the adapter will provide to the RecyclerView
. Its constructor requires only two parameters: a List<Model>
and a ViewProvider<Model, GenericView>
.