Android APIs
public class

ListRowPresenter

extends RowPresenter
java.lang.Object
   ↳ android.support.v17.leanback.widget.Presenter
     ↳ android.support.v17.leanback.widget.RowPresenter
       ↳ android.support.v17.leanback.widget.ListRowPresenter

Class Overview

ListRowPresenter renders ListRow using a HorizontalGridView hosted in a ListRowView.

Hover card

Optionally, setHoverCardPresenterSelector(PresenterSelector) can be used to display a view for the currently focused list item below the rendered list. This view is known as a hover card.

Selection animation

ListRowPresenter disables RowPresenter's default dimming effect and draw a dim overlay on top of each individual child items. Subclass may override and disable isUsingDefaultListSelectEffect() and write its own dim effect in onSelectLevelChanged(RowPresenter.ViewHolder).

Shadow

ListRowPresenter applies a default shadow to child of each view. Call setShadowEnabled(boolean) to disable shadow. Subclass may override and return false in isUsingDefaultShadow() and replace with its own shadow implementation.

Summary

Nested Classes
class ListRowPresenter.ViewHolder  
[Expand]
Inherited Constants
From class android.support.v17.leanback.widget.RowPresenter
Public Constructors
ListRowPresenter()
Constructs a ListRowPresenter with defaults.
ListRowPresenter(int zoomFactor)
Constructs a ListRowPresenter with the given parameters.
Public Methods
final boolean areChildRoundedCornersEnabled()
Returns true if rounded corners are enabled for children of this row.
boolean canDrawOutOfBounds()
Return true if the Row view can draw outside its bounds.
final void enableChildRoundedCorners(boolean enable)
Enables or disabled rounded corners on children of this row.
void freeze(RowPresenter.ViewHolder holder, boolean freeze)
Freeze/Unfreeze the row, typically used when transition starts/ends.
int getExpandedRowHeight()
Returns the expanded row height for rows created by this Presenter.
final PresenterSelector getHoverCardPresenterSelector()
Get PresenterSelector used for showing a select object in a hover card.
int getRecycledPoolSize(Presenter presenter)
Returns the recycled pool size for the given presenter.
int getRowHeight()
Returns the row height for list rows created by this Presenter.
final boolean getShadowEnabled()
Returns true if child shadow is enabled.
final int getZoomFactor()
Returns the zoom factor used for focus highlighting.
boolean isUsingDefaultListSelectEffect()
Returns true so that default select effect is applied to each individual child of HorizontalGridView.
final boolean isUsingDefaultSelectEffect()
ListRowPresenter overrides the default select effect of RowPresenter and return false.
boolean isUsingDefaultShadow()
Returns true if SDK >= 18, where default shadow is applied to each individual child of HorizontalGridView.
boolean isUsingZOrder()
Returns true if SDK >= L, where Z shadow is enabled so that Z order is enabled on each child of horizontal list.
void setEntranceTransitionState(RowPresenter.ViewHolder holder, boolean afterEntrance)
Change visibility of views, entrance transition will be run against the views that change visibilities.
void setExpandedRowHeight(int rowHeight)
Sets the expanded row height for rows created by this Presenter.
final void setHoverCardPresenterSelector(PresenterSelector selector)
Set PresenterSelector used for showing a select object in a hover card.
void setRecycledPoolSize(Presenter presenter, int size)
Sets the recycled pool size for the given presenter.
void setRowHeight(int rowHeight)
Sets the row height for rows created by this Presenter.
final void setShadowEnabled(boolean enabled)
Enable or disable child shadow.
Protected Methods
RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent)
Called to create a ViewHolder object for a Row.
void dispatchItemSelectedListener(RowPresenter.ViewHolder holder, boolean selected)
Dispatch item selected event using current selected item in the HorizontalGridView.
void initializeRowViewHolder(RowPresenter.ViewHolder holder)
Called after a RowPresenter.ViewHolder is created for a Row.
void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item)
void onRowViewExpanded(RowPresenter.ViewHolder holder, boolean expanded)
Subclass may override this to respond to expanded state changes of a Row.
void onRowViewSelected(RowPresenter.ViewHolder holder, boolean selected)
Subclass may override this to respond to selected state changes of a Row.
void onSelectLevelChanged(RowPresenter.ViewHolder holder)
Applies select level to header and draw a default color dim over each child of HorizontalGridView.
void onUnbindRowViewHolder(RowPresenter.ViewHolder holder)
[Expand]
Inherited Methods
From class android.support.v17.leanback.widget.RowPresenter
From class android.support.v17.leanback.widget.Presenter
From class java.lang.Object

Public Constructors

public ListRowPresenter ()

Constructs a ListRowPresenter with defaults. Uses ZOOM_FACTOR_MEDIUM for focus zooming.

public ListRowPresenter (int zoomFactor)

Constructs a ListRowPresenter with the given parameters.

Parameters
zoomFactor Controls the zoom factor used when an item view is focused. One of ZOOM_FACTOR_NONE, ZOOM_FACTOR_SMALL, ZOOM_FACTOR_XSMALL, ZOOM_FACTOR_MEDIUM, ZOOM_FACTOR_LARGE

