PrefetchScheduler

Interface

Common

Deprecated Customization of PrefetchScheduler is no longer supported. LazyLayout will attach an appropriate scheduler internally. If you needed to customize it please file a Feature Request.

@ExperimentalFoundationApi
interface PrefetchScheduler

Implementations of this interface accept prefetch requests via schedulePrefetch and decide when to execute them in a way that will have minimal impact on user experience, e.g. during frame idle time.

Requests should be executed by invoking PrefetchRequest.execute. The implementation of PrefetchRequest.execute will return false when all work for that request is done, or true when it still has more to do but doesn't think it can complete it within PrefetchRequestScope.availableTimeNanos.

Functions

fun schedulePrefetch(prefetchRequest: PrefetchRequest)

Accepts a prefetch request. Implementations should find a time to execute them which will have minimal impact on user experience.