RowsFragment

Added in 1.1.0
Deprecated in 1.1.0

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


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

Public constructors

Public methods

void
enableRowScaling(boolean enable)

This method is deprecated.

use enableRowScaling instead.

RowPresenter.ViewHolder

Find row ViewHolder by position in adapter.

final ObjectAdapter

Returns the Adapter that represents list of rows.

final ItemBridgeAdapter

Returns the RecyclerView.Adapter that wraps getAdapter.

BrowseFragment.MainFragmentAdapter

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

BrowseFragment.MainFragmentRowsAdapter

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

BaseOnItemViewClickedListener

Returns the item clicked listener.

BaseOnItemViewSelectedListener

Returns an item selection listener.

final PresenterSelector

Get the presenter selector used to create and bind views.

RowPresenter.ViewHolder
getRowViewHolder(int position)

Get row ViewHolder at adapter position.

int

Gets position of currently selected row.

final VerticalGridView
boolean
@Nullable View
onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    Bundle savedInstanceState
)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
boolean
void
void
onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)

This method is deprecated.

final void

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

Sets an item clicked listener on the fragment.

void

Sets an item selection listener.

final void

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 position, boolean smooth)

Sets the selected row position.

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

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

Protected methods

VerticalGridView

Inherited Constants

From android.content.ComponentCallbacks2
static final int
static final int
static final int
static final int
static final int
static final int
static final int

Inherited methods

From android.app.Fragment
void
dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args)

This method is deprecated.

final boolean

This method is deprecated.

final Activity

This method is deprecated.

boolean

This method is deprecated.

boolean

This method is deprecated.

final Bundle

This method is deprecated.

final FragmentManager

This method is deprecated.

Context

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final FragmentManager

This method is deprecated.

final Object

This method is deprecated.

final int

This method is deprecated.

final LayoutInflater

This method is deprecated.

LoaderManager

This method is deprecated.

final Fragment

This method is deprecated.

Transition

This method is deprecated.

final Resources

This method is deprecated.

final boolean

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

Transition

This method is deprecated.

final String
getString(int resId)

This method is deprecated.

final String

This method is deprecated.

final Fragment

This method is deprecated.

final int

This method is deprecated.

final CharSequence
getText(int resId)

This method is deprecated.

boolean

This method is deprecated.

View

This method is deprecated.

final int

This method is deprecated.

static Fragment
instantiate(Context context, String fname)

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

final boolean

This method is deprecated.

void
onActivityCreated(Bundle savedInstanceState)

This method is deprecated.

void
onActivityResult(int requestCode, int resultCode, Intent data)

This method is deprecated.

void
onAttach(Context context)

This method is deprecated.

void
onAttachFragment(Fragment childFragment)

This method is deprecated.

void

This method is deprecated.

boolean

This method is deprecated.

void
onCreate(Bundle savedInstanceState)

This method is deprecated.

Animator
onCreateAnimator(int transit, boolean enter, int nextAnim)

This method is deprecated.

void
onCreateContextMenu(
    ContextMenu menu,
    View v,
    ContextMenu.ContextMenuInfo menuInfo
)

This method is deprecated.

void

This method is deprecated.

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

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

LayoutInflater
onGetLayoutInflater(Bundle savedInstanceState)

This method is deprecated.

void
onHiddenChanged(boolean hidden)

This method is deprecated.

void
onInflate(AttributeSet attrs, Bundle savedInstanceState)

This method is deprecated.

void

This method is deprecated.

void
onMultiWindowModeChanged(
    boolean isInMultiWindowMode,
    Configuration newConfig
)

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onPictureInPictureModeChanged(
    boolean isInPictureInPictureMode,
    Configuration newConfig
)

This method is deprecated.

void

This method is deprecated.

void
onRequestPermissionsResult(
    int requestCode,
    String[] permissions,
    int[] grantResults
)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
onTrimMemory(int level)

This method is deprecated.

void
onViewCreated(View view, Bundle savedInstanceState)

This method is deprecated.

void
onViewStateRestored(Bundle savedInstanceState)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

final void
requestPermissions(String[] permissions, int requestCode)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setHasOptionsMenu(boolean hasMenu)

This method is deprecated.

void

This method is deprecated.

void
setMenuVisibility(boolean menuVisible)

This method is deprecated.

void

This method is deprecated.

void
setRetainInstance(boolean retain)

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void

This method is deprecated.

void
setTargetFragment(Fragment fragment, int requestCode)

This method is deprecated.

void
setUserVisibleHint(boolean isVisibleToUser)

This method is deprecated.

boolean

This method is deprecated.

void

This method is deprecated.

void
startActivityForResult(Intent intent, int requestCode)

This method is deprecated.

void
startIntentSenderForResult(
    IntentSender intent,
    int requestCode,
    Intent fillInIntent,
    int flagsMask,
    int flagsValues,
    int extraFlags,
    Bundle options
)

This method is deprecated.

void

This method is deprecated.

String

This method is deprecated.

void

This method is deprecated.

Public constructors

RowsFragment

