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

DetailsFragment

open class DetailsFragment : BaseFragment
kotlin.Any
   ↳ android.app.Fragment
   ↳ androidx.leanback.app.BrandedFragment
   ↳ androidx.leanback.app.BaseFragment
   ↳ androidx.leanback.app.DetailsFragment

A fragment for creating Leanback details screens.

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

When FullWidthDetailsOverviewRowPresenter is found in adapter, DetailsFragment will setup default behavior of the DetailsOverviewRow:
  • The alignment of FullWidthDetailsOverviewRowPresenter is setup in setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter).
  • The view status switching of FullWidthDetailsOverviewRowPresenter is done in onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter, * FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int).
  • The recommended activity themes to use with a DetailsFragment are

  • androidx.leanback.R.style#Theme_Leanback_Details with activity shared element transition for FullWidthDetailsOverviewRowPresenter.
  • androidx.leanback.R.style#Theme_Leanback_Details_NoSharedElementTransition if shared element transition is not needed, for example if first row is not rendered by FullWidthDetailsOverviewRowPresenter.
  • DetailsFragment can use DetailsFragmentBackgroundController to add a parallax drawable background and embedded video playing fragment.

    Summary

    Public constructors

    A fragment for creating Leanback details screens.

    Public methods
    open ObjectAdapter!

    Returns the list of rows.

    open BaseOnItemViewClickedListener<Any!>!

    Returns the item clicked listener.

    open DetailsParallax!

    Returns the DetailsParallax instance used by DetailsFragmentBackgroundController to configure parallax effect of background and control embedded video playback.

    open RowsFragment!

    Gets embedded RowsFragment showing multiple rows for DetailsFragment.

    open Unit
    onCreate(savedInstanceState: Bundle?)

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

    open Unit

    open View!
    onInflateTitleView(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!)

    open Unit

    open Unit

    open Unit

    Sets the list of rows for the fragment.

    open Unit

    Sets an item clicked listener.

    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.

    Protected methods
    open Any!

    open View!
    inflateTitle(inflater: LayoutInflater!, parent: ViewGroup!, savedInstanceState: Bundle!)

    open Unit

    open Unit

    open Unit

    open Unit
    onSetDetailsOverviewRowStatus(presenter: FullWidthDetailsOverviewRowPresenter!, viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!, adapterPosition: Int, selectedPosition: Int, selectedSubPosition: Int)

    Called to change DetailsOverviewRow view status when current selected row position or selected sub position changed.

    open Unit
    onSetRowStatus(presenter: RowPresenter!, viewHolder: RowPresenter.ViewHolder!, adapterPosition: Int, selectedPosition: Int, selectedSubPosition: Int)

    Called on every visible row to change view status when current selected row position or selected sub position changed.

    open Unit
    runEntranceTransition(entranceTransition: Any!)

    open Unit

    Called to setup FullWidthDetailsOverviewRowPresenter.

    open Unit
    setupPresenter(rowPresenter: Presenter!)

    Called to setup each Presenter of Adapter passed in setAdapter(ObjectAdapter).

    Inherited functions

    Public constructors

    <init>

    DetailsFragment()

    Deprecated: use DetailsSupportFragment

    A fragment for creating Leanback details screens.

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

    When FullWidthDetailsOverviewRowPresenter is found in adapter, DetailsFragment will setup default behavior of the DetailsOverviewRow:
  • The alignment of FullWidthDetailsOverviewRowPresenter is setup in setupDetailsOverviewRowPresenter(FullWidthDetailsOverviewRowPresenter).
  • The view status switching of FullWidthDetailsOverviewRowPresenter is done in onSetDetailsOverviewRowStatus(FullWidthDetailsOverviewRowPresenter, * FullWidthDetailsOverviewRowPresenter.ViewHolder, int, int, int).
  • The recommended activity themes to use with a DetailsFragment are

  • androidx.leanback.R.style#Theme_Leanback_Details with activity shared element transition for FullWidthDetailsOverviewRowPresenter.
  • androidx.leanback.R.style#Theme_Leanback_Details_NoSharedElementTransition if shared element transition is not needed, for example if first row is not rendered by FullWidthDetailsOverviewRowPresenter.
  • DetailsFragment can use DetailsFragmentBackgroundController to add a parallax drawable background and embedded video playing fragment.

    Public methods

    getAdapter

    open fun getAdapter(): ObjectAdapter!

    Returns the list of rows.

    getOnItemViewClickedListener

    open fun getOnItemViewClickedListener(): BaseOnItemViewClickedListener<Any!>!

    Returns the item clicked listener.

    getParallax

    open fun getParallax(): DetailsParallax!

    Returns the DetailsParallax instance used by DetailsFragmentBackgroundController to configure parallax effect of background and control embedded video playback. App usually does not use this method directly. App may use this method for other custom parallax tasks.

    Return
    DetailsParallax! The DetailsParallax instance attached to the DetailsFragment.

    getRowsFragment

    open fun getRowsFragment(): RowsFragment!

    Gets embedded RowsFragment showing multiple rows for DetailsFragment. If view of DetailsFragment is not created, the method returns null.

    Return
    RowsFragment! Embedded RowsFragment showing multiple rows for DetailsFragment.

    onCreate

    open fun onCreate(savedInstanceState: Bundle?): Unit

    onCreateView

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

    onDestroyView

    open fun onDestroyView(): Unit

    onInflateTitleView

    open fun onInflateTitleView(
        inflater: LayoutInflater!,
        parent: ViewGroup!,
        savedInstanceState: Bundle!
    ): View!

    onStart

    open fun onS