RowsFragment

open class RowsFragment : BaseRowFragment, BrowseFragment.MainFragmentRowsAdapterProvider, BrowseFragment.MainFragmentAdapterProvider
androidx.leanback.app.RowsFragment

An ordered set of rows of leanback widgets.

A RowsFragment renders the elements of its androidx.leanback.widget.ObjectAdapter as a set of rows in a vertical list. The Adapter's PresenterSelector must maintain subclasses of RowPresenter.

Summary

Nested classes

open

open

The adapter that RowsFragment implements BrowseFragment.

Public constructors

An ordered set of rows of leanback widgets.

Public methods

open Unit

open RowPresenter.ViewHolder!

Find row ViewHolder by position in adapter.

open BrowseFragment.MainFragmentAdapter<Fragment!>!

open BrowseFragment.MainFragmentRowsAdapter<Fragment!>!

open BaseOnItemViewClickedListener<Any!>!

Returns the item clicked listener.

open BaseOnItemViewSelectedListener<Any!>!

Returns an item selection listener.

open RowPresenter.ViewHolder!
getRowViewHolder(position: Int)

Get row ViewHolder at adapter position.

open Boolean

open Unit

open Unit

open Boolean

open Unit
onViewCreated(@NonNull view: View, @Nullable savedInstanceState: Bundle?)

open Unit
setAlignment(windowAlignOffsetFromTop: Int)

open Unit

For rows that willing to participate entrance transition, this function hide views if afterTransition is true, show views if afterTransition is false.

open Unit
setExpand(expand: Boolean)

Set the visibility of titles/hovercard of browse rows.

open Unit

Sets an item clicked listener on the fragment.

open Unit

Sets an item selection listener.

open Unit
setSelectedPosition(rowPosition: Int, smooth: Boolean, rowHolderTask: Presenter.ViewHolderTask!)

Selects a Row and perform an optional task on the Row.

Protected methods

open VerticalGridView!

Public constructors

<init>

RowsFragment()

Deprecated: use RowsSupportFragment

An ordered set of rows of leanback widgets.

A RowsFragment renders the elements of its androidx.leanback.widget.ObjectAdapter as a set of rows in a vertical list. The Adapter's PresenterSelector must maintain subclasses of RowPresenter.

Public methods

enableRowScaling

open fun enableRowScaling(enable: Boolean): Unit

Deprecated: use BrowseFragment#enableRowScaling(boolean) instead.

Parameters
enable Boolean: true to enable row scaling

findRowViewHolderByPosition

open fun findRowViewHolderByPosition(position: Int): RowPresenter.ViewHolder!

Find row ViewHolder by position in adapter.

Parameters
position Int: Position of row.
Return
RowPresenter.ViewHolder!: ViewHolder of Row.

getMainFragmentAdapter

open fun getMainFragmentAdapter(): BrowseFragment.MainFragmentAdapter<Fragment!>!

getMainFragmentRowsAdapter

open fun getMainFragmentRowsAdapter(): BrowseFragment.MainFragmentRowsAdapter<Fragment!>!

getOnItemViewClickedListener

open fun getOnItemViewClickedListener(): BaseOnItemViewClickedListener<Any!>!

Returns the item clicked listener.

getOnItemViewSelectedListener

open fun getOnItemViewSelectedListener(): BaseOnItemViewSelectedListener<Any!>!

Returns an item selection listener.

getRowViewHolder

open fun getRowViewHolder(position: Int): RowPresenter.ViewHolder!

Get row ViewHolder at adapter position. Returns null if the row object is not in adapter or the row object has not been bound to a row view.

Parameters
position Int: Position of row in adapter.
Return
RowPresenter.ViewHolder!: Row ViewHolder at a given adapter position.

isScrolling

open fun isScrolling(): Boolean

onDestroyView

open fun onDestroyView(): Unit

onTransitionEnd

open fun onTransitionEnd(): Unit

onTransitionPrepare

open fun onTransitionPrepare(): Boolean

onViewCreated

open fun onViewCreated(@NonNull view: View, @Nullable savedInstanceState: Bundle?): Unit

setAlignment

open fun setAlignment(windowAlignOffsetFromTop: Int): Unit

setEntranceTransitionState

open fun setEntranceTransitionState(afterTransition: Boolean): Unit

For rows that willing to participate entrance transition, this function hide views if afterTransition is true, show views if afterTransition is false.

setExpand

open fun setExpand(expand: Boolean): Unit

Set the visibility of titles/hovercard of browse rows.

setOnItemViewClickedListener

open fun setOnItemViewClickedListener(listener: BaseOnItemViewClickedListener<Any!>!): Unit

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

setOnItemViewSelectedListener

open fun setOnItemViewSelectedListener(listener: BaseOnItemViewSelectedListener<Any!>!): Unit

Sets an item selection listener.

setSelectedPosition

open fun setSelectedPosition(rowPosition: Int, smooth: Boolean, rowHolderTask: Presenter.ViewHolderTask!): Unit

Selects a Row and perform an optional task on the Row. For example setSelectedPosition(10, true, new ListRowPresenterSelectItemViewHolderTask(5)) Scroll to 11th row and selects 6th item on that row. The method will be ignored if RowsFragment has not been created (i.e. before onCreateView(LayoutInflater, * ViewGroup, Bundle)).

Parameters
rowPosition Int: Which row to select.
smooth Int: True to scroll to the row, false for no animation.
rowHolderTask Int: Task to perform on the Row.

Protected methods

findGridViewFromRoot

protected open fun findGridViewFromRoot(view: View!): VerticalGridView!