The Android Developer Challenge is back! Submit your idea before December 2.

FullWidthDetailsOverviewRowPresenter

open class FullWidthDetailsOverviewRowPresenter : RowPresenter
kotlin.Any
   ↳ androidx.leanback.widget.Presenter
   ↳ androidx.leanback.widget.RowPresenter
   ↳ androidx.leanback.widget.FullWidthDetailsOverviewRowPresenter

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(Presenter). Typically this will be an instance of AbstractDetailsDescriptionPresenter. The application can access the detailed description ViewHolder from ViewHolder#getDetailsDescriptionViewHolder().

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

To support activity shared element transition, call setListener(Listener) 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(boolean) with false

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

Summary

Nested classes

abstract

Listeners for events on ViewHolder.

open

A ViewHolder for the DetailsOverviewRow.

Constants

static 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.

static Int

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

static Int

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

static Int

This is the default state corresponding to layout file.

static Int

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

Inherited constants

Public constructors

<init>(detailsPresenter: Presenter!)

Constructor for a FullWidthDetailsOverviewRowPresenter.

<init>(detailsPresenter: Presenter!, logoPresenter: DetailsOverviewLogoPresenter!)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Public methods

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.

open OnActionClickedListener!

Returns the listener for Action click events.

Boolean

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

Boolean

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.

open Unit

Unit

Change the initial state used to create ViewHolder.

Unit

Set listener for details overview presenter.

open Unit

Sets the listener for Action click events.

Unit

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

Unit

Switch state of a ViewHolder.

Protected methods

open RowPresenter.ViewHolder!

open Int

Get resource id to inflate the layout.

open Boolean

open Unit

open Unit

Layout logo position based on current state.

open Unit

Layout overview frame based on current state.

open Unit

open Unit

open Unit

open Unit

Called when ViewHolder#getState() changes.

open Unit

Inherited functions

Properties

Int

Constants

ALIGN_MODE_MIDDLE

static val ALIGN_MODE_MIDDLE: 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.

Value: 1

ALIGN_MODE_START

static val ALIGN_MODE_START: Int

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

Value: 0

STATE_FULL

static val STATE_FULL: Int

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

Value: 1

STATE_HALF

static val STATE_HALF: Int

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

Value: 0

STATE_SMALL

static val STATE_SMALL: Int

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

Value: 2

Public constructors

<init>

FullWidthDetailsOverviewRowPresenter(detailsPresenter: Presenter!)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Parameters
detailsPresenter Presenter!: The Presenter used to render the detailed description of the row.

<init>

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

Constructor for a FullWidthDetailsOverviewRowPresenter.

Parameters
detailsPresenter Presenter!: The Presenter used to render the detailed description of the row.
logoPresenter Presenter!: The Presenter used to render the logo view.

Public methods

getActionsBackgroundColor

fun getActionsBackgroundColor(): Int

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

getAlignmentMode

fun getAlignmentMode(): Int

Returns alignment mode of Description.

Return
Int: One of ALIGN_MODE_MIDDLE or ALIGN_MODE_START.

getBackgroundColor

fun getBackgroundColor(): Int

Returns the background color. If setBackgroundColor(int), transparent is returned.

getInitialState

fun getInitialState(): Int

Returns the initial state used to create ViewHolder.

getOnActionClickedListener

open fun getOnActionClickedListener(): OnActionClickedListener!

Returns the listener for Action click events.

isParticipatingEntranceTransition

fun isParticipatingEntranceTransition(): Boolean

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

isUsingDefaultSelectEffect

fun isUsingDefaultSelectEffect(): Boolean

notifyOnBindLogo

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

fun setActionsBackgroundColor(color: Int): Unit

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

setAlignmentMode

fun setAlignmentMode(alignmentMode: Int): Unit

Set alignment mode of Description.

Parameters
alignmentMode Int: One of ALIGN_MODE_MIDDLE or ALIGN_MODE_START

setBackgroundColor

fun setBackgroundColor(color: Int): Unit

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

setEntranceTransitionState

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

setInitialState

fun setInitialState(state: Int): Unit

Change the initial state used to create ViewHolder.

setListener

fun setListener(listener: FullWidthDetailsOverviewRowPresenter.Listener!): Unit

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

setOnActionClickedListener

open fun setOnActionClickedListener(listener: OnActionClickedListener!): Unit

Sets the listener for Action click events.

setParticipatingEntranceTransition

fun setParticipatingEntranceTransition(participating: Boolean): Unit

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

setState

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

Switch state of a ViewHolder.

Parameters
viewHolder FullWidthDetailsOverviewRowPresenter.ViewHolder!: The ViewHolder to change state.
state FullWidthDetailsOverviewRowPresenter.ViewHolder!: New state, can be STATE_FULL, STATE_HALF or STATE_SMALL.

Protected methods

createRowViewHolder

protected open fun createRowViewHolder(parent: ViewGroup!): RowPresenter.ViewHolder!

getLayoutResourceId

protected open fun getLayoutResourceId(): Int

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

isClippingChildren

protected open fun isClippingChildren(): Boolean

onBindRowViewHolder

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

onLayoutLogo

protected open 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 FullWidthDetailsOverviewRowPresenter.ViewHolder!: The old state, can be same as current viewHolder.getState()
logoChanged FullWidthDetailsOverviewRowPresenter.ViewHolder!: Whether logo was changed.

onLayoutOverviewFrame

protected open 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 FullWidthDetailsOverviewRowPresenter.ViewHolder!: The old state, can be same as current viewHolder.getState()
logoChanged FullWidthDetailsOverviewRowPresenter.ViewHolder!: Whether logo was changed.

onRowViewAttachedToWindow

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

onRowViewDetachedFromWindow

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

onSelectLevelChanged

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

onStateChanged

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

Called when ViewHolder#getState() changes. Subclass may override. The default implementation calls onLayoutLogo(ViewHolder, int, boolean) and onLayoutOverviewFrame(ViewHolder, int, boolean).

Parameters
viewHolder FullWidthDetailsOverviewRowPresenter.ViewHolder!: The ViewHolder which state changed.
oldState FullWidthDetailsOverviewRowPresenter.ViewHolder!: The old state.

onUnbindRowViewHolder

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

Properties

mInitialState

protected var mInitialState: Int