Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

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

use RowsSupportFragment

Public methods
open Unit

Sets an item clicked listener on the fragment.

open Boolean

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

open Unit
onCreate(savedInstanceState: Bundle!)

open Unit

open Unit

open Boolean

open RowPresenter.ViewHolder!
getRowViewHolder(position: Int)

Get row ViewHolder at adapter position.

open Unit
setAlignment(windowAlignOffsetFromTop: Int)

open Unit

Sets an item selection listener.

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
setSelectedPosition(rowPosition: Int, smooth: Boolean, rowHolderTask: Presenter.ViewHolderTask!)

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

open RowPresenter.ViewHolder!

Find row ViewHolder by position in adapter.

open BrowseFragment.MainFragmentAdapter<Fragment!>!

open Unit

open BaseOnItemViewClickedListener<Any!>!

Returns the item clicked listener.

open Unit
setExpand(expand: Boolean)

Set the visibility of titles/hovercard of browse rows.

open BrowseFragment.MainFragmentRowsAdapter<Fragment!>!

open BaseOnItemViewSelectedListener<Any!>!

Returns an item selection listener.

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

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.

isScrolling

open fun isScrolling(): Boolean

onViewCreated

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

onCreate

open fun onCreate(savedInstanceState: Bundle!): Unit

onTransitionEnd

open fun onTransitionEnd(): Unit

enableRowScaling

open fun enableRowScaling(enable: Boolean): Unit
Parameters
enable Boolean: true to enable row scaling

onTransitionPrepare

open fun onTransitionPrepare(): Boolean

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.

setAlignment

open fun setAlignment(windowAlignOffsetFromTop: Int): Unit

setOnItemViewSelectedListener

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

Sets an item selection listener.

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.

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.

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!>!

onDestroyView

open fun onDestroyView(): Unit

getOnItemViewClickedListener

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

Returns the item clicked listener.

setExpand

open fun setExpand(expand: Boolean): Unit

Set the visibility of titles/hovercard of browse rows.

getMainFragmentRowsAdapter

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

getOnItemViewSelectedListener

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

Returns an item selection listener.

Protected methods

findGridViewFromRoot

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