belongs to Maven artifact com.android.support:leanback-v17:28.0.0-alpha1
ListRowPresenter
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 |
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.
Row selection animation
ListRowPresenter disablesRowPresenter
's default full row dimming effect and draws
a dim overlay on each child individually. A subclass may disable the overlay on each child
by overriding isUsingDefaultListSelectEffect()
to return false and write its own child
dim effect in applySelectLevelToChild(ViewHolder, View)
.
Shadow
ListRowPresenter applies a default shadow to each child view. CallsetShadowEnabled(boolean)
to disable shadows. A subclass may override and return
false in isUsingDefaultShadow()
and replace with its own shadow implementation.
Summary
Nested classes | |
---|---|
class |
ListRowPresenter.SelectItemViewHolderTask
A task on the ListRowPresenter.ViewHolder that can select an item by position in the HorizontalGridView and perform an optional item task on it. |
class |
ListRowPresenter.ViewHolder
ViewHolder for the ListRowPresenter. |
Inherited constants |
---|
From
class
android.support.v17.leanback.widget.RowPresenter
|
Public constructors | |
---|---|
ListRowPresenter()
Constructs a ListRowPresenter with defaults. |
|
ListRowPresenter(int focusZoomFactor)
Constructs a ListRowPresenter with the given parameters. |
|
ListRowPresenter(int focusZoomFactor, boolean useFocusDimmer)
Constructs a ListRowPresenter with the given parameters. |
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. |
void
|
freeze(RowPresenter.ViewHolder holder, boolean freeze)
Freezes/unfreezes the row, typically used when a transition starts/ends. |
int
|
getExpandedRowHeight()
Returns the expanded row height for rows created by this Presenter. |
final
int
|
getFocusZoomFactor()
Returns the zoom factor used for focus highlighting. |
final
PresenterSelector
|
getHoverCardPresenterSelector()
Returns the |
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()
This method was deprecated
in API level 22.1.0.
use |
final
boolean
|
isFocusDimmerUsed()
Returns true if the focus dimmer is used for focus highlighting; false otherwise. |
final
boolean
|
isKeepChildForeground()
Returns true if keeps foreground of child of this row, false otherwise. |
boolean
|
isUsingDefaultListSelectEffect()
Returns true so that default select effect is applied to each individual
child of |
final
boolean
|
isUsingDefaultSelectEffect()
ListRowPresenter overrides the default select effect of |
boolean
|
isUsingDefaultShadow()
Default implementation returns true if SDK version >= 21, shadow (either static or z-order
based) will be applied to each individual child of |
boolean
|
isUsingOutlineClipping(Context context)
Returns true if leanback view outline is enabled on the system or false otherwise. |
boolean
|
isUsingZOrder(Context context)
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)
Changes the visibility of views. |
void
|
setExpandedRowHeight(int rowHeight)
Sets the expanded row height for rows created by this Presenter. |
final
void
|
setHoverCardPresenterSelector(PresenterSelector selector)
Sets the |
final
void
|
setKeepChildForeground(boolean keep)
When ListRowPresenter applies overlay color on the child, it may change child's foreground Drawable. |
void
|
setNumRows(int numRows)
Sets the numbers of rows for rendering the list of items. |
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)
Enables or disables child shadow. |
Protected methods | |
---|---|
void
|
applySelectLevelToChild(ListRowPresenter.ViewHolder rowViewHolder, View childView)
Applies select level to a child. |
RowPresenter.ViewHolder
|
createRowViewHolder(ViewGroup parent)
Called to create a ViewHolder object for a Row. |
ShadowOverlayHelper.Options
|
createShadowOverlayOptions()
Create ShadowOverlayHelper Options. |
void
|
dispatchItemSelectedListener(RowPresenter.ViewHolder holder, boolean selected)
Dispatch item selected event using current selected item in the |
void
|
initializeRowViewHolder(RowPresenter.ViewHolder holder)
Called after a |
void
|
onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item)
Binds the given row object to the given ViewHolder. |
void
|
onRowViewExpanded(RowPresenter.ViewHolder holder, boolean expanded)
Called when the row view's expanded state changes. |
void
|
onRowViewSelected(RowPresenter.ViewHolder holder, boolean selected)
Called when the given row view changes selection state. |
void
|
onSelectLevelChanged(RowPresenter.ViewHolder holder)
Applies select level to header and draws a default color dim over each child
of |
void
|
onUnbindRowViewHolder(RowPresenter.ViewHolder holder)
Unbinds the given ViewHolder. |
Inherited methods | |
---|---|
From
class
android.support.v17.leanback.widget.RowPresenter
| |
From
class
android.support.v17.leanback.widget.Presenter
| |
From
class
java.lang.Object
| |
From
interface
android.support.v17.leanback.widget.FacetProvider
|
Public constructors
ListRowPresenter
ListRowPresenter ()
Constructs a ListRowPresenter with defaults.
Uses ZOOM_FACTOR_MEDIUM
for focus zooming and
disabled dimming on focus.
ListRowPresenter
ListRowPresenter (int focusZoomFactor)
Constructs a ListRowPresenter with the given parameters.
Parameters | |
---|---|
focusZoomFactor |
int : 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
Dimming on focus defaults to disabled.
|
ListRowPresenter
ListRowPresenter (int focusZoomFactor, boolean useFocusDimmer)
Constructs a ListRowPresenter with the given parameters.
Parameters | |
---|---|
focusZoomFactor |
int : 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 |
useFocusDimmer |
boolean : determines if the FocusHighlighter will use the dimmer
|
Public methods
areChildRoundedCornersEnabled
boolean areChildRoundedCornersEnabled ()
Returns true if rounded corners are enabled for children of this row.
Returns | |
---|---|
boolean |
enableChildRoundedCorners
void enableChildRoundedCorners (boolean enable)
Enables or disabled rounded corners on children of this row. Supported on Android SDK >= L.
Parameters | |
---|---|
enable |
boolean |
freeze
void freeze (RowPresenter.ViewHolder holder, boolean freeze)
Freezes/unfreezes the row, typically used when a transition starts/ends. This method is called by the fragment, it should not call it directly by the application.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
freeze |
boolean |
getExpandedRowHeight
int getExpandedRowHeight ()
Returns the expanded row height for rows created by this Presenter.
Returns | |
---|---|
int |
getFocusZoomFactor
int getFocusZoomFactor ()
Returns the zoom factor used for focus highlighting.
Returns | |
---|---|
int |
getHoverCardPresenterSelector
PresenterSelector getHoverCardPresenterSelector ()
Returns the PresenterSelector
used for showing a select object in a hover card.
Returns | |
---|---|
PresenterSelector |
getRecycledPoolSize
int getRecycledPoolSize (Presenter presenter)
Returns the recycled pool size for the given presenter.
Parameters | |
---|---|
presenter |
Presenter |
Returns | |
---|---|
int |
getRowHeight
int getRowHeight ()
Returns the row height for list rows created by this Presenter.
Returns | |
---|---|
int |
getShadowEnabled
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.
Returns | |
---|---|
boolean |
getZoomFactor
int getZoomFactor ()
This method was deprecated
in API level 22.1.0.
use getFocusZoomFactor()
instead.
Returns the zoom factor used for focus highlighting.
Returns | |
---|---|
int |
isFocusDimmerUsed
boolean isFocusDimmerUsed ()
Returns true if the focus dimmer is used for focus highlighting; false otherwise.
Returns | |
---|---|
boolean |
isKeepChildForeground
boolean isKeepChildForeground ()
Returns true if keeps foreground of child of this row, false otherwise. When ListRowPresenter applies overlay color on the child, it may change child's foreground Drawable. If application uses child's foreground for other purposes such as ripple effect, it needs tell ListRowPresenter to keep the child's foreground. The default value is true.
Returns | |
---|---|
boolean |
true if keeps foreground of child of this row, false otherwise. |
isUsingDefaultListSelectEffect
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 and implement applySelectLevelToChild(ViewHolder, View)
.
Returns | |
---|---|
boolean |
isUsingDefaultSelectEffect
boolean isUsingDefaultSelectEffect ()
ListRowPresenter overrides the default select effect of RowPresenter
and return false.
Returns | |
---|---|
boolean |
isUsingDefaultShadow
boolean isUsingDefaultShadow ()
Default implementation returns true if SDK version >= 21, shadow (either static or z-order
based) will be applied to each individual child of HorizontalGridView
.
Subclass may return false to disable default implementation of shadow and provide its own.
Returns | |
---|---|
boolean |
isUsingOutlineClipping
boolean isUsingOutlineClipping (Context context)
Returns true if leanback view outline is enabled on the system or false otherwise. When
false, rounded corner will not be enabled even enableChildRoundedCorners(boolean)
is called with true.
Parameters | |
---|---|
context |
Context : Context to retrieve system settings. |
Returns | |
---|---|
boolean |
True if leanback view outline is enabled on the system or false otherwise. |
isUsingZOrder
boolean isUsingZOrder (Context context)
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.
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
boolean |
setEntranceTransitionState
void setEntranceTransitionState (RowPresenter.ViewHolder holder, boolean afterEntrance)
Changes the visibility of views. The entrance transition will be run against the views that change visibilities. A subclass may override and begin with calling super.setEntranceTransitionState(). This method is called by the fragment, it should not be called directly by the application.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder : The ViewHolder of the row. |
afterEntrance |
boolean : true if children of row participating in entrance transition
should be set to visible, false otherwise.
|
setExpandedRowHeight
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 |
int : The row height in to use when the row is expanded,
in pixels, or WRAP_CONTENT, or 0 to use the default.
|
setHoverCardPresenterSelector
void setHoverCardPresenterSelector (PresenterSelector selector)
Sets the PresenterSelector
used for showing a select object in a hover card.
Parameters | |
---|---|
selector |
PresenterSelector |
setKeepChildForeground
void setKeepChildForeground (boolean keep)
When ListRowPresenter applies overlay color on the child, it may change child's foreground Drawable. If application uses child's foreground for other purposes such as ripple effect, it needs tell ListRowPresenter to keep the child's foreground. The default value is true.
Parameters | |
---|---|
keep |
boolean : true if keep foreground of child of this row, false ListRowPresenter might change
the foreground of the child.
|
setNumRows
void setNumRows (int numRows)
Sets the numbers of rows for rendering the list of items. By default, it is set to 1.
Parameters | |
---|---|
numRows |
int |
setRecycledPoolSize
void setRecycledPoolSize (Presenter presenter, int size)
Sets the recycled pool size for the given presenter.
Parameters | |
---|---|
presenter |
Presenter |
size |
int |
setRowHeight
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 |
int : Row height in pixels, or WRAP_CONTENT, or 0
to use the default height.
|
setShadowEnabled
void setShadowEnabled (boolean enabled)
Enables or disables child shadow. This is not only for enable/disable default shadow implementation but also subclass must respect this flag.
Parameters | |
---|---|
enabled |
boolean |
Protected methods
applySelectLevelToChild
void applySelectLevelToChild (ListRowPresenter.ViewHolder rowViewHolder, View childView)
Applies select level to a child. Default implementation draws a default color
dim over each child of HorizontalGridView
. This method is called on all children in
onSelectLevelChanged(RowPresenter.ViewHolder)
and when a child is attached to
HorizontalGridView
.
Subclass may disable the default implementation by override
isUsingDefaultListSelectEffect()
to return false and deal with the individual item
select level by itself.
Parameters | |
---|---|
rowViewHolder |
ListRowPresenter.ViewHolder : The ViewHolder of the Row |
childView |
View : The child of HorizontalGridView to apply select level. |
createRowViewHolder
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 |
ViewGroup : The parent View for the Row's view holder. |
Returns | |
---|---|
RowPresenter.ViewHolder |
A ViewHolder for the Row's View. |
createShadowOverlayOptions
ShadowOverlayHelper.Options createShadowOverlayOptions ()
Create ShadowOverlayHelper Options. Subclass may override.
e.g.
return new ShadowOverlayHelper.Options().roundedCornerRadius(10);
Returns | |
---|---|
ShadowOverlayHelper.Options |
The options to be used for shadow, overlay and rounded corner. |
dispatchItemSelectedListener
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().
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
selected |
boolean |
initializeRowViewHolder
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 |
RowPresenter.ViewHolder : The ViewHolder to initialize for the Row.
|
onBindRowViewHolder
void onBindRowViewHolder (RowPresenter.ViewHolder holder, Object item)
Binds the given row object to the given ViewHolder.
Derived classes of RowPresenter
overriding
onBindRowViewHolder(ViewHolder, Object)
must call through the super class's
implementation of this method.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
item |
Object |
onRowViewExpanded
void onRowViewExpanded (RowPresenter.ViewHolder holder, boolean expanded)
Called when the row view's expanded state changes. A subclass may override this method 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.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
expanded |
boolean |
onRowViewSelected
void onRowViewSelected (RowPresenter.ViewHolder holder, boolean selected)
Called when the given row view changes selection state. A subclass may override this to respond to selected state changes of a Row. A subclass may make visual changes to Row view but must not create animation on the Row view.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
selected |
boolean |
onSelectLevelChanged
void onSelectLevelChanged (RowPresenter.ViewHolder holder)
Applies select level to header and draws a default color dim over each child
of HorizontalGridView
.
Subclass may override this method and starts with calling super if it has views to apply
select effect other than header and HorizontalGridView.
To override the default color dim over each child of HorizontalGridView
,
app should override isUsingDefaultListSelectEffect()
to
return false and override applySelectLevelToChild(ViewHolder, View)
.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
onUnbindRowViewHolder
void onUnbindRowViewHolder (RowPresenter.ViewHolder holder)
Unbinds the given ViewHolder.
Derived classes of RowPresenter
overriding onUnbindRowViewHolder(ViewHolder)
must call through the super class's implementation of this method.
Parameters | |
---|---|
holder |
RowPresenter.ViewHolder |
Interfaces
- BaseGridView.OnKeyInterceptListener
- BaseGridView.OnMotionInterceptListener
- BaseGridView.OnTouchInterceptListener
- BaseGridView.OnUnhandledKeyListener
- BaseOnItemViewClickedListener
- BaseOnItemViewSelectedListener
- BrowseFrameLayout.OnChildFocusListener
- BrowseFrameLayout.OnFocusSearchListener
- FacetProvider
- FacetProviderAdapter
- FocusHighlight
- FragmentAnimationProvider
- ImeKeyMonitor
- ImeKeyMonitor.ImeKeyListener
- MultiActionsProvider
- OnActionClickedListener
- OnChildLaidOutListener
- OnChildSelectedListener
- OnItemViewClickedListener
- OnItemViewSelectedListener
- PlaybackSeekUi
- SearchBar.SearchBarListener
- SearchBar.SearchBarPermissionListener
- SearchEditText.OnKeyboardDismissListener
- SpeechRecognitionCallback
- TitleViewAdapter.Provider
- ViewHolderTask
Classes
- AbstractDetailsDescriptionPresenter
- AbstractDetailsDescriptionPresenter.ViewHolder
- AbstractMediaItemPresenter
- AbstractMediaItemPresenter.ViewHolder
- AbstractMediaListHeaderPresenter
- AbstractMediaListHeaderPresenter.ViewHolder
- Action
- ArrayObjectAdapter
- BaseCardView
- BaseCardView.LayoutParams
- BaseGridView
- BrowseFrameLayout
- ClassPresenterSelector
- ControlButtonPresenterSelector
- CursorObjectAdapter
- DetailsOverviewLogoPresenter
- DetailsOverviewLogoPresenter.ViewHolder
- DetailsOverviewRow
- DetailsOverviewRow.Listener
- DetailsOverviewRowPresenter
- DetailsOverviewRowPresenter.ViewHolder
- DetailsParallax
- DiffCallback
- DividerPresenter
- DividerRow
- FocusHighlightHelper
- FullWidthDetailsOverviewRowPresenter
- FullWidthDetailsOverviewRowPresenter.Listener
- FullWidthDetailsOverviewRowPresenter.ViewHolder
- FullWidthDetailsOverviewRowPresenter.ViewHolder.DetailsOverviewRowListener
- FullWidthDetailsOverviewSharedElementHelper
- GuidanceStylist
- GuidanceStylist.Guidance
- GuidedAction
- GuidedAction.Builder
- GuidedAction.BuilderBase
- GuidedActionDiffCallback
- GuidedActionEditText
- GuidedActionsStylist
- GuidedActionsStylist.ViewHolder
- GuidedDatePickerAction
- GuidedDatePickerAction.Builder
- GuidedDatePickerAction.BuilderBase
- HeaderItem
- HorizontalGridView
- HorizontalHoverCardSwitcher
- ImageCardView
- ItemAlignmentFacet
- ItemAlignmentFacet.ItemAlignmentDef
- ItemBridgeAdapter
- ItemBridgeAdapter.AdapterListener
- ItemBridgeAdapter.ViewHolder
- ItemBridgeAdapter.Wrapper
- ItemBridgeAdapterShadowOverlayWrapper
- ListRow
- ListRowHoverCardView
- ListRowPresenter
- ListRowPresenter.SelectItemViewHolderTask
- ListRowPresenter.ViewHolder
- ListRowView
- MultiActionsProvider.MultiAction
- ObjectAdapter
- ObjectAdapter.DataObserver
- OnChildViewHolderSelectedListener
- PageRow
- Parallax
- Parallax.FloatProperty
- Parallax.IntProperty
- Parallax.PropertyMarkerValue
- ParallaxEffect
- ParallaxTarget
- ParallaxTarget.DirectPropertyTarget
- ParallaxTarget.PropertyValuesHolderTarget
- PlaybackControlsRow
- PlaybackControlsRow.ClosedCaptioningAction
- PlaybackControlsRow.FastForwardAction
- PlaybackControlsRow.HighQualityAction
- PlaybackControlsRow.MoreActions
- PlaybackControlsRow.MultiAction
- PlaybackControlsRow.OnPlaybackProgressCallback
- PlaybackControlsRow.PictureInPictureAction
- PlaybackControlsRow.PlayPauseAction
- PlaybackControlsRow.RepeatAction
- PlaybackControlsRow.RewindAction
- PlaybackControlsRow.ShuffleAction
- PlaybackControlsRow.SkipNextAction
- PlaybackControlsRow.SkipPreviousAction
- PlaybackControlsRow.ThumbsAction
- PlaybackControlsRow.ThumbsDownAction
- PlaybackControlsRow.ThumbsUpAction
- PlaybackControlsRowPresenter
- PlaybackControlsRowPresenter.ViewHolder
- PlaybackRowPresenter
- PlaybackRowPresenter.ViewHolder
- PlaybackSeekDataProvider
- PlaybackSeekDataProvider.ResultCallback
- PlaybackSeekUi.Client
- PlaybackTransportRowPresenter
- PlaybackTransportRowPresenter.ViewHolder
- Presenter
- Presenter.ViewHolder
- Presenter.ViewHolderTask
- PresenterSelector
- PresenterSwitcher
- RecyclerViewParallax
- RecyclerViewParallax.ChildPositionProperty
- Row
- RowHeaderPresenter
- RowHeaderPresenter.ViewHolder
- RowHeaderView
- RowPresenter
- RowPresenter.ViewHolder
- SearchBar
- SearchEditText
- SearchOrbView
- SearchOrbView.Colors
- SectionRow
- ShadowOverlayContainer
- ShadowOverlayHelper
- ShadowOverlayHelper.Builder
- ShadowOverlayHelper.Options
- SinglePresenterSelector
- SparseArrayObjectAdapter
- SpeechOrbView
- TitleHelper
- TitleView
- TitleViewAdapter
- VerticalGridPresenter
- VerticalGridPresenter.ViewHolder
- VerticalGridView
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.