Google은 흑인 공동체를 위한 인종 간 평등을 진전시키기 위해 노력하고 있습니다. Google에서 어떤 노력을 하고 있는지 확인하세요.

ListenableFutureRemoteMediator

abstract class ListenableFutureRemoteMediator<Key : Any, Value : Any> : RemoteMediator<Key, Value>
kotlin.Any
   ↳ androidx.paging.RemoteMediator<Key, Value>
   ↳ androidx.paging.ListenableFutureRemoteMediator

ListenableFuture-based compatibility wrapper around RemoteMediator's suspending APIs.

Summary

Public constructors

ListenableFuture-based compatibility wrapper around RemoteMediator's suspending APIs.

Public methods
suspend RemoteMediator.InitializeAction

Callback fired during initialization of a PagingData stream, before initial load.

open ListenableFuture<RemoteMediator.InitializeAction>

Callback fired during initialization of a PagingData stream, before initial load.

suspend RemoteMediator.MediatorResult
load(loadType: LoadType, state: PagingState<Key, Value>)

Implement this method to load additional remote data, which will then be stored for the PagingSource to access.

abstract ListenableFuture<RemoteMediator.MediatorResult>
loadFuture(loadType: LoadType, state: PagingState<Key, Value>)

Implement this method to load additional remote data, which will then be stored for the PagingSource to access.

Public constructors

<init>

ListenableFutureRemoteMediator()

ListenableFuture-based compatibility wrapper around RemoteMediator's suspending APIs.

Public methods

initialize

suspend fun initialize(): RemoteMediator.InitializeAction

Callback fired during initialization of a PagingData stream, before initial load.

This function runs to completion before any loading is performed.

Return
InitializeAction indicating the action to take after initialization:

initializeFuture

open fun initializeFuture(): ListenableFuture<RemoteMediator.InitializeAction>

Callback fired during initialization of a PagingData stream, before initial load.

This function runs to completion before any loading is performed.

Return
InitializeAction indicating the action to take after initialization:

load

suspend fun load(
    loadType: LoadType,
    state: PagingState<Key, Value>
): RemoteMediator.MediatorResult

Implement this method to load additional remote data, which will then be stored for the PagingSource to access. These loads take one of two forms:

  • type == LoadType.PREPEND / LoadType.APPEND The PagingSource has loaded a 'boundary' page, with a null adjacent key. This means this method should load additional remote data to append / prepend as appropriate, and store it locally.
  • type == LoadType.REFRESH The app (or initialize) has requested a remote refresh of data. This means the method should generally load remote data, and replace all local data.

The runtime of this method defines loading state behavior in boundary conditions, which affects e.g., LoadState callbacks registered to androidx.paging.PagingDataAdapter.

NOTE: A PagingSource.load request which is fulfilled by a page that hits a boundary condition in either direction will trigger this callback with LoadType.PREPEND or LoadType.APPEND or both. LoadType.REFRESH occurs as a result of initialize.

Parameters
loadType: LoadType LoadType of the boundary condition which triggered this callback.
state: PagingState<Key, Value> A copy of the state including the list of pages currently held in memory of the currently presented PagingData at the time of starting the load. E.g. for load(loadType = END), you can use the page or item at the end as input for what to load from the network.
Return
MediatorResult signifying what LoadState to be passed to the UI, and whether there's more data available.

loadFuture

abstract fun loadFuture(
    loadType: LoadType,
    state: PagingState<Key, Value>
): ListenableFuture<RemoteMediator.MediatorResult>

Implement this method to load additional remote data, which will then be stored for the PagingSource to access. These loads take one of two forms:

  • type == LoadType.PREPEND / LoadType.APPEND The PagingSource has loaded a 'boundary' page, with a null adjacent key. This means this method should load additional remote data to append / prepend as appropriate, and store it locally.
  • type == LoadType.REFRESH The app (or initialize) has requested a remote refresh of data. This means the method should generally load remote data, and replace all local data.

The runtime of this method defines loading state behavior in boundary conditions, which affects e.g., LoadState callbacks registered to androidx.paging.PagingDataAdapter.

NOTE: A PagingSource.load request which is fulfilled by a page that hits a boundary condition in either direction will trigger this callback with LoadType.PREPEND or LoadType.APPEND or both. LoadType.REFRESH occurs as a result of initialize.

Parameters
loadType: LoadType LoadType of the boundary condition which triggered this callback.
state: PagingState<Key, Value> A copy of the state including the list of pages currently held in memory of the currently presented PagingData at the time of starting the load. E.g. for load(loadType = END), you can use the page or item at the end as input for what to load from the network.
Return
MediatorResult signifying what LoadState to be passed to the UI, and whether there's more data available.