DetailsFragment

Added in 1.1.0
Deprecated in 1.1.0

class DetailsFragment : BaseFragment


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 recommended activity themes to use with a DetailsFragment are

DetailsFragment can use DetailsFragmentBackgroundController to add a parallax drawable background and embedded video playing fragment.

Summary

Public constructors

Public functions

ObjectAdapter!

Returns the list of rows.

BaseOnItemViewClickedListener!

Returns the item clicked listener.

DetailsParallax!

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

RowsFragment!

Gets embedded RowsFragment showing multiple rows for DetailsFragment.

Unit
onCreate(savedInstanceState: Bundle!)

This function is deprecated.

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

This function is deprecated.

Unit

This function is deprecated.

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

Called by installTitleView to inflate title view.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

Sets the list of rows for the fragment.

Unit

Sets an item clicked listener.

Unit

Sets an item selection listener.

Unit

Sets the selected row position with smooth animation.

Unit
setSelectedPosition(position: Int, smooth: Boolean)

Sets the selected row position.

Protected functions

Any!

Create entrance transition.

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

This function is deprecated.

override onInflateTitleView instead.

Unit

Callback when entrance transition is ended.

Unit

Callback when entrance transition is prepared.

Unit

Callback when entrance transition is started.

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.

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.

Unit
runEntranceTransition(entranceTransition: Any!)

Run entrance transition.

Unit

Called to setup FullWidthDetailsOverviewRowPresenter.

Unit
setupPresenter(rowPresenter: Presenter!)

Called to setup each Presenter of Adapter passed in setAdapter.Note that setup should only change the Presenter behavior that is meaningful in DetailsFragment.

Inherited functions

From androidx.leanback.app.BaseFragment
ProgressBarManager!

Returns the ProgressBarManager.

Unit
onViewCreated(view: View, savedInstanceState: Bundle?)

This function is deprecated.

Unit

Enables entrance transition.

Unit

When fragment finishes loading data, it should call startEntranceTransition() to execute the entrance transition. startEntranceTransition() will start transition only if both two conditions are satisfied:

From androidx.leanback.app.BrandedFragment
Drawable?

Returns the badge drawable used in the fragment title.

Int

Returns the color used to draw the search affordance.

SearchOrbView.Colors?

Returns the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

CharSequence?

Returns the title text for the fragment.

View?

Returns the view that implements TitleViewAdapter.Provider.

TitleViewAdapter?

Returns the TitleViewAdapter implemented by title view.

Unit
installTitleView(
    inflater: LayoutInflater,
    parent: ViewGroup,
    savedInstanceState: Bundle?
)

Inflate title view and add to parent.

Boolean

Returns true/false to indicate the visibility of TitleView.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

Sets the drawable displayed in the fragment title.

Unit

Sets a click listener for the search affordance.

Unit

Sets the color used to draw the search affordance.

Unit

Sets the androidx.leanback.widget.SearchOrbView.Colors used to draw the search affordance.

Unit

Sets title text for the fragment.

Unit
setTitleView(titleView: View?)

Sets the view that implemented TitleViewAdapter.

Unit
showTitle(flags: Int)

Changes title view's components visibility and shows title.

Unit

Shows or hides the title view.

From android.app.Fragment
Unit
dump(
    prefix: String!,
    fd: FileDescriptor!,
    writer: PrintWriter!,
    args: Array<String!>!
)

This function is deprecated.

Boolean
equals(o: Any!)

This function is deprecated.

Activity!

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Bundle!

This function is deprecated.

FragmentManager!

This function is deprecated.

Context!

This function is deprecated.

Transition!

This function is deprecated.

Transition!

This function is deprecated.

FragmentManager!

This function is deprecated.

Any!

This function is deprecated.

Int

This function is deprecated.

LayoutInflater!

This function is deprecated.

LoaderManager!

This function is deprecated.

Fragment!

This function is deprecated.

Transition!

This function is deprecated.

Resources!

This function is deprecated.

Boolean

This function is deprecated.

Transition!

This function is deprecated.

Transition!

This function is deprecated.

Transition!

This function is deprecated.

String!
getString(resId: Int)

This function is deprecated.

String!

This function is deprecated.

Fragment!

This function is deprecated.

Int

This function is deprecated.

CharSequence!
getText(resId: Int)

This function is deprecated.

Boolean

This function is deprecated.

View!

This function is deprecated.

Int

This function is deprecated.

java-static Fragment!
instantiate(context: Context!, fname: String!)

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Boolean

This function is deprecated.

Unit
onActivityCreated(savedInstanceState: Bundle!)

This function is deprecated.

