BrowseFragment

public class BrowseFragment
extends BaseFragment

java.lang.Object
   ↳ android.app.Fragment
     ↳ androidx.leanback.app.BrandedFragment
       ↳ androidx.leanback.app.BaseFragment
         ↳ androidx.leanback.app.BrowseFragment


This class is deprecated.
use BrowseSupportFragment

A fragment for creating Leanback browse screens. It is composed of a RowsFragment and a HeadersFragment.

A BrowseFragment 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 HeadersFragment can be set to be either shown or hidden by default, or may be disabled entirely. See setHeadersState(int) for details.

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

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

Summary

Nested classes

class BrowseFragment.BrowseTransitionListener

This class is deprecated. use BrowseSupportFragment  

class BrowseFragment.FragmentFactory<T extends Fragment>

This class is deprecated. use BrowseSupportFragment  

interface BrowseFragment.FragmentHost

This interface is deprecated. use BrowseSupportFragment  

class BrowseFragment.ListRowFragmentFactory

This class is deprecated. use BrowseSupportFragment  

class BrowseFragment.MainFragmentAdapter<T extends Fragment>

This class is deprecated. use BrowseSupportFragment  

interface BrowseFragment.MainFragmentAdapterProvider

This interface is deprecated. use BrowseSupportFragment  

class BrowseFragment.MainFragmentAdapterRegistry

This class is deprecated. use BrowseSupportFragment  

class BrowseFragment.MainFragmentRowsAdapter<T extends Fragment>

This class is deprecated. use BrowseSupportFragment  

interface BrowseFragment.MainFragmentRowsAdapterProvider

This interface is deprecated. use BrowseSupportFragment  

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.

Inherited constants

Public constructors

BrowseFragment()

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.

HeadersFragment getHeadersFragment()

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

int getHeadersState()

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

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

Returns the item Clicked listener.

OnItemViewSelectedListener getOnItemViewSelectedListener()

Returns an item selection listener.

RowsFragment getRowsFragment()

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

int getSelectedPosition()

Gets position of currently selected row.

RowPresenter.ViewHolder getSelectedRowViewHolder()
final boolean isHeadersTransitionOnBackEnabled()

Returns true if headers transition on back key support is enabled.

boolean isInHeadersTransition()

Returns true if the headers transition is currently running.

boolean isShowingHeaders()

Returns true if headers are shown.

void onCreate(Bundle savedInstanceState)
HeadersFragment onCreateHeadersFragment()

Creates a new HeadersFragment instance.

View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void onDestroy()
void onDestroyView()
void onSaveInstanceState(Bundle outState)
void onStart()
void onStop()
void setAdapter(ObjectAdapter adapter)

Sets the adapter containing the rows for the fragment.

void setBrandColor(int color)

Sets the brand color for the browse fragment.

void setBrowseTransitionListener(BrowseFragment.BrowseTransitionListener listener)

Sets a listener for browse fragment transitions.

void setHeaderPresenterSelector(PresenterSelector headerPresenterSelector)

Sets the PresenterSelector used to render the row headers.

void setHeadersState(int headersState)

Sets the state for the headers column in the browse fragment.

final void setHeadersTransitionOnBackEnabled(boolean headersBackStackEnabled)

Enables/disables headers transition on back key support.

void setOnItemViewClickedListener(OnItemViewClickedListener listener)

Sets an item clicked listener on the fragment.

void setOnItemViewSelectedListener(OnItemViewSelectedListener listener)

Sets an item selection listener.

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.

void startHeadersTransition(boolean withHeaders)

Starts a headers transition.

Protected methods

Object createEntranceTransition()

Create entrance transition.

void onEntranceTransitionEnd()

Callback when entrance transition is ended.

void onEntranceTransitionPrepare()

Callback when entrance transition is prepared.

void onEntranceTransitionStart()

Callback when entrance transition is started.

void runEntranceTransition(Object entranceTransition)

Run entrance transition.

Inherited methods