Package fr.haan.bipak

Types

Link copied to clipboard
class Pager<Key : Any, Value : Any>(    scope: CoroutineScope,     source: PagingDataSource<Key, Value>,     initialKey: Key,     config: PagingConfig = PagingConfig())

Primary entry point into Paging; constructor for a reactive stream of PagingData.

Link copied to clipboard
class PagingConfig @JvmOverloads constructor(val pageSize: Int = 10, val prefetchDistance: Int = pageSize / 2)

An object used to configure loading behavior within a Pager, as it loads content from a PagingSource.

Link copied to clipboard
data class PagingData<Value : Any>(    val list: List<Value>,     val state: PagingData.LoadState,     val totalCount: Int?)

Contain current paged data (in list) and current load state (in state)

Link copied to clipboard
abstract class PagingDataSource<Key : Any, Value : Any>

Base class for an abstraction of pageable static data from some source, where loading pages of data is typically an expensive operation. Some examples of common PagingDataSources might be from network or from a database.

Link copied to clipboard
class PagingEventEmitter

This class exposes an eventFlow ready to be consumed by Pager It's a Helper class to be used in the UI layer. Calling onGetItem by giving the index of the currently displayed item will trigger the fetching and prefetching of data based on Pager configuration and state.

Link copied to clipboard
sealed class PagingViewEvent

Events going from UI layer to Pager allowing to fetch data

Functions

Link copied to clipboard
fun <I : Any, O : Any> PagingData<I>.map(transform: (I) -> O): PagingData<O>

Returns a PagingData containing the results of applying the given transform function to each element in the original list.