LazyListUpdateProcessor

abstract class LazyListUpdateProcessor<V : Any, W : Any>

Our lazy layouts can display arbitrarily large datasets. Instead of loading them all eagerly (which would be extremely slow!), it maintains a window of loaded items.

As the user scrolls, the lazy layout shifts (and potentially resizes) its window in an attempt to maintain an illusion that all data is always loaded. If the user scrolls beyond what is loaded, a placeholder is displayed until the row is loaded.

The net effect is that there are two windows into the dataset:

  • the window of what is loaded

  • the window of what the user is looking at

To maintain the illusion that everything is loaded, the loaded data window should always contain the visible window.

This class keeps track of the two windows, and of firing precise updates as the window changes.

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
class Binding<V : Any, W : Any>

Binds a UI-managed view to model-managed content.

Properties

Link copied to clipboard
Link copied to clipboard

Changes to this list are collected and processed in batch once all changes are received.

Link copied to clipboard

We expect placeholders to be added early and to never change.

Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
Link copied to clipboard
fun getOrCreateView(index: Int, createView: (binding: LazyListUpdateProcessor.Binding<V, W>) -> V): V
Link copied to clipboard
fun itemsAfter(itemsAfter: Int)
Link copied to clipboard
fun itemsBefore(itemsBefore: Int)
Link copied to clipboard