Elements
Menu toggle
latest: v0.3.7 GitHub

In Elements, the adapter is final and can’t be extended, as you would typically do with other list management library. The adapter acts as an orchestrator of the different, modular components that will be involved in displaying the list items.

Responsibilities

Describing what the adapter does will be helpful to introduce these components and for you to understand what the library can do. The adapter responsibilities are:

  • manage Presenters: for example, dispatches elements to the correct presenter [docs]
  • manage Sources: for example, creates a dependency tree among them, throwing in case of circular dependencies [docs]
  • manage Pages: for example, if pageSizeHint is specified, the adapter will automatically open a new page when the pageSizeHint-th element has been requested for the current page [docs]
  • manage Elements: for example, finds the correct presenter, and orders them based on the source behavior.
  • manage page updates: computes the difference between pages using DiffUtil, like the Paging library does.

As a side feature, the adapter will install an Animator as default item animator for your RecyclerView. See Animations for more informations.