Public Methods

public final boolean areChildRoundedCornersEnabled ()

Returns true if rounded corners are enabled for children of this row.

public boolean canDrawOutOfBounds ()

Return true if the Row view can draw outside its bounds.

public final void enableChildRoundedCorners (boolean enable)

Enables or disabled rounded corners on children of this row. Supported on Android SDK >= L.

public void freeze (RowPresenter.ViewHolder holder, boolean freeze)

Freeze/Unfreeze the row, typically used when transition starts/ends. This method is called by fragment, app should not call it directly.

public int getExpandedRowHeight ()

Returns the expanded row height for rows created by this Presenter.

public final PresenterSelector getHoverCardPresenterSelector ()

Get PresenterSelector used for showing a select object in a hover card.

public int getRecycledPoolSize (Presenter presenter)

Returns the recycled pool size for the given presenter.

public int getRowHeight ()

Returns the row height for list rows created by this Presenter.

public final boolean getShadowEnabled ()

Returns true if child shadow is enabled. This is not only for enable/disable default shadow implementation but also subclass must respect this flag.

public final int getZoomFactor ()

Returns the zoom factor used for focus highlighting.

public boolean isUsingDefaultListSelectEffect ()

Returns true so that default select effect is applied to each individual child of HorizontalGridView. Subclass may return false to disable the default implementation.

public final boolean isUsingDefaultSelectEffect ()

ListRowPresenter overrides the default select effect of RowPresenter and return false.

public boolean isUsingDefaultShadow ()

Returns true if SDK >= 18, where default shadow is applied to each individual child of HorizontalGridView. Subclass may return false to disable.

public boolean isUsingZOrder ()

Returns true if SDK >= L, where Z shadow is enabled so that Z order is enabled on each child of horizontal list. If subclass returns false in isUsingDefaultShadow() and does not use Z-shadow on SDK >= L, it should override isUsingZOrder() return false.

public void setEntranceTransitionState (RowPresenter.ViewHolder holder, boolean afterEntrance)

Change visibility of views, entrance transition will be run against the views that change visibilities. Subclass may override and begin with calling super.setEntranceTransitionState(). This method is called by fragment, app should not call it directly.

public void setExpandedRowHeight (int rowHeight)

Sets the expanded row height for rows created by this Presenter. If not set, expanded rows have the same height as unexpanded rows.

Parameters
rowHeight The row height in to use when the row is expanded, in pixels, or WRAP_CONTENT, or 0 to use the default.

public final void setHoverCardPresenterSelector (PresenterSelector selector)

Set PresenterSelector used for showing a select object in a hover card.

public void setRecycledPoolSize (Presenter presenter, int size)

Sets the recycled pool size for the given presenter.

public void setRowHeight (int rowHeight)

Sets the row height for rows created by this Presenter. Rows created before calling this method will not be updated.

Parameters
rowHeight Row height in pixels, or WRAP_CONTENT, or 0 to use the default height.

public final void setShadowEnabled (boolean enabled)

Enable or disable child shadow. This is not only for enable/disable default shadow implementation but also subclass must respect this flag.

Protected Methods

protected RowPresenter.ViewHolder createRowViewHolder (ViewGroup parent)

Called to create a ViewHolder object for a Row. Subclasses will override this method to return a different concrete ViewHolder object.

Parameters
parent The parent View for the Row's view holder.
Returns
  • A ViewHolder for the Row's View.

protected void dispatchItemSelectedListener (RowPresenter.ViewHolder holder, boolean selected)

Dispatch item selected event using current selected item in the HorizontalGridView. The method should only be called from onRowViewSelected().

protected void initializeRowViewHolder (RowPresenter.ViewHolder holder)

Called after a RowPresenter.ViewHolder is created for a Row. Subclasses may override this method and start by calling super.initializeRowViewHolder(ViewHolder).

Parameters
holder The ViewHolder to initialize for the Row.

protected void onBindRowViewHolder (RowPresenter.ViewHolder holder, Object item)

protected void onRowViewExpanded (RowPresenter.ViewHolder holder, boolean expanded)

Subclass may override this to respond to expanded state changes of a Row. The default implementation will hide/show the header view. Subclasses may make visual changes to the Row View but must not create animation on the Row view.

protected void onRowViewSelected (RowPresenter.ViewHolder holder, boolean selected)

Subclass may override this to respond to selected state changes of a Row. Subclass may make visual changes to Row view but must not create animation on the Row view.

protected void onSelectLevelChanged (RowPresenter.ViewHolder holder)

Applies select level to header and draw a default color dim over each child of HorizontalGridView.

Subclass may override this method. A subclass needs to call super.onSelectLevelChanged() for applying header select level and optionally applying a default select level to each child view of HorizontalGridView if isUsingDefaultListSelectEffect() is true. Subclass may override isUsingDefaultListSelectEffect() to return false and deal with the individual item select level by itself.

protected void onUnbindRowViewHolder (RowPresenter.ViewHolder holder)