Package-level declarations
Types
Link copied to clipboard
annotation class InternalPageableApi
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
class PageFetchStrategy<Key : Any, PageItem, Context>(val initialPage: Context.() -> Key, val onNextPage: Context.(key: Key) -> Key?, val onPreviousPage: Context.(key: Key) -> Key?, onPageCalculation: PageFetchStrategy<Key, PageItem, Context>.(context: PageFetchContext<Key, PageItem, Context>) -> List<Key>)
Defines how pages should be prefetched based on what's currently displayed.
Functions
Link copied to clipboard
fun <Key : Any, PageItem> pageable(coroutineScope: CoroutineScope, onPage: Unit.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Unit>, onPageEvent: (event: PageEvent<Key>) -> Unit? = null, resultingItemsTransform: (List<PageItem>) -> List<PageItem> = { it }, initialItems: List<PageItem> = emptyList()): Pageable<Key, PageItem>
Creates a Pageable with integer-based page keys starting from 0.
fun <Key : Any, PageItem, Context> pageable(coroutineScope: CoroutineScope, context: StateFlow<Context>, onPage: Context.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Context>, onPageEvent: (event: PageEvent<Key>) -> Unit? = null, resultingItemsTransform: (List<PageItem>) -> List<PageItem> = { it }, initialItems: List<PageItem> = emptyList()): Pageable<Key, PageItem>
Creates a Pageable that can react to changes in the provided context.
Link copied to clipboard
fun <PageItem, Context> prefetchMinimumItemAmount(initialPage: Int = 0, minimumItemAmount: Int = 20): PageFetchStrategy<Int, PageItem, Context>
fun <Key : Any, PageItem, Context> prefetchMinimumItemAmount(initialPage: Key, onNextPage: Context.(key: Key) -> Key?, onPreviousPage: Context.(key: Key) -> Key?, minimumItemAmount: Int = 20): PageFetchStrategy<Key, PageItem, Context>
Strategy that prefetches pages to ensure at least minimumItemAmount items are available around visible items in both directions.
Link copied to clipboard
fun <PageItem, Context> prefetchPageAmount(initialPage: Int = 0, minimumPageAmount: Int = 2): PageFetchStrategy<Int, PageItem, Context>
fun <Key : Any, PageItem, Context> prefetchPageAmount(initialPage: Key, onNextPage: Context.(key: Key) -> Key?, onPreviousPage: Context.(key: Key) -> Key?, minimumPageAmount: Int = 2): PageFetchStrategy<Key, PageItem, Context>
Strategy that prefetches a fixed number of pages around visible items in both directions.