Android APIs
public class

VerticalGridPresenter

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

Class Overview

A presenter that renders objects in a vertical grid.

Summary

Nested Classes
class VerticalGridPresenter.ViewHolder  
Public Constructors
VerticalGridPresenter()
VerticalGridPresenter(int zoomFactor)
Public Methods
final boolean areChildRoundedCornersEnabled()
Returns true if rounded corners are enabled for children of this row.
final void enableChildRoundedCorners(boolean enable)
Enables or disabled rounded corners on children of this row.
int getNumberOfColumns()
Returns the number of columns in the vertical grid.
final OnItemClickedListener getOnItemClickedListener()
This method is deprecated. Use getOnItemViewClickedListener()
final OnItemSelectedListener getOnItemSelectedListener()
This method is deprecated. Use getOnItemViewSelectedListener()
final OnItemViewClickedListener getOnItemViewClickedListener()
Returns the item clicked listener.
final OnItemViewSelectedListener getOnItemViewSelectedListener()
Returns the item selected listener.
final boolean getShadowEnabled()
Returns true if child shadow is enabled.
boolean isUsingDefaultShadow()
Returns true if opticalBounds is supported (SDK >= 18) so that default shadow is applied to each individual child of VerticalGridView.
boolean isUsingZOrder()
Returns true if SDK >= L, where Z shadow is enabled so that Z order is enabled on each child of vertical grid.
void onBindViewHolder(Presenter.ViewHolder viewHolder, Object item)
Binds a View to an item.
final VerticalGridPresenter.ViewHolder onCreateViewHolder(ViewGroup parent)
Creates a new View.
void onUnbindViewHolder(Presenter.ViewHolder viewHolder)
Unbinds a View from an item.
void setNumberOfColumns(int numColumns)
Sets the number of columns in the vertical grid.
final void setOnItemClickedListener(OnItemClickedListener listener)
final void setOnItemSelectedListener(OnItemSelectedListener listener)
final void setOnItemViewClickedListener(OnItemViewClickedListener listener)
Sets the item clicked listener.
final void setOnItemViewSelectedListener(OnItemViewSelectedListener listener)
Sets the item selected listener.
final void setShadowEnabled(boolean enabled)
Enable or disable child shadow.
Protected Methods
VerticalGridPresenter.ViewHolder createGridViewHolder(ViewGroup parent)
Subclass may override this to inflate a different layout.
void initializeGridViewHolder(VerticalGridPresenter.ViewHolder vh)
Called after a VerticalGridPresenter.ViewHolder is created.
[Expand]
Inherited Methods
From class android.support.v17.leanback.widget.Presenter
From class java.lang.Object

Public Constructors

public VerticalGridPresenter ()

public VerticalGridPresenter (int zoomFactor)

Public Methods

public final boolean areChildRoundedCornersEnabled ()

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

public final void enableChildRoundedCorners (boolean enable)

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

public int getNumberOfColumns ()

Returns the number of columns in the vertical grid.

public final OnItemClickedListener getOnItemClickedListener ()

This method is deprecated.
Use getOnItemViewClickedListener()

Returns the item clicked listener.

public final OnItemSelectedListener getOnItemSelectedListener ()

This method is deprecated.
Use getOnItemViewSelectedListener()

Returns the item selected listener.

public final OnItemViewClickedListener getOnItemViewClickedListener ()

Returns the item clicked listener.

public final OnItemViewSelectedListener getOnItemViewSelectedListener ()

Returns the item selected listener.

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 boolean isUsingDefaultShadow ()

Returns true if opticalBounds is supported (SDK >= 18) so that default shadow is applied to each individual child of VerticalGridView. 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 vertical grid. If subclass returns false in isUsingDefaultShadow() and does not use Z-shadow on SDK >= L, it should override isUsingZOrder() return false.

public void onBindViewHolder (Presenter.ViewHolder viewHolder, Object item)

Binds a View to an item.

public final VerticalGridPresenter.ViewHolder onCreateViewHolder (ViewGroup parent)

Creates a new View.

public void onUnbindViewHolder (Presenter.ViewHolder viewHolder)

Unbinds a View from an item. Any expensive references may be released here, and any fields that are not bound for every item should be cleared here.

public void setNumberOfColumns (int numColumns)

Sets the number of columns in the vertical grid.

public final void setOnItemClickedListener (OnItemClickedListener listener)

This method is deprecated.
Use setOnItemViewClickedListener(OnItemViewClickedListener)

Sets the item clicked listener. OnItemClickedListener will override View.OnClickListener that item presenter sets during onCreateViewHolder(ViewGroup). So in general, developer should choose one of the listeners but not both.

public final void setOnItemSelectedListener (OnItemSelectedListener listener)

This method is deprecated.
Use setOnItemViewSelectedListener(OnItemViewSelectedListener)

Sets the item selected listener. Since this is a grid the row parameter is always null.

public final void setOnItemViewClickedListener (OnItemViewClickedListener listener)

Sets the item clicked listener. OnItemViewClickedListener will override View.OnClickListener that item presenter sets during onCreateViewHolder(ViewGroup). So in general, developer should choose one of the listeners but not both.

public final void setOnItemViewSelectedListener (OnItemViewSelectedListener listener)

Sets the item selected listener. Since this is a grid the row parameter is always null.

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 VerticalGridPresenter.ViewHolder createGridViewHolder (ViewGroup parent)

Subclass may override this to inflate a different layout.

protected void initializeGridViewHolder (VerticalGridPresenter.ViewHolder vh)

Called after a VerticalGridPresenter.ViewHolder is created. Subclasses may override this method and start by calling super.initializeGridViewHolder(ViewHolder).

Parameters
vh The ViewHolder to initialize for the vertical grid.