Android APIs

Support classes providing low level Leanback user interface building blocks: widgets and helpers.

The core interface to the developer’s model is the ObjectAdapter. It is similar to Adapter and the RecyclerView Adapter, but separates iterating items from presenting them as Views. Concrete implementations include ArrayObjectAdapter and CursorObjectAdapter, but a developer is free to use a subclass of an ObjectAdapter to iterate over any existing Object hierarchy.

A 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 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 (SinglePresenterSelector), and when the Presenter is determined by the Java class of the element (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 Row, which defines the abstract concept of a row with a header; and ListRow, a concrete Row implementation that uses an ObjectAdapter to present a horizontal list of items. The corresponding presenter for the ListRow is the ListRowPresenter.

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


BrowseFrameLayout.OnChildFocusListener Interface for managing child focus in a BrowseFrameLayout. 
BrowseFrameLayout.OnFocusSearchListener Interface for selecting a focused view in a BrowseFrameLayout when the system focus finder couldn't find a view to focus. 
FacetProvider This is the query interface to supply optional features(aka facets) on an object without the need of letting the object to subclass or implement java interfaces. 
FacetProviderAdapter Optional interface that implemented by RecyclerView.Adapter to query FacetProvider for a given type within Adapter. 
FocusHighlight Interface for highlighting the item that has focus. 
FragmentAnimationProvider FragmentAnimationProvider supplies animations for use during a fragment's onCreateAnimator callback. 
OnActionClickedListener Interface for receiving notification when an Action is clicked. 
OnChildLaidOutListener Interface for receiving notification when a child of this ViewGroup has been laid out. 
OnChildSelectedListener This interface is deprecated. Use OnChildViewHolderSelectedListener  
OnItemViewClickedListener Interface for receiving notification when a item view holder is clicked. 
OnItemViewSelectedListener Interface for receiving notification when a row or item becomes selected. 
SearchBar.SearchBarListener Interface for receiving notification of search query changes. 
SearchEditText.OnKeyboardDismissListener Interface for receiving notification when the keyboard is dismissed. 
SpeechRecognitionCallback Interface for receiving notification that speech recognition should be initiated. 


AbstractDetailsDescriptionPresenter An abstract Presenter for rendering a detailed description of an item. 
AbstractDetailsDescriptionPresenter.ViewHolder The ViewHolder for the AbstractDetailsDescriptionPresenter
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. 
BaseCardView.LayoutParams Per-child layout information associated with BaseCardView. 
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. 
DetailsOverviewRow.Listener Listener for changes of DetailsOverviewRow. 
DetailsOverviewRowPresenter This class is deprecated. Use FullWidthDetailsOverviewRowPresenter  
DetailsOverviewRowPresenter.ViewHolder A ViewHolder for the DetailsOverviewRow. 
FocusHighlightHelper Sets up the highlighting behavior when an item gains focus. 
FullWidthDetailsOverviewRowPresenter Renders a DetailsOverviewRow to display an overview of an item. 
FullWidthDetailsOverviewRowPresenter.Listener Listeners for events on ViewHolder. 
FullWidthDetailsOverviewRowPresenter.ViewHolder A ViewHolder for the DetailsOverviewRow. 
FullWidthDetailsOverviewSharedElementHelper Helper class to assist delayed shared element activity transition for view created by FullWidthDetailsOverviewRowPresenter
GuidanceStylist GuidanceStylist is used within a GuidedStepFragment to display contextual information for the decision(s) required at that step. 
GuidanceStylist.Guidance A data class representing contextual information for a GuidedStepFragment
GuidedAction A data class which represents an action within a GuidedStepFragment
GuidedAction.Builder Builds a GuidedAction object. 
GuidedActionsStylist GuidedActionsStylist is used within a GuidedStepFragment to supply the right-side panel where users can take actions. 
GuidedActionsStylist.ViewHolder ViewHolder caches information about the action item layouts' subviews. 
HeaderItem A header item describes the metadata of a Row, such as a category of media items. 
HorizontalGridView A 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.Adapter or RecyclerView.ViewHolder for use in HorizontalGridView and VerticalGridView
ItemAlignmentFacet.ItemAlignmentDef Definition of an alignment position under a view. 
ItemBridgeAdapter Bridge from Presenter to RecyclerView.Adapter
ItemBridgeAdapter.AdapterListener Interface for listening to ViewHolder operations. 
ItemBridgeAdapter.ViewHolder ViewHolder for the ItemBridgeAdapter. 
ItemBridgeAdapter.Wrapper Interface for wrapping a view created by a Presenter into another view. 
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
ListRowPresenter.ViewHolder ViewHolder for the ListRowPresenter. 
ListRowView ListRowView is a ViewGroup which always contains a HorizontalGridView, and may optionally include a hover card. 
ObjectAdapter Base class adapter to be used in leanback activities. 
ObjectAdapter.DataObserver A DataObserver can be notified when an ObjectAdapter's underlying data changes. 
OnChildViewHolderSelectedListener Interface for receiving notification when a child of this ViewGroup has been selected. 
PlaybackControlsRow A Row of playback controls to be displayed by a PlaybackControlsRowPresenter
PlaybackControlsRow.ClosedCaptioningAction An action for displaying a CC (Closed Captioning) icon. 
PlaybackControlsRow.FastForwardAction An action displaying an icon for fast forward. 
PlaybackControlsRow.HighQualityAction An action for displaying a HQ (High Quality) icon. 
PlaybackControlsRow.MoreActions An action displaying an icon for "more actions". 
PlaybackControlsRow.MultiAction Base class for an action comprised of a series of icons. 
PlaybackControlsRow.PlayPauseAction An action displaying icons for play and pause. 
PlaybackControlsRow.RepeatAction An action for displaying three repeat states: none, one, or all. 
PlaybackControlsRow.RewindAction An action displaying an icon for rewind. 
PlaybackControlsRow.ShuffleAction An action for displaying a shuffle icon. 
PlaybackControlsRow.SkipNextAction An action displaying an icon for skip next. 
PlaybackControlsRow.SkipPreviousAction An action displaying an icon for skip previous. 
PlaybackControlsRow.ThumbsAction A base class for displaying a thumbs action. 
PlaybackControlsRow.ThumbsDownAction An action displaying an icon for thumbs down. 
PlaybackControlsRow.ThumbsUpAction An action displaying an icon for thumbs up. 
PlaybackControlsRowPresenter A PlaybackControlsRowPresenter renders a PlaybackControlsRow to display a series of playback control buttons. 
PlaybackControlsRowPresenter.ViewHolder A ViewHolder for the PlaybackControlsRow. 
Presenter A Presenter is used to generate Views and bind Objects to them on demand. 
Presenter.ViewHolder ViewHolder can be subclassed and used to cache any view accessors needed to improve binding performance (for example, results of findViewById) without needing to subclass a View. 
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
Row The base class for all rows. 
RowHeaderPresenter RowHeaderPresenter provides a default presentation for HeaderItem using a RowHeaderView
RowHeaderPresenter.ViewHolder A ViewHolder for the RowHeaderPresenter. 
RowHeaderView RowHeaderView is a header text view. 
RowPresenter An abstract Presenter that renders a Row
RowPresenter.ViewHolder A ViewHolder for a Row
SearchBar A search widget containing a search orb and a text entry view. 
SearchEditText EditText widget that monitors keyboard changes. 

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

SearchOrbView.Colors A set of colors used to display the search orb. 
ShadowOverlayContainer Provides an SDK version-independent wrapper to support shadows, color overlays, and rounded corners. 
SinglePresenterSelector A PresenterSelector that always returns the same Presenter
SparseArrayObjectAdapter An ObjectAdapter implemented with a SparseArray
SpeechOrbView A subclass of SearchOrbView that visualizes the state of an ongoing speech recognition. 
TitleHelper Helper for managing TitleView, including transitions and focus movement. 
TitleView Title view for a leanback fragment. 
VerticalGridPresenter A presenter that renders objects in a VerticalGridView
VerticalGridPresenter.ViewHolder ViewHolder for the VerticalGridPresenter. 
VerticalGridView A ViewGroup that shows items in a vertically scrolling list.