BrowseSupportFragment

public class BrowseSupportFragment
extends BaseSupportFragment

java.lang.Object
   ↳ androidx.fragment.app.Fragment
     ↳ androidx.leanback.app.BrandedSupportFragment
       ↳ androidx.leanback.app.BaseSupportFragment
         ↳ androidx.leanback.app.BrowseSupportFragment


A fragment for creating Leanback browse screens. It is composed of a RowsSupportFragment and a HeadersSupportFragment.

A BrowseSupportFragment renders the elements of its ObjectAdapter as a set of rows in a vertical list. The elements in this adapter must be subclasses of Row.

The HeadersSupportFragment can be set to be either shown or hidden by default, or may be disabled entirely. See setHeadersState(int) for details.

By default the BrowseSupportFragment includes support for returning to the headers when the user presses Back. For Activities that customize ComponentActivity.onBackPressed(), you must disable this default Back key support by calling setHeadersTransitionOnBackEnabled(boolean) with false and use BrowseSupportFragment.BrowseTransitionListener and startHeadersTransition(boolean).

The recommended theme to use with a BrowseSupportFragment is R.style.Theme_Leanback_Browse.

Summary

Nested classes

class BrowseSupportFragment.BrowseTransitionListener

Listener for transitions between browse headers and rows. 

class BrowseSupportFragment.FragmentFactory<T extends Fragment>

Factory class responsible for creating fragment given the current item. 

interface BrowseSupportFragment.FragmentHost

Possible set of actions that BrowseSupportFragment exposes to clients. 

class BrowseSupportFragment.ListRowFragmentFactory

FragmentFactory implementation for ListRow

class BrowseSupportFragment.MainFragmentAdapter<T extends Fragment>

Interface that defines the interaction between BrowseSupportFragment and its main content fragment. 

interface BrowseSupportFragment.MainFragmentAdapterProvider

Interface to be implemented by all fragments for providing an instance of BrowseSupportFragment.MainFragmentAdapter

class BrowseSupportFragment.MainFragmentAdapterRegistry

Registry class maintaining the mapping of Row subclasses to BrowseSupportFragment.FragmentFactory

class BrowseSupportFragment.MainFragmentRowsAdapter<T extends Fragment>

This is used to pass information to RowsSupportFragment or its subclasses. 

interface BrowseSupportFragment.MainFragmentRowsAdapterProvider

Interface to be implemented by RowsSupportFragment and its subclasses for providing an instance of BrowseSupportFragment.MainFragmentRowsAdapter

Constants

int HEADERS_DISABLED

The headers fragment is disabled and will never be shown.

int HEADERS_ENABLED

The headers fragment is enabled and shown by default.

int HEADERS_HIDDEN

The headers fragment is enabled and hidden by default.

Public constructors

BrowseSupportFragment()

Public methods

static Bundle createArgs(Bundle args, String title, int headersState)

Creates arguments for a browse fragment.

void enableMainFragmentScaling(boolean enable)

Enables scaling of main fragment when headers are present.

void enableRowScaling(boolean enable)

This method is deprecated. use enableMainFragmentScaling(boolean) instead.

ObjectAdapter getAdapter()

Returns the adapter containing the rows for the fragment.

int getBrandColor()

Returns the brand color for the browse fragment.

int getHeadersState()

Returns the state of the headers column in the browse fragment.

HeadersSupportFragment getHeadersSupportFragment()

Get currently bound HeadersSupportFragment or null if HeadersSupportFragment has not been created yet.

Fragment getMainFragment()
final BrowseSupportFragment.MainFragmentAdapterRegistry getMainFragmentRegistry()
OnItemViewClickedListener getOnItemViewClickedListener()

Returns the item Clicked listener.

OnItemViewSelectedListener getOnItemViewSelectedListener()

Returns an item selection listener.

RowsSupportFragment getRowsSupportFragment()

Get RowsSupportFragment if it's bound to BrowseSupportFragment or null if either BrowseSupportFragment has not been created yet or a different fragment is bound to it.

int