Added in 1.1.0
Deprecated in 1.1.0
public RowsFragment()

Public methods

enableRowScaling

Added in 1.1.0
Deprecated in 1.1.0
public void enableRowScaling(boolean enable)
Parameters
boolean enable

true to enable row scaling

findRowViewHolderByPosition

Added in 1.1.0
Deprecated in 1.1.0
public RowPresenter.ViewHolder findRowViewHolderByPosition(int position)

Find row ViewHolder by position in adapter.

Parameters
int position

Position of row.

Returns
RowPresenter.ViewHolder

ViewHolder of Row.

getAdapter

Added in 1.1.0
Deprecated in 1.1.0
public final ObjectAdapter getAdapter()

Returns the Adapter that represents list of rows.

Returns
ObjectAdapter

Adapter that represents list of rows.

getBridgeAdapter

Added in 1.1.0
Deprecated in 1.1.0
public final ItemBridgeAdapter getBridgeAdapter()

Returns the RecyclerView.Adapter that wraps getAdapter.

Returns
ItemBridgeAdapter

The RecyclerView.Adapter that wraps getAdapter.

getMainFragmentAdapter

Added in 1.2.0-alpha04
Deprecated in 1.2.0-alpha04
public BrowseFragment.MainFragmentAdapter getMainFragmentAdapter()

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

getMainFragmentRowsAdapter

Added in 1.2.0-alpha04
Deprecated in 1.2.0-alpha04
public BrowseFragment.MainFragmentRowsAdapter getMainFragmentRowsAdapter()

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

getOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
public BaseOnItemViewClickedListener getOnItemViewClickedListener()

Returns the item clicked listener.

getOnItemViewSelectedListener

Added in 1.1.0
Deprecated in 1.1.0
public BaseOnItemViewSelectedListener getOnItemViewSelectedListener()

Returns an item selection listener.

getPresenterSelector

Added in 1.1.0
Deprecated in 1.1.0
public final PresenterSelector getPresenterSelector()

Get the presenter selector used to create and bind views.

getRowViewHolder

Added in 1.1.0
Deprecated in 1.1.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
int position

Position of row in adapter.

Returns
RowPresenter.ViewHolder

Row ViewHolder at a given adapter position.

getSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
public int getSelectedPosition()

Gets position of currently selected row.

Returns
int

Position of currently selected row.

getVerticalGridView

Added in 1.1.0
Deprecated in 1.1.0
public final VerticalGridView getVerticalGridView()

isScrolling

Added in 1.1.0
Deprecated in 1.1.0
public boolean isScrolling()

onCreateView

Added in 1.1.0
Deprecated in 1.1.0
public @Nullable View onCreateView(
    LayoutInflater inflater,
    @Nullable ViewGroup container,
    Bundle savedInstanceState
)

onDestroyView

Added in 1.1.0
Deprecated in 1.1.0
public void onDestroyView()

onSaveInstanceState

Added in 1.1.0
Deprecated in 1.1.0
public void onSaveInstanceState(Bundle outState)

onTransitionEnd

Added in 1.1.0
Deprecated in 1.1.0
public void onTransitionEnd()

onTransitionPrepare

Added in 1.1.0
Deprecated in 1.1.0
public boolean onTransitionPrepare()

onTransitionStart

Added in 1.1.0
Deprecated in 1.1.0
public void onTransitionStart()

onViewCreated

Added in 1.1.0
Deprecated in 1.1.0
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState)

setAdapter

Added in 1.1.0
Deprecated in 1.1.0
public final void setAdapter(ObjectAdapter rowsAdapter)

Sets the adapter that represents a list of rows.

Parameters
ObjectAdapter rowsAdapter

Adapter that represents list of rows.

setAlignment

Added in 1.1.0
Deprecated in 1.1.0
public void setAlignment(int windowAlignOffsetFromTop)

setEntranceTransitionState

Added in 1.1.0
Deprecated in 1.1.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.

setExpand

Added in 1.1.0
Deprecated in 1.1.0
public void setExpand(boolean expand)

Set the visibility of titles/hovercard of browse rows.

setOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
public void setOnItemViewClickedListener(BaseOnItemViewClickedListener listener)

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

setOnItemViewSelectedListener

Added in 1.1.0
Deprecated in 1.1.0
public void setOnItemViewSelectedListener(BaseOnItemViewSelectedListener listener)

Sets an item selection listener.

setPresenterSelector

Added in 1.1.0
Deprecated in 1.1.0
public final void setPresenterSelector(PresenterSelector presenterSelector)

Set the presenter selector used to create and bind views.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
public void setSelectedPosition(int position)

Sets the selected row position with smooth animation.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
public void setSelectedPosition(int position, boolean smooth)

Sets the selected row position.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.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).

Parameters
int rowPosition

Which row to select.

boolean smooth

True to scroll to the row, false for no animation.

Presenter.ViewHolderTask rowHolderTask

Task to perform on the Row.

Protected methods

findGridViewFromRoot

Added in 1.1.0
Deprecated in 1.1.0
protected VerticalGridView findGridViewFromRoot(View view)