Support classes providing low level Leanback user interface building blocks: widgets and helpers.
The core interface to the developer’s model is the
androidx.leanback.widget.ObjectAdapter. It is similar to Adapter and the RecyclerView Adapter, but separates iterating items from presenting them as Views. Concrete implementations include
androidx.leanback.widget.CursorObjectAdapter, but a developer is free to use a subclass of an ObjectAdapter to iterate over any existing Object hierarchy.
androidx.leanback.widget.Presenter creates Views and binds data from an Object to those Views. This is the complementary piece to ObjectAdapter that corresponds to existing Android adapter classes. The benefit to separating out a Presenter is that we can use it to generate Views outside of the context of an adapter. For example, a UI may represent data from a single Object in several places at once. Each View that needs to be generated can be produced by a different Presenter, while the Object is retrieved from the ObjectAdapter once.
androidx.leanback.widget.PresenterSelectordetermines which Presenter to use for a given Object from an ObjectAdapter. Two common cases are when an ObjectAdapter uses the same View type for every element (
androidx.leanback.widget.SinglePresenterSelector), and when the Presenter is determined by the Java class of the element (
androidx.leanback.widget.ClassPresenterSelector). A developer is able to implement any selection logic as a PresenterSelector. For example, if all the elements of an ObjectAdapter have the same type, but certain elements are to be rendered using a 'promotional content' view in the developer’s application, the PresenterSelector may inspect the fields of each element before choosing the appropriate Presenter.
The basic navigation model for Leanback is that of a vertical list of rows, each of which may be a horizontal list of items. Therefore, Leanback uses ObjectAdapters both for defining the horizontal data items as well as the list of rows themselves.
Leanback defines a few basic data model classes for rows: the
androidx.leanback.widget.Row, which defines the abstract concept of a row with a header; and
androidx.leanback.widget.ListRow, a concrete Row implementation that uses an ObjectAdapter to present a horizontal list of items. The corresponding presenter for the ListRow is the
Abstract presenter class for rendering the header for a list of media items in a playlist.
An action contains one or two lines of text, an optional image and an optional id.
A card style layout that responds to certain state changes.
An abstract base class for vertically and horizontally scrolling lists.
A ViewGroup for managing focus behavior between overlapping views.
A ClassPresenterSelector selects a
Displays primary and secondary controls for a
Presenter that responsible to create a ImageView and bind to DetailsOverviewRow.
Subclass of Parallax object that tracks overview row's top and bottom edge in DetailsFragment or DetailsSupportFragment.
DividerPresenter provides a default presentation for
Used to represent divider in HeadersFragment.
Sets up the highlighting behavior when an item gains focus.
Helper class to assist delayed shared element activity transition for view created by
GuidanceStylist is used within a
A data class which represents an action within a .
A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment.
GuidedActionsStylist is used within a
Subclass of GuidedAction that can choose a date.
A header item describes the metadata of a
A helper class for showing a hover card view below a
Optional facet provided by RecyclerView.
ListRowHoverCardView contains a title and description.
Base class adapter to be used in leanback activities.
Interface for receiving notification when a child of this ViewGroup has been selected.
Used to represent content spanning full page.
Parallax tracks a list of dynamic
A PlaybackControlsRowPresenter renders a
Class to be implemented by app to provide seeking data and thumbnails to UI.
A PlaybackTransportRowPresenter renders a
A Presenter is used to generate
A PresenterSelector is used to obtain a
An abstract helper class that switches a view in its parent view using a
The base class for all rows.
RowHeaderView is a header text view.
A search widget containing a search orb and a text entry view.
EditText widget that monitors keyboard changes.
A widget that draws a search affordance, represented by a round background and an icon.
Used to represent section item in HeadersFragment.
Provides an SDK version-independent wrapper to support shadows, color overlays, and rounded corners.
ShadowOverlayHelper is a helper class for shadow, overlay color and rounded corner.
A subclass of
Helper for managing
Title view for a leanback fragment.
A presenter that renders objects in a