Google is committed to advancing racial equity for Black communities. See how.

BrowseSupportFragment

open class BrowseSupportFragment : BaseSupportFragment
kotlin.Any
   ↳ 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 for details.

By default the BrowseSupportFragment includes support for returning to the headers when the user presses Back. For Activities that customize , 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 androidx.leanback.R.style#Theme_Leanback_Browse.

Summary

Nested classes
open

Listener for transitions between browse headers and rows.

abstract

Factory class responsible for creating fragment given the current item.

abstract

Possible set of actions that BrowseSupportFragment exposes to clients.

open

FragmentFactory implementation for ListRow.

open

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

abstract

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

Registry class maintaining the mapping of Row subclasses to FragmentFactory.

open

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

abstract

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

Constants
static Int

The headers fragment is disabled and will never be shown.

static Int

The headers fragment is enabled and shown by default.

static Int

The headers fragment is enabled and hidden by default.

Public constructors

A fragment for creating Leanback browse screens.

Public methods
open static Bundle!
createArgs(args: Bundle!, title: String!, headersState: Int)

Creates arguments for a browse fragment.

open Unit

Enables scaling of main fragment when headers are present.

open Unit

open ObjectAdapter!

Returns the adapter containing the rows for the fragment.

open Int

Returns the brand color for the browse fragment.

open Int

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

open HeadersSupportFragment!

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

open Fragment!

BrowseSupportFragment.MainFragmentAdapterRegistry!

open OnItemViewClickedListener!

Returns the item Clicked listener.

open OnItemViewSelectedListener!

Returns an item selection listener.

open RowsSupportFragment!

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.

open Int

Gets position of currently selected row.

open RowPresenter.ViewHolder!

Boolean

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

open Boolean

Returns true if the headers transition is currently running.

open Boolean

Returns true if headers are shown.

open Unit
onCreate(savedInstanceState: Bundle?)

open HeadersSupportFragment!

Creates a new HeadersSupportFragment instance.

open View?
onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?)

open Unit

open Unit

open Unit

open Unit

open Unit

open Unit

Sets the adapter containing the rows for the fragment.

open Unit
setBrandColor(@ColorInt color: Int)

Sets the brand color for the browse fragment.

open Unit

Sets a listener for browse fragment transitions.

open Unit
setHeaderPresenterSelector(headerPresenterSelector: PresenterSelector!)

Sets the PresenterSelector used to render the row headers.

open Unit
setHeadersState(headersState: Int)

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

Unit
setHeadersTransitionOnBackEnabled(headersBackStackEnabled: Boolean)

Enables/disables headers transition on back key support.

open Unit

Sets an item clicked listener on the fragment.

open Unit

Sets an item selection listener.

open Unit

Sets the selected row position with smooth animation.

open Unit
setSelectedPosition(position: Int, smooth: Boolean)

Sets the selected row position.

open Unit
setSelectedPosition(rowPosition: Int, smooth: Boolean, rowHolderTask: Presenter.ViewHolderTask!)

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

open Unit

Starts a headers transition.

Protected methods
open Any!

open Unit

open Unit

open Unit

open Unit
runEntranceTransition(entranceTransition: Any!)

Inherited functions