Join us on the livestream at Android Dev Summit on 7-8 November 2018, starting at 10AM PDT!
added in version 1.0.0
belongs to Maven artifact androidx.leanback:leanback:1.0.0
Deprecated since version 1.0.0

RowsFragment

public class RowsFragment
extends Fragment implements BrowseFragment.MainFragmentRowsAdapterProvider, BrowseFragment.MainFragmentAdapterProvider

java.lang.Object
   ↳ android.app.Fragment
     ↳ androidx.leanback.app.RowsFragment


This class was deprecated in API level 1.0.0.
use RowsSupportFragment

An ordered set of rows of leanback widgets.

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

Summary

Nested classes

class RowsFragment.MainFragmentAdapter

 

class RowsFragment.MainFragmentRowsAdapter

This class was deprecated in API level 1.0.0. use RowsSupportFragment  

Inherited constants

Public constructors

RowsFragment()

Public methods

void enableRowScaling(boolean enable)

This method was deprecated in API level 1.0.0. use BrowseFragment.enableRowScaling(boolean) instead.

RowPresenter.ViewHolder findRowViewHolderByPosition(int position)

Find row ViewHolder by position in adapter.

final ObjectAdapter getAdapter()

Returns the Adapter that represents list of rows.

final ItemBridgeAdapter getBridgeAdapter()

Returns the RecyclerView.Adapter that wraps getAdapter().

MainFragmentAdapter getMainFragmentAdapter()

Returns an instance of BrowseFragment.MainFragmentAdapter that BrowseFragment would use to communicate with the target fragment.

MainFragmentRowsAdapter getMainFragmentRowsAdapter()

Returns an instance of BrowseFragment.MainFragmentRowsAdapter that BrowseFragment would use to communicate with the target fragment.

BaseOnItemViewClickedListener getOnItemViewClickedListener()

Returns the item clicked listener.

BaseOnItemViewSelectedListener getOnItemViewSelectedListener()

Returns an item selection listener.

final PresenterSelector getPresenterSelector()

Get the presenter selector used to create and bind views.

RowPresenter.ViewHolder getRowViewHolder(int position)

Get row ViewHolder at adapter position.

int getSelectedPosition()

Gets position of currently selected row.

final VerticalGridView getVerticalGridView()
boolean isScrolling()
void onCreate(Bundle savedInstanceState)
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void onDestroyView()
void onSaveInstanceState(Bundle outState)
void onTransitionEnd()
boolean onTransitionPrepare()
void onTransitionStart()
void onViewCreated(View view, Bundle savedInstanceState)
final void setAdapter(ObjectAdapter rowsAdapter)

Sets the adapter that represents a list of rows.

void setAlignment(int windowAlignOffsetFromTop)
void setEntranceTransitionState(boolean afterTransition)

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

void setExpand(boolean expand)

Set the visibility of titles/hovercard of browse rows.

void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)

Sets an item clicked listener on the fragment.

void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)

Sets an item selection listener.

