9fd8e6171bbdc37f5516fe15b2d96f4ae926ef1a |
|
23-Jun-2017 |
Chris Craik <ccraik@google.com> |
Initial commit of paging component. This commit introduces a paging component to enable gradual, lazy loading from large data sources, including Room queries. The primary entry points are: 1) CountedDataSource, the base class for defining a countable (i.e. fixed, known size) source of items, such as a Database query. 2) LazyList, the lazy-loading List-like component which pages content in on a background thread from a CountedDataSource. 3) LiveLazyListProvider, the class which produces DataSources, and presents a LiveData<LazyList<T>>. 4) LazyListAdapterHelper, which takes a LiveData<LazyList>, and presents the data simply to an adapter. It computes differences between versions with DiffUtil, and signalling updates to the adapter. Currently, Room only presents a limit-offset query as an easy means to get a LiveData of a LazyList, but it's possible to write a custom data source to page in data from keyed (including composite-keyed) queries. Test: new tests Change-Id: I415879a032d83786d734c26c429828da3b8bc76a
/frameworks/support/room/compiler/src/main/kotlin/android/arch/persistence/room/solver/binderprovider/InstantQueryResultBinderProvider.kt
|