Unit
onActivityResult(requestCode: Int, resultCode: Int, data: Intent!)

This function is deprecated.

Unit
onAttach(context: Context!)

This function is deprecated.

Unit
onAttachFragment(childFragment: Fragment!)

This function is deprecated.

Unit

This function is deprecated.

Boolean

This function is deprecated.

Unit
onCreate(savedInstanceState: Bundle!)

This function is deprecated.

Animator!
onCreateAnimator(transit: Int, enter: Boolean, nextAnim: Int)

This function is deprecated.

Unit
onCreateContextMenu(
    menu: ContextMenu!,
    v: View!,
    menuInfo: ContextMenu.ContextMenuInfo!
)

This function is deprecated.

Unit
onCreateOptionsMenu(menu: Menu!, inflater: MenuInflater!)

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

LayoutInflater!
onGetLayoutInflater(savedInstanceState: Bundle!)

This function is deprecated.

Unit

This function is deprecated.

Unit
onInflate(attrs: AttributeSet!, savedInstanceState: Bundle!)

This function is deprecated.

Unit

This function is deprecated.

Unit
onMultiWindowModeChanged(
    isInMultiWindowMode: Boolean,
    newConfig: Configuration!
)

This function is deprecated.

Boolean

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
onPictureInPictureModeChanged(
    isInPictureInPictureMode: Boolean,
    newConfig: Configuration!
)

This function is deprecated.

Unit

This function is deprecated.

Unit
onRequestPermissionsResult(
    requestCode: Int,
    permissions: Array<String!>!,
    grantResults: IntArray!
)

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
onTrimMemory(level: Int)

This function is deprecated.

Unit
onViewCreated(view: View!, savedInstanceState: Bundle!)

This function is deprecated.

Unit
onViewStateRestored(savedInstanceState: Bundle!)

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
requestPermissions(permissions: Array<String!>!, requestCode: Int)

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
setMenuVisibility(menuVisible: Boolean)

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit

This function is deprecated.

Unit
setTargetFragment(fragment: Fragment!, requestCode: Int)

This function is deprecated.

Unit
setUserVisibleHint(isVisibleToUser: Boolean)

This function is deprecated.

Boolean

This function is deprecated.

Unit

This function is deprecated.

Unit
startActivityForResult(intent: Intent!, requestCode: Int)

This function is deprecated.

Unit
startIntentSenderForResult(
    intent: IntentSender!,
    requestCode: Int,
    fillInIntent: Intent!,
    flagsMask: Int,
    flagsValues: Int,
    extraFlags: Int,
    options: Bundle!
)

This function is deprecated.

Unit

This function is deprecated.

String!

This function is deprecated.

Unit

This function is deprecated.

Public constructors

DetailsFragment

Added in 1.1.0
Deprecated in 1.1.0
DetailsFragment()

Public functions

getAdapter

Added in 1.1.0
Deprecated in 1.1.0
fun getAdapter(): ObjectAdapter!

Returns the list of rows.

getOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
fun getOnItemViewClickedListener(): BaseOnItemViewClickedListener!

Returns the item clicked listener.

getParallax

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

Returns
DetailsParallax!

The DetailsParallax instance attached to the DetailsFragment.

getRowsFragment

Added in 1.1.0
Deprecated in 1.1.0
fun getRowsFragment(): RowsFragment!

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

Returns
RowsFragment!

Embedded RowsFragment showing multiple rows for DetailsFragment.

onCreate

fun onCreate(savedInstanceState: Bundle!): Unit

onCreateView

Added in 1.1.0
Deprecated in 1.1.0
fun onCreateView(
    inflater: LayoutInflater!,
    container: ViewGroup?,
    savedInstanceState: Bundle!
): View?

onDestroyView

fun onDestroyView(): Unit

onInflateTitleView

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

Called by installTitleView to inflate title view. Default implementation uses layout file lb_browse_title. Subclass may override and use its own layout, the layout must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider. Subclass may return null if no title is needed.

Parameters
inflater: LayoutInflater

The LayoutInflater object that can be used to inflate any views in the fragment,

parent: ViewGroup?

Parent of title view.

savedInstanceState: Bundle?

If non-null, this fragment is being re-constructed from a previous saved state as given here.

Returns
View

Title view which must have a descendant with id browse_title_group that implements TitleViewAdapter.Provider, or null for no title view.

onStart

fun onStart(): Unit

onStop

Added in 1.1.0
Deprecated in 1.1.0
fun onStop(): Unit

setAdapter

Added in 1.1.0
Deprecated in 1.1.0
fun setAdapter(adapter: ObjectAdapter!): Unit