final void setPresenterSelector(PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

void setSelectedPosition(int position)

Sets the selected row position with smooth animation.

void setSelectedPosition(int rowPosition, boolean smooth, Presenter.ViewHolderTask rowHolderTask)

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

void setSelectedPosition(int position, boolean smooth)

Sets the selected row position.

Protected methods

VerticalGridView findGridViewFromRoot(View view)

Inherited methods

Public constructors

RowsFragment

added in version 1.0.0
public RowsFragment ()

Public methods

enableRowScaling

added in version 1.0.0
public void enableRowScaling (boolean enable)

This method was deprecated in API level 1.0.0.
use BrowseFragment.enableRowScaling(boolean) instead.

Parameters
enable boolean: true to enable row scaling

findRowViewHolderByPosition

added in version 1.0.0
public RowPresenter.ViewHolder findRowViewHolderByPosition (int position)

Find row ViewHolder by position in adapter.

Parameters
position int: Position of row.

Returns
RowPresenter.ViewHolder ViewHolder of Row.

getAdapter

public final ObjectAdapter getAdapter ()

Returns the Adapter that represents list of rows.

Returns
ObjectAdapter Adapter that represents list of rows.

getBridgeAdapter

public final ItemBridgeAdapter getBridgeAdapter ()

Returns the RecyclerView.Adapter that wraps getAdapter().

Returns
ItemBridgeAdapter The RecyclerView.Adapter that wraps getAdapter().

getMainFragmentAdapter

added in version 1.0.0
public MainFragmentAdapter getMainFragmentAdapter ()

Returns an instance of BrowseFragment.MainFragmentAdapter that BrowseFragment would use to communicate with the target fragment.

Returns
MainFragmentAdapter

getMainFragmentRowsAdapter

added in version 1.0.0
public MainFragmentRowsAdapter getMainFragmentRowsAdapter ()

Returns an instance of BrowseFragment.MainFragmentRowsAdapter that BrowseFragment would use to communicate with the target fragment.

Returns
MainFragmentRowsAdapter

getOnItemViewClickedListener

added in version 1.0.0
public BaseOnItemViewClickedListener getOnItemViewClickedListener ()

Returns the item clicked listener.

Returns
BaseOnItemViewClickedListener

getOnItemViewSelectedListener

added in version 1.0.0
public BaseOnItemViewSelectedListener getOnItemViewSelectedListener ()

Returns an item selection listener.

Returns
BaseOnItemViewSelectedListener

getPresenterSelector

public final PresenterSelector getPresenterSelector ()

Get the presenter selector used to create and bind views.

Returns
PresenterSelector

getRowViewHolder

added in version 1.0.0
public RowPresenter.ViewHolder getRowViewHolder (int position)

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.

Returns
RowPresenter.ViewHolder Row ViewHolder at a given adapter position.

getSelectedPosition

public int getSelectedPosition ()

Gets position of currently selected row.

Returns
int Position of currently selected row.

getVerticalGridView

public final VerticalGridView getVerticalGridView ()

Returns
VerticalGridView

isScrolling

added in version 1.0.0
public boolean isScrolling ()

Returns
boolean

onCreate

public void onCreate (Bundle savedInstanceState)

Parameters
savedInstanceState Bundle

onCreateView

public View onCreateView (LayoutInflater inflater, 
                ViewGroup container, 
                Bundle savedInstanceState)

Parameters
inflater LayoutInflater

container ViewGroup

savedInstanceState Bundle

Returns
View

onDestroyView

public void onDestroyView ()

onSaveInstanceState

public void onSaveInstanceState (Bundle outState)

Parameters
outState Bundle

onTransitionEnd

added in version 1.0.0
public void onTransitionEnd ()

onTransitionPrepare

added in version 1.0.0
public boolean onTransitionPrepare ()

Returns
boolean

onTransitionStart

public void onTransitionStart ()

onViewCreated

public void onViewCreated (View view, 
                Bundle savedInstanceState)

Parameters
view View

savedInstanceState Bundle

setAdapter

public final void setAdapter (ObjectAdapter rowsAdapter)

Sets the adapter that represents a list of rows.

Parameters
rowsAdapter ObjectAdapter: Adapter that represents list of rows.

setAlignment

added in version 1.0.0
public void setAlignment (int windowAlignOffsetFromTop)

Parameters
windowAlignOffsetFromTop int

setEntranceTransitionState

added in version 1.0.0
public void setEntranceTransitionState (boolean afterTransition)

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

Parameters
afterTransition boolean

setExpand

added in version 1.0.0
public void setExpand (boolean expand)

Set the visibility of titles/hovercard of browse rows.

Parameters
expand boolean

setOnItemViewClickedListener

added in version 1.0.0
public void setOnItemViewClickedListener (BaseOnItemViewClickedListener listener)

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.

Parameters
listener BaseOnItemViewClickedListener

setOnItemViewSelectedListener

added in version 1.0.0
public void setOnItemViewSelectedListener (BaseOnItemViewSelectedListener listener)

Sets an item selection listener.

Parameters
listener BaseOnItemViewSelectedListener

setPresenterSelector

public final void setPresenterSelector (PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

Parameters
presenterSelector PresenterSelector

setSelectedPosition

public void setSelectedPosition (int position)

Sets the selected row position with smooth animation.

Parameters
position int

setSelectedPosition

added in version 1.0.0
public void setSelectedPosition (int rowPosition, 
                boolean smooth, 
                Presenter.ViewHolderTask rowHolderTask)

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 boolean: True to scroll to the row, false for no animation.

rowHolderTask Presenter.ViewHolderTask: Task to perform on the Row.

setSelectedPosition

public void setSelectedPosition (int position, 
                boolean smooth)

Sets the selected row position.

Parameters
position int

smooth boolean

Protected methods

findGridViewFromRoot

added in version 1.0.0
protected VerticalGridView findGridViewFromRoot (View view)

Parameters
view View

Returns
VerticalGridView