-
public abstract class EpoxyModelPreloader<T extends EpoxyModel<?>, U extends ViewMetadata, P extends PreloadRequestHolder>Describes how view content for an EpoxyModel should be preloaded.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classEpoxyModelPreloader.Companion
-
Constructor Summary
Constructors Constructor Description EpoxyModelPreloader(Class<T> modelType, List<Integer> preloadableViewIds)
-
Method Summary
Modifier and Type Method Description final Class<T>getModelType()final List<Integer>getPreloadableViewIds()A list of view ids, one for each view that should be preloaded. ObjectviewSignature(T epoxyModel)An optional signature to differentiate views within the same model. abstract UbuildViewMetadata(View view)Provide optional metadata about a view. abstract UnitstartPreload(T epoxyModel, P preloadTarget, ViewData<U> viewData)Start a preload request with the given target. -
-
Method Detail
-
getModelType
final Class<T> getModelType()
-
getPreloadableViewIds
final List<Integer> getPreloadableViewIds()
A list of view ids, one for each view that should be preloaded. This should be left empty if the EpoxyModel's type uses the Preloadable interface.
-
viewSignature
Object viewSignature(T epoxyModel)
An optional signature to differentiate views within the same model. This is useful if your EpoxyModel can contain varying amounts of preloadable views, or preloadable views of varying sizes.
By default the model's class, span size, and layout resource, are used to differentiate views. This signature allows additional differentiation. For example, if your EpoxyModel shows an preloadable view that varies between portrait or landscape, this orientation will affect the view dimensions. In this case you could return a boolean here to differentiate the two cases so that the preloaded data has the correct orientation.
The returned object can be anything, but it must implement Object.hashCode
-
buildViewMetadata
abstract U buildViewMetadata(View view)
Provide optional metadata about a view. This can be used in EpoxyModelPreloader.buildRequest
A preload request works best if it exactly matches the actual request (in order to match cache keys exactly) Things such as request transformations, thumbnails, or crop type can affect the cache key. If your preloadable view is configurable you can capture those options via this metadata.
-
startPreload
abstract Unit startPreload(T epoxyModel, P preloadTarget, ViewData<U> viewData)
Start a preload request with the given target.
- Parameters:
epoxyModel- The EpoxyModel whose content is being preloaded.preloadTarget- The target to ues to create and store the request.viewData- Information about the view that will hold the preloaded content.
-
-
-
-