Sets the list of rows for the fragment.

setOnItemViewClickedListener

Added in 1.1.0
Deprecated in 1.1.0
fun setOnItemViewClickedListener(listener: BaseOnItemViewClickedListener!): Unit

Sets an item clicked listener.

setOnItemViewSelectedListener

Added in 1.1.0
Deprecated in 1.1.0
fun setOnItemViewSelectedListener(listener: BaseOnItemViewSelectedListener!): Unit

Sets an item selection listener.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
fun setSelectedPosition(position: Int): Unit

Sets the selected row position with smooth animation.

setSelectedPosition

Added in 1.1.0
Deprecated in 1.1.0
fun setSelectedPosition(position: Int, smooth: Boolean): Unit

Sets the selected row position.

Protected functions

createEntranceTransition

protected fun createEntranceTransition(): Any!

Create entrance transition. Subclass can override to load transition from resource or construct manually. Typically app does not need to override the default transition that browse and details provides.

inflateTitle

Added in 1.1.0
Deprecated in 1.1.0
protected fun inflateTitle(
    inflater: LayoutInflater!,
    parent: ViewGroup!,
    savedInstanceState: Bundle!
): View!

onEntranceTransitionEnd

protected fun onEntranceTransitionEnd(): Unit

Callback when entrance transition is ended.

onEntranceTransitionPrepare

protected fun onEntranceTransitionPrepare(): Unit

Callback when entrance transition is prepared. This is when fragment should stop user input and animations.

onEntranceTransitionStart

protected fun onEntranceTransitionStart(): Unit

Callback when entrance transition is started. This is when fragment should stop processing layout.

onSetDetailsOverviewRowStatus

Added in 1.1.0
Deprecated in 1.1.0
protected fun onSetDetailsOverviewRowStatus(
    presenter: FullWidthDetailsOverviewRowPresenter!,
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    adapterPosition: Int,
    selectedPosition: Int,
    selectedSubPosition: Int
): Unit

Called to change DetailsOverviewRow view status when current selected row position or selected sub position changed. Subclass may override. The default implementation switches between three states based on the positions: STATE_HALF, STATE_FULL and STATE_SMALL.

Parameters
presenter: FullWidthDetailsOverviewRowPresenter!

The presenter used to create row ViewHolder.

viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The visible (attached) row ViewHolder, note that it may or may not be selected.

adapterPosition: Int

The adapter position of viewHolder inside adapter.

selectedPosition: Int

The adapter position of currently selected row.

selectedSubPosition: Int

The sub position within currently selected row. This is used When a row has multiple alignment positions.

onSetRowStatus

Added in 1.1.0
Deprecated in 1.1.0
protected fun onSetRowStatus(
    presenter: RowPresenter!,
    viewHolder: RowPresenter.ViewHolder!,
    adapterPosition: Int,
    selectedPosition: Int,
    selectedSubPosition: Int
): Unit

Called on every visible row to change view status when current selected row position or selected sub position changed. Subclass may override. The default implementation calls onSetDetailsOverviewRowStatus if presenter is instance of FullWidthDetailsOverviewRowPresenter.

Parameters
presenter: RowPresenter!

The presenter used to create row ViewHolder.

viewHolder: RowPresenter.ViewHolder!

The visible (attached) row ViewHolder, note that it may or may not be selected.

adapterPosition: Int

The adapter position of viewHolder inside adapter.

selectedPosition: Int

The adapter position of currently selected row.

selectedSubPosition: Int

The sub position within currently selected row. This is used When a row has multiple alignment positions.

runEntranceTransition

protected fun runEntranceTransition(entranceTransition: Any!): Unit

Run entrance transition. Subclass may use TransitionManager to perform go(Scene) or beginDelayedTransition(). App should not override the default implementation of browse and details fragment.

setupDetailsOverviewRowPresenter

Added in 1.1.0
Deprecated in 1.1.0
protected fun setupDetailsOverviewRowPresenter(
    presenter: FullWidthDetailsOverviewRowPresenter!
): Unit

Called to setup FullWidthDetailsOverviewRowPresenter. The default implementation adds two alignment positions(ItemAlignmentFacet) for ViewHolder of FullWidthDetailsOverviewRowPresenter to align in fragment.

setupPresenter

Added in 1.1.0
Deprecated in 1.1.0
protected fun setupPresenter(rowPresenter: Presenter!): Unit

Called to setup each Presenter of Adapter passed in setAdapter.Note that setup should only change the Presenter behavior that is meaningful in DetailsFragment. For example how a row is aligned in details Fragment. The default implementation invokes setupDetailsOverviewRowPresenter