features/characters_list / com.vmadalin.dynamicfeatures.characterslist.ui.list.paging / CharactersPageDataSource

CharactersPageDataSource

open class CharactersPageDataSource : PageKeyedDataSource<Int, CharacterItem>

Incremental data loader for page-keyed content, where requests return keys for next/previous pages. Obtaining paginated the Marvel characters.

See Also

PageKeyedDataSource

Constructors

<init>

Incremental data loader for page-keyed content, where requests return keys for next/previous pages. Obtaining paginated the Marvel characters.

CharactersPageDataSource(repository: MarvelRepository, scope: CoroutineScope, mapper: CharacterItemMapper)

Properties

mapper

val mapper: CharacterItemMapper

networkState

val networkState: MutableLiveData<NetworkState>

repository

val repository: MarvelRepository

retry

var retry: (() -> Unit)?

scope

val scope: CoroutineScope

Functions

loadAfter

Append page with the key specified by LoadParams.key.

open fun loadAfter(params: LoadParams<Int>, callback: LoadCallback<Int, CharacterItem>): Unit

loadBefore

Prepend page with the key specified by LoadParams.key

open fun loadBefore(params: LoadParams<Int>, callback: LoadCallback<Int, CharacterItem>): Unit

loadInitial

Load initial data.

open fun loadInitial(params: LoadInitialParams<Int>, callback: LoadInitialCallback<Int, CharacterItem>): Unit

retry

Force retry last fetch operation in case it has ever been previously executed.

fun retry(): Unit