All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.ru.astrainteractive.klibs.paging.IntPagerCollector.kt Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package ru.astrainteractive.klibs.paging

import ru.astrainteractive.klibs.paging.context.IntPageContext
import ru.astrainteractive.klibs.paging.data.PagedListDataSource
import ru.astrainteractive.klibs.paging.state.PagingState

/**
 * This is a default implementation for Integer page. You can define your own by delegation just like that
 */
class IntPagerCollector(
    private val initialPage: Int = 0,
    private val pageSize: Int = 10,
    private val pager: PagedListDataSource,
) : PagingCollector by DefaultPagingCollector(
    initialPagingStateFactory = {
        PagingState(
            pageContext = IntPageContext(page = initialPage),
            items = emptyList(),
            pageSizeAtLeast = pageSize,
            isLastPage = false,
            isLoading = false,
            isFailure = false
        )
    },
    pager = pager,
    pageContextFactory = IntPageContext.Factory
)




© 2015 - 2025 Weber Informatics LLC | Privacy Policy