IviPagingSource

interface IviPagingSource<E : Any>

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

This class substitutes the Android's PagingSource class. See PagingSource for details. The IVI service framework uses a substitute to allow the source to be implemented at the service side. Mirroring the PagingSource one to one on the client side is not possible as some of the PagingSource API cannot block on IO. Also to allow the IVI service framework integrate seamlessly with the Android paging library, the construction of the PagingSource class cannot be blocked on IO. For this reason the IviPagingSource class deviates at four points from the PagingSource class:

  1. PagingSource.getRefreshKey is implemented solely on the client side. Therefore not included in the IviPagingSource class.

  2. PagingSource.jumpingSupported is obtained from the IviDataSource instead of the IviPagingSource. Therefore not included in the IviPagingSource class.

  3. PagingSource.keyReuseSupported is obtained from the IviDataSource instead of the IviPagingSource. Therefore not included in the IviPagingSource class.

  4. IviPagingSource does not have a Key parameterized type. The IviPagingSource always uses an index to define which data to load. This is required to be able to implement PagingSource.getRefreshKey solely on the client side.

The remainder of the IviPagingSource API mimics the PagingSource class.

Inheritors

Types

Link copied to clipboard
sealed class LoadParams
Link copied to clipboard
sealed class LoadResult<E : Any>

Properties

Link copied to clipboard
abstract val invalid: Boolean

Functions

Link copied to clipboard
abstract fun invalidate()

Signal the PagingSource to stop loading. Same as PagingSource.invalidate. See PagingSource.invalidate for details.

Link copied to clipboard
abstract suspend fun load(loadParams: IviPagingSource.LoadParams): IviPagingSource.LoadResult<E>

Loads a page. Same as PagingSource.load. See PagingSource.load for details.

Link copied to clipboard
abstract fun registerInvalidatedCallback(callback: () -> Unit)
Link copied to clipboard
abstract fun unregisterInvalidatedCallback(callback: () -> Unit)