androidx.leanback.widget

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.ArrayObjectAdapter and androidx.leanback.widget.CursorObjectAdapter, but a developer is free to use a subclass of an ObjectAdapter to iterate over any existing Object hierarchy.

A 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.

A androidx.leanback.widget.PresenterSelector determines 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 androidx.leanback.widget.ListRowPresenter.

Other types of Rows and corresponding RowPresenters are provided; however the application may define a custom subclass of androidx.leanback.widget.Row and androidx.leanback.widget.RowPresenter.

Classes

AbstractDetailsDescriptionPresenter

An abstract Presenter for rendering a detailed description of an item.

AbstractMediaItemPresenter

Abstract Presenter class for rendering media items in a playlist format.

AbstractMediaListHeaderPresenter

Abstract presenter class for rendering the header for a list of media items in a playlist.

Action

An action contains one or two lines of text, an optional image and an optional id.

ArrayObjectAdapter

An ObjectAdapter implemented with an ArrayList.

BaseCardView

A card style layout that responds to certain state changes.

BaseGridView

An abstract base class for vertically and horizontally scrolling lists.

BrowseFrameLayout

A ViewGroup for managing focus behavior between overlapping views.

ClassPresenterSelector

A ClassPresenterSelector selects a Presenter based on the item's Java class.

ControlButtonPresenterSelector

Displays primary and secondary controls for a PlaybackControlsRow.

CursorObjectAdapter

An ObjectAdapter implemented with a Cursor.

DetailsOverviewLogoPresenter

Presenter that responsible to create a ImageView and bind to DetailsOverviewRow.

DetailsOverviewRow

An overview Row for a details fragment.

DetailsOverviewRowPresenter

Renders a DetailsOverviewRow to display an overview of an item.

DetailsParallax

Subclass of Parallax object that tracks overview row's top and bottom edge in DetailsFragment or DetailsSupportFragment.

DiffCallback

Callback that informs ArrayObjectAdapter how to compute list updates when using DiffUtil in ArrayObjectAdapter#setItems(List, * DiffCallback) method.

DividerPresenter

DividerPresenter provides a default presentation for DividerRow in HeadersFragment.

DividerRow

Used to represent divider in HeadersFragment.

FocusHighlightHelper

Sets up the highlighting behavior when an item gains focus.

FullWidthDetailsOverviewRowPresenter

Renders a DetailsOverviewRow to display an overview of an item.

FullWidthDetailsOverviewSharedElementHelper

Helper class to assist delayed shared element activity transition for view created by FullWidthDetailsOverviewRowPresenter.

GuidanceStylist

GuidanceStylist is used within a androidx.leanback.app.GuidedStepFragment to display contextual information for the decision(s) required at that step.

GuidedAction

A data class which represents an action within a .

GuidedActionDiffCallback

DiffCallback used for GuidedActions, see .

GuidedActionEditText

A custom EditText that satisfies the IME key monitoring requirements of GuidedStepFragment.

GuidedActionsStylist

GuidedActionsStylist is used within a androidx.leanback.app.GuidedStepFragment to supply the right-side panel where users can take actions.

GuidedDatePickerAction

Subclass of GuidedAction that can choose a date.

HeaderItem

A header item describes the metadata of a Row, such as a category of media items.

HorizontalGridView

A android.view.ViewGroup that shows items in a horizontal scrolling list.

HorizontalHoverCardSwitcher

A helper class for showing a hover card view below a HorizontalGridView.

ImageCardView

A subclass of BaseCardView with an ImageView as its main region.

ItemAlignmentFacet

Optional facet provided by RecyclerView.

ItemBridgeAdapter

Bridge from Presenter to RecyclerView.

ItemBridgeAdapterShadowOverlayWrapper

A wrapper class working with ItemBridgeAdapter to wrap item view in a ShadowOverlayContainer.

ListRow

A Row composed of a optional HeaderItem, and an ObjectAdapter describing the items in the list.

ListRowHoverCardView

ListRowHoverCardView contains a title and description.

ListRowPresenter

ListRowPresenter renders ListRow using a HorizontalGridView hosted in a ListRowView.

ListRowView

ListRowView is a android.view.ViewGroup which always contains a HorizontalGridView, and may optionally include a hover card.

ObjectAdapter

Base class adapter to be used in leanback activities.

OnChildViewHolderSelectedListener

Interface for receiving notification when a child of this ViewGroup has been selected.

PageRow

Used to represent content spanning full page.

Parallax

Parallax tracks a list of dynamic Propertys typically representing foreground UI element positions on screen.

ParallaxEffect

ParallaxEffect class drives changes in ParallaxTarget in response to changes in variables defined in Parallax.

ParallaxTarget

ParallaxTarget is responsible for updating the target through the #update(float) method or the #directUpdate(Number) method when #isDirectMapping() is true.

PlaybackControlsRow

A Row of playback controls to be displayed by a PlaybackControlsRowPresenter.

PlaybackControlsRowPresenter

A PlaybackControlsRowPresenter renders a PlaybackControlsRow to display a series of playback control buttons.

PlaybackRowPresenter

Subclass of RowPresenter that can define the desired behavior when the view reappears.

PlaybackSeekDataProvider

Class to be implemented by app to provide seeking data and thumbnails to UI.

PlaybackTransportRowPresenter

A PlaybackTransportRowPresenter renders a PlaybackControlsRow to display a series of playback control buttons.

Presenter

A Presenter is used to generate Views and bind Objects to them on demand.

PresenterSelector

A PresenterSelector is used to obtain a Presenter for a given Object.

PresenterSwitcher

An abstract helper class that switches a view in its parent view using a PresenterSelector.

RecyclerViewParallax

Implementation of Parallax class for RecyclerView.

Row

The base class for all rows.

RowHeaderPresenter

RowHeaderPresenter provides a default presentation for HeaderItem using a RowHeaderView and optionally a TextView for description.

RowHeaderView

RowHeaderView is a header text view.

RowPresenter

An abstract Presenter that renders an Object in RowsFragment, the object can be subclass Row or a generic one.

SearchBar

A search widget containing a search orb and a text entry view.

SearchEditText

EditText widget that monitors keyboard changes.

SearchOrbView

A widget that draws a search affordance, represented by a round background and an icon.

SectionRow

Used to represent section item in HeadersFragment.

ShadowOverlayContainer

Provides an SDK version-independent wrapper to support shadows, color overlays, and rounded corners.

ShadowOverlayHelper

ShadowOverlayHelper is a helper class for shadow, overlay color and rounded corner.

SinglePresenterSelector

A PresenterSelector that always returns the same Presenter.

SparseArrayObjectAdapter

An ObjectAdapter implemented with a android.util.SparseArray.

SpeechOrbView

A subclass of SearchOrbView that visualizes the state of an ongoing speech recognition.

TitleHelper

Helper for managing androidx.leanback.widget.TitleView, including transitions and focus movement.

TitleView

Title view for a leanback fragment.

TitleViewAdapter

This class allows a customized widget class to implement TitleViewAdapter.Provider and expose TitleViewAdapter methods to containing fragment (e.

VerticalGridPresenter

A presenter that renders objects in a VerticalGridView.

VerticalGridView

A android.view.ViewGroup that shows items in a vertically scrolling list.