epoxy-adapter / com.airbnb.epoxy / EpoxyRecyclerView / addPreloader

addPreloader

fun <T : EpoxyModel<*>, U : ViewMetadata?, P : PreloadRequestHolder> addPreloader(maxPreloadDistance: Int = 3, errorHandler: PreloadErrorHandler, preloader: EpoxyModelPreloader<T, U, P>, requestHolderFactory: () -> P): Unit

Setup a preloader to fetch content for a model's view before it is bound. This can be called multiple times if you would like to add separate preloaders for different models or content types.

Preloaders are automatically attached and run, and are updated if the adapter changes.

Parameters

maxPreloadDistance - How many items to prefetch ahead of the last bound item

errorHandler - Called when the preloader encounters an exception. We recommend throwing an exception in debug builds, and logging an error in production.

preloader - Describes how view content for the EpoxyModel should be preloaded

requestHolderFactory - Should create and return a new PreloadRequestHolder each time it is invoked