FullWidthDetailsOverviewRowPresenter


class FullWidthDetailsOverviewRowPresenter : RowPresenter


Renders a DetailsOverviewRow to display an overview of an item. Typically this row will be the first row in a fragment such as the androidx.leanback.app.DetailsFragment. The View created by the FullWidthDetailsOverviewRowPresenter is made in three parts: logo view on the left, action list view on the top and a customizable detailed description view on the right.

The detailed description is rendered using a Presenter passed in FullWidthDetailsOverviewRowPresenter. Typically this will be an instance of AbstractDetailsDescriptionPresenter. The application can access the detailed description ViewHolder from getDetailsDescriptionViewHolder.

The logo view is rendered using a customizable DetailsOverviewLogoPresenter passed in FullWidthDetailsOverviewRowPresenter. The application can access the logo ViewHolder from getLogoViewHolder.

To support activity shared element transition, call setListener with FullWidthDetailsOverviewSharedElementHelper during Activity's onCreate(). Application is free to create its own "shared element helper" class using the Listener for image binding. Call setParticipatingEntranceTransition with false

The view has three states: STATE_HALFSTATE_FULL and STATE_SMALL. See androidx.leanback.app.DetailsFragment where it switches states based on selected row position.

Summary

Constants

const Int

This is the alignment mode that the ending edge of logo and the starting edge of description align to the middle of the overview view.

const Int

This is the alignment mode that the logo and description align to the starting edge of the overview view.

const Int

This is the state when the view covers full width and height of screen.

const Int

This is the default state corresponding to layout file.

const Int

This is the state where the view shrinks to a small banner.

Public constructors

Constructor for a FullWidthDetailsOverviewRowPresenter.

FullWidthDetailsOverviewRowPresenter(
    detailsPresenter: Presenter!,
    logoPresenter: DetailsOverviewLogoPresenter!
)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Public functions

Int

Returns the background color of actions.

Int

Returns alignment mode of Description.

Int

Returns the background color.

Int

Returns the initial state used to create ViewHolder.

OnActionClickedListener!

Returns the listener for Action click events.

Boolean

Returns true if the overview should be part of shared element transition.

Boolean

Returns true if this RowPresenter is using the default dimming effect.

Unit

Called by DetailsOverviewLogoPresenter to notify logo was bound to view.

Unit

Sets the background color for Action Bar.

Unit
setAlignmentMode(alignmentMode: Int)

Set alignment mode of Description.

Unit

Sets the background color.

Unit
setEntranceTransitionState(
    holder: RowPresenter.ViewHolder,
    afterEntrance: Boolean
)

Changes the visibility of views.

Unit

Change the initial state used to create ViewHolder.

Unit

Set listener for details overview presenter.

Unit

Sets the listener for Action click events.

Unit

Sets if the overview should be part of shared element transition.

Unit
setState(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    state: Int
)

Switch state of a ViewHolder.

Protected functions

RowPresenter.ViewHolder!

Called to create a ViewHolder object for a Row.

Int

Get resource id to inflate the layout.

Boolean

Returns true if the Row view should clip its children.

Unit

Binds the given row object to the given ViewHolder.

Unit
onLayoutLogo(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int,
    logoChanged: Boolean
)

Layout logo position based on current state.

Unit
onLayoutOverviewFrame(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int,
    logoChanged: Boolean
)

Layout overview frame based on current state.

Unit

Invoked when the row view is attached to the window.

Unit

Invoked when the row view is detached from the window.

Unit

Callback when the select level changes.

Unit
onStateChanged(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int
)

Called when getState changes.

Unit

Unbinds the given ViewHolder.

Protected properties

Int

Inherited Constants

From androidx.leanback.widget.RowPresenter
const Int

Don't synchronize row view activated status with selected status or expanded status, application will do its own through setActivated.

const Int

Synchronizes row view's activated status to expand status of the row view holder.

const Int

Sets the row view's activated status to true when both expand and selected are true.

const Int

Synchronizes row view's activated status to selected status of the row view holder.

Inherited functions

From androidx.leanback.widget.FacetProvider
abstract Any?
getFacet(facetClass: Class<Any!>)

Queries optional implemented facet.

From androidx.leanback.widget.Presenter
java-static Unit

Utility method for removing all running animations on a view.

Any!
getFacet(facetClass: Class<Any!>!)

Queries optional implemented facet.

abstract Unit
onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any?)

Binds a View to an item.

Unit
onBindViewHolder(
    viewHolder: Presenter.ViewHolder,
    item: Any,
    payloads: (Mutable)List<Any!>
)

Binds a View to an item with a list of payloads.

abstract Presenter.ViewHolder

Creates a new View.

abstract Unit

Unbinds a View from an item.

Unit

Called when a view created by this presenter has been attached to a window.

Unit

Called when a view created by this presenter has been detached from its window.

Unit
setFacet(facetClass: Class<Any!>!, facetImpl: Any!)

Sets dynamic implemented facet in addition to basic Presenter functions.

