java.lang.Object | ||
↳ | android.support.v17.leanback.widget.Presenter | |
↳ | android.support.v17.leanback.widget.RowPresenter |
Known Direct Subclasses |
An abstract Presenter
that renders a Row
.
RowPresenter.ViewHolder
and override createRowViewHolder(ViewGroup)
and initializeRowViewHolder(ViewHolder)
. The subclass must use layout id
"row_content" for the widget that will be aligned to the title of any HeadersFragment
that may exist in the parent fragment. RowPresenter contains an optional and
replaceable RowHeaderPresenter
that renders the header. You can disable
the default rendering or replace the Presenter with a new header presenter
by calling setHeaderPresenter(RowHeaderPresenter)
.
setRowViewSelected(Presenter.ViewHolder, boolean)
. The event
is triggered immediately when there is a row selection change before the selection
animation is started.
Subclasses of RowPresenter may override onRowViewSelected(ViewHolder, boolean)
.
setRowViewExpanded(Presenter.ViewHolder, boolean)
.
The event is triggered immediately before the expand animation is started.
Subclasses of RowPresenter may override onRowViewExpanded(ViewHolder, boolean)
.
OnItemSelectedListener
and OnItemClickedListener
.
If a subclass wants to add its own View.OnFocusChangeListener
or
View.OnClickListener
, it must do that in createRowViewHolder(ViewGroup)
to be properly chained by the library. Adding View listeners after
createRowViewHolder(ViewGroup)
is undefined and may result in
incorrect behavior by the library's listeners.
When a user scrolls through rows, a fragment will initiate animation and call
setSelectLevel(Presenter.ViewHolder, float)
with float value between
0 and 1. By default, the RowPresenter draws a dim overlay on top of the row
view for views that are not selected. Subclasses may override this default effect
by having isUsingDefaultSelectEffect()
return false and overriding
onSelectLevelChanged(ViewHolder)
to apply a different selection effect.
Call setSelectEffectEnabled(boolean)
to enable/disable the select effect,
This will not only enable/disable the default dim effect but also subclasses must
respect this flag as well.
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
RowPresenter.ViewHolder | A view holder for a Row . |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return true if the Row view can draw outside its bounds.
| |||||||||||
Get the Presenter used for rendering the header, or null if none has been
set.
| |||||||||||
Get the listener for item click events.
| |||||||||||
Get the listener for item or row selection.
| |||||||||||
Get the
RowPresenter.ViewHolder from the given Presenter
ViewHolder. | |||||||||||
Returns true if the row selection effect is enabled.
| |||||||||||
Get the current select level.
| |||||||||||
Return whether this RowPresenter is using the default dimming effect
provided by the library.
| |||||||||||
Binds a
View to an item. | |||||||||||
Creates a new
View . | |||||||||||
Unbinds a
View from an item. | |||||||||||
Called when a view created by this presenter has been attached to a window.
| |||||||||||
Called when a view created by this presenter has been detached from its window.
| |||||||||||
Set the Presenter used for rendering the header.
| |||||||||||
Set the listener for item click events.
| |||||||||||
Set the listener for item or row selection.
| |||||||||||
Set the expanded state of a Row view.
| |||||||||||
Set the selected state of a Row view.
| |||||||||||
Enables or disables the row selection effect.
| |||||||||||
Set the current select level to a value between 0 (unselected) and 1 (selected).
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Called to create a ViewHolder object for a Row.
| |||||||||||
Called after a
RowPresenter.ViewHolder is created for a Row. | |||||||||||
Subclass may override this to respond to expanded state changes of a Row.
| |||||||||||
Subclass may override this to respond to selected state changes of a Row.
| |||||||||||
Callback when select level is changed.
| |||||||||||
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
android.support.v17.leanback.widget.Presenter
| |||||||||||
From class
java.lang.Object
|
Return true if the Row view can draw outside its bounds.
Get the Presenter used for rendering the header, or null if none has been set.
Get the listener for item click events.
Get the listener for item or row selection.
Get the RowPresenter.ViewHolder
from the given Presenter
ViewHolder.
Returns true if the row selection effect is enabled. This value not only determines whether the default dim implementation is used, but subclasses must also respect this flag.
Get the current select level. The value will be between 0 (unselected) and 1 (selected).
Return whether this RowPresenter is using the default dimming effect
provided by the library. Subclasses may(most likely) return false and
override onSelectLevelChanged(ViewHolder)
.
Binds a View
to an item.
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.
Called when a view created by this presenter has been attached to a window.
This can be used as a reasonable signal that the view is about to be seen
by the user. If the adapter previously freed any resources in
onViewDetachedFromWindow(ViewHolder)
those resources should be restored here.
holder | Holder of the view being attached |
---|
Called when a view created by this presenter has been detached from its window.
Becoming detached from the window is not necessarily a permanent condition; the consumer of an presenter's views may choose to cache views offscreen while they are not visible, attaching an detaching them as appropriate.
holder | Holder of the view being detached |
---|
Set the Presenter used for rendering the header. Can be null to disable header rendering. The method must be called before creating any Row Views.
Set the listener for item click events. A RowPresenter does not use this
listener, but a subclass may fire an item click event if it has the concept
of an item. The OnItemClickedListener
will override any
View.OnClickListener
that an item's Presenter sets during
onCreateViewHolder(ViewGroup)
. So in general, you
should choose to use an OnItemClickedListener or a View.OnClickListener
, but not both.
Set the listener for item or row selection. A RowPresenter fires a row
selection event with a null item. Subclasses (e.g. ListRowPresenter
)
can fire a selection event with the selected item.
Set the expanded state of a Row view.
holder | The Row ViewHolder to set expanded state on. |
---|---|
expanded | True if the Row is expanded, false otherwise. |
Set the selected state of a Row view.
holder | The Row ViewHolder to set expanded state on. |
---|---|
selected | True if the Row is expanded, false otherwise. |
Enables or disables the row selection effect. This will not only affect the default dim effect, but subclasses must respect this flag as well.
Set the current select level to a value between 0 (unselected) and 1 (selected).
Subclasses may override onSelectLevelChanged(ViewHolder)
to
respond to changes in the selected level.
Called to create a ViewHolder object for a Row. Subclasses will override this method to return a different concrete ViewHolder object.
parent | The parent View for the Row's view holder. |
---|
Called after a RowPresenter.ViewHolder
is created for a Row.
Subclasses may override this method and start by calling
super.initializeRowViewHolder(ViewHolder).
vh | The ViewHolder to initialize for the Row. |
---|
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.
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.
Callback when select level is changed. The default implementation applies
the select level to setSelectLevel(RowHeaderPresenter.ViewHolder, float)
when getSelectEffectEnabled()
is true. Subclasses may override
this function and implement a different select effect. In this case, you
should also override isUsingDefaultSelectEffect()
to disable
the default dimming effect applied by the library.