Package-level declarations
Types
Link copied to clipboard
@RequiresOptIn(message = "This API is for internal or test use only.", level = RequiresOptIn.Level.ERROR)
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 fetched based on what's currently displayed.
Functions
Link copied to clipboard
fun <Key : Any, PageItem : Any> pageable(coroutineScope: CoroutineScope, onPage: Unit.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Unit>, initialItems: List<PageItem> = emptyList(), pageItemKey: (PageItem) -> Any = { it }): Pageable<Key, PageItem>
Creates an empty-context Pageable.
fun <Key : Any, PageItem : Any, Context> pageable(coroutineScope: CoroutineScope, context: StateFlow<Context>, onPage: Context.(key: Key) -> Flow<List<PageItem>?>, strategy: PageFetchStrategy<Key, PageItem, Context>, initialItems: List<PageItem> = emptyList(), pageItemKey: (PageItem) -> Any = { it }): 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.