Unit
setOnClickListener(
    holder: Presenter.ViewHolder!,
    listener: View.OnClickListener!
)

Called to set a click listener for the given view holder.

From androidx.leanback.widget.RowPresenter
Unit

This method is only called from onRowViewSelected onRowViewSelected.

Unit

Freezes/unfreezes the row, typically used when a transition starts/ends.

RowHeaderPresenter!

Returns the Presenter used for rendering the header, or null if none has been set.

RowPresenter.ViewHolder!

Returns the RowPresenter.ViewHolder from the given RowPresenter ViewHolder.

Boolean

Returns true if the row selection effect is enabled.

Float

Returns the current select level.

Int

Returns the policy of updating row view activated status.

Unit

Called after a RowPresenter.ViewHolder is created for a Row.

Unit
onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any?)

Binds a View to an item.

Presenter.ViewHolder!

Creates a new View.

Unit

Called when the row view's expanded state changes.

Unit

Called when the given row view changes selection state.

Unit

Unbinds a View from an item.

Unit

Called when a view created by this presenter has been attached to a window.

Unit

Called when a view created by this presenter has been detached from its window.

Unit

Sets the Presenter used for rendering the header.

Unit

Sets the expanded state of a Row view.

Unit

Sets the selected state of a Row view.

Unit
setSelectEffectEnabled(applyDimOnSelect: Boolean)

Enables or disables the row selection effect.

Unit

Sets the current select level to a value between 0 (unselected) and 1 (selected).

Unit
setSyncActivatePolicy(syncActivatePolicy: Int)

Sets the policy of updating row view activated status.

Constants

ALIGN_MODE_MIDDLE

Added in 1.1.0
const val ALIGN_MODE_MIDDLE = 1: Int

This is the alignment mode that the ending edge of logo and the starting edge of description align to the middle of the overview view. Note that this might not be the exact horizontal center of the overview view.

ALIGN_MODE_START

Added in 1.1.0
const val ALIGN_MODE_START = 0: Int

This is the alignment mode that the logo and description align to the starting edge of the overview view.

STATE_FULL

Added in 1.1.0
const val STATE_FULL = 1: Int

This is the state when the view covers full width and height of screen.

STATE_HALF

Added in 1.1.0
const val STATE_HALF = 0: Int

This is the default state corresponding to layout file. The view takes full width of screen and covers bottom half of the screen.

STATE_SMALL

Added in 1.1.0
const val STATE_SMALL = 2: Int

This is the state where the view shrinks to a small banner.

Public constructors

FullWidthDetailsOverviewRowPresenter

Added in 1.1.0
FullWidthDetailsOverviewRowPresenter(detailsPresenter: Presenter!)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Parameters
detailsPresenter: Presenter!

The Presenter used to render the detailed description of the row.

FullWidthDetailsOverviewRowPresenter

Added in 1.1.0
FullWidthDetailsOverviewRowPresenter(
    detailsPresenter: Presenter!,
    logoPresenter: DetailsOverviewLogoPresenter!
)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Parameters
detailsPresenter: Presenter!

The Presenter used to render the detailed description of the row.

logoPresenter: DetailsOverviewLogoPresenter!

The Presenter used to render the logo view.

Public functions

getActionsBackgroundColor

Added in 1.1.0
fun getActionsBackgroundColor(): Int

Returns the background color of actions. If setActionsBackgroundColor is not called, transparent is returned.

getAlignmentMode

Added in 1.1.0
fun getAlignmentMode(): Int

Returns alignment mode of Description.

getBackgroundColor

Added in 1.1.0
fun getBackgroundColor(): Int

Returns the background color. If setBackgroundColor, transparent is returned.

getInitialState

Added in 1.1.0
fun getInitialState(): Int

Returns the initial state used to create ViewHolder.

getOnActionClickedListener

Added in 1.1.0
fun getOnActionClickedListener(): OnActionClickedListener!

Returns the listener for Action click events.

isParticipatingEntranceTransition

Added in 1.1.0
fun isParticipatingEntranceTransition(): Boolean

Returns true if the overview should be part of shared element transition.

isUsingDefaultSelectEffect

Added in 1.2.0-alpha04
fun isUsingDefaultSelectEffect(): Boolean

Returns true if this RowPresenter is using the default dimming effect. A subclass may (most likely) return false and override onSelectLevelChanged.

notifyOnBindLogo

Added in 1.1.0
fun notifyOnBindLogo(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!
): Unit

Called by DetailsOverviewLogoPresenter to notify logo was bound to view. Application should not directly call this method.

Parameters
viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The row ViewHolder that has logo bound to view.

setActionsBackgroundColor

Added in 1.1.0
fun setActionsBackgroundColor(color: Int): Unit

Sets the background color for Action Bar. If not set, a default from the theme will be used.

setAlignmentMode

Added in 1.1.0
fun setAlignmentMode(alignmentMode: Int): Unit

Set alignment mode of Description.

Parameters
alignmentMode: Int

One of ALIGN_MODE_MIDDLE or ALIGN_MODE_START

setBackgroundColor

Added in 1.1.0
fun setBackgroundColor(color: Int): Unit

Sets the background color. If not set, a default from the theme will be used.

setEntranceTransitionState

fun setEntranceTransitionState(
    holder: RowPresenter.ViewHolder,
    afterEntrance: Boolean
): Unit

Changes the visibility of views. The entrance transition will be run against the views that change visibilities. A subclass may override and begin with calling super.setEntranceTransitionState(). This method is called by the fragment, it should not be called directly by the application.

Parameters
holder: RowPresenter.ViewHolder

The ViewHolder of the row.

afterEntrance: Boolean

true if children of row participating in entrance transition should be set to visible, false otherwise.

setInitialState

Added in 1.1.0
fun setInitialState(state: Int): Unit

Change the initial state used to create ViewHolder.

setListener

Added in 1.1.0
fun setListener(listener: FullWidthDetailsOverviewRowPresenter.Listener!): Unit

Set listener for details overview presenter. Must be called before creating ViewHolder.

setOnActionClickedListener

Added in 1.1.0
fun setOnActionClickedListener(listener: OnActionClickedListener!): Unit

Sets the listener for Action click events.

setParticipatingEntranceTransition

Added in 1.1.0
fun setParticipatingEntranceTransition(participating: Boolean): Unit

Sets if the overview should be part of shared element transition.

setState

Added in 1.1.0
fun setState(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    state: Int
): Unit

Switch state of a ViewHolder.

Parameters
viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The ViewHolder to change state.

state: Int

New state, can be STATE_FULL, STATE_HALF or STATE_SMALL.

Protected functions

createRowViewHolder

Added in 1.2.0-alpha04
protected fun createRowViewHolder(parent: ViewGroup!): RowPresenter.ViewHolder!

Called to create a ViewHolder object for a Row. Subclasses will override this method to return a different concrete ViewHolder object.

Parameters
parent: ViewGroup!

The parent View for the Row's view holder.

Returns
RowPresenter.ViewHolder!

A ViewHolder for the Row's View.

getLayoutResourceId

Added in 1.1.0
protected fun getLayoutResourceId(): Int

Get resource id to inflate the layout. The layout must match STATE_HALF

isClippingChildren

protected fun isClippingChildren(): Boolean

Returns true if the Row view should clip its children. The clipChildren flag is set on view in initializeRowViewHolder. Note that Slide transition or explode transition need turn off clipChildren. Default value is false.

onBindRowViewHolder

protected fun onBindRowViewHolder(holder: RowPresenter.ViewHolder, item: Any): Unit

Binds the given row object to the given ViewHolder. Derived classes of RowPresenter overriding onBindRowViewHolder must call through the super class's implementation of this method.

onLayoutLogo

Added in 1.1.0
protected fun onLayoutLogo(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int,
    logoChanged: Boolean
): Unit

Layout logo position based on current state. Subclass may override. The method is called when a logo is bound to view or state changes.

Parameters
viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The row ViewHolder that contains the logo.

oldState: Int

The old state, can be same as current viewHolder.getState()

logoChanged: Boolean

Whether logo was changed.

onLayoutOverviewFrame

Added in 1.1.0
protected fun onLayoutOverviewFrame(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int,
    logoChanged: Boolean
): Unit

Layout overview frame based on current state. Subclass may override. The method is called when a logo is bound to view or state changes.

Parameters
viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The row ViewHolder that contains the logo.

oldState: Int

The old state, can be same as current viewHolder.getState()

logoChanged: Boolean

Whether logo was changed.

onRowViewAttachedToWindow

protected fun onRowViewAttachedToWindow(vh: RowPresenter.ViewHolder): Unit

Invoked when the row view is attached to the window.

onRowViewDetachedFromWindow

protected fun onRowViewDetachedFromWindow(vh: RowPresenter.ViewHolder): Unit

Invoked when the row view is detached from the window.

onSelectLevelChanged

protected fun onSelectLevelChanged(holder: RowPresenter.ViewHolder!): Unit

Callback when the select level changes. The default implementation applies the select level to setSelectLevel when getSelectEffectEnabled is true. Subclasses may override this function and implement a different select effect. In this case, the method isUsingDefaultSelectEffect should also be overridden to disable the default dimming effect.

onStateChanged

Added in 1.1.0
protected fun onStateChanged(
    viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!,
    oldState: Int
): Unit

Called when getState changes. Subclass may override. The default implementation calls onLayoutLogo and onLayoutOverviewFrame.

Parameters
viewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder!

The ViewHolder which state changed.

oldState: Int

The old state.

onUnbindRowViewHolder

protected fun onUnbindRowViewHolder(holder: RowPresenter.ViewHolder): Unit

Unbinds the given ViewHolder. Derived classes of RowPresenter overriding onUnbindRowViewHolder must call through the super class's implementation of this method.

Protected properties

mInitialState

Added in 1.1.0
protected val mInitialStateInt