belongs to Maven artifact androidx.leanback:leanback:1.0.0-alpha1

FullWidthDetailsOverviewRowPresenter

public class FullWidthDetailsOverviewRowPresenter
extends RowPresenter

java.lang.Object
   ↳ 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 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 FullWidthDetailsOverviewRowPresenter.ViewHolder.getDetailsDescriptionViewHolder().

The logo view is rendered using a customizable DetailsOverviewLogoPresenter passed in FullWidthDetailsOverviewRowPresenter(Presenter, DetailsOverviewLogoPresenter). The application can access the logo ViewHolder from FullWidthDetailsOverviewRowPresenter.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 DetailsFragment where it switches states based on selected row position.

Summary

Nested classes

class FullWidthDetailsOverviewRowPresenter.Listener

Listeners for events on ViewHolder. 

class FullWidthDetailsOverviewRowPresenter.ViewHolder

A ViewHolder for the DetailsOverviewRow. 

Constants

int ALIGN_MODE_MIDDLE

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.

int ALIGN_MODE_START

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

int STATE_FULL

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

int STATE_HALF

This is the default state corresponding to layout file.

int STATE_SMALL

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

Inherited constants

Fields

protected int mInitialState

Public constructors

FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter)

Constructor for a FullWidthDetailsOverviewRowPresenter.

FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter, DetailsOverviewLogoPresenter logoPresenter)

Constructor for a FullWidthDetailsOverviewRowPresenter.

Public methods

final int getActionsBackgroundColor()

Returns the background color of actions.

final int getAlignmentMode()

Returns alignment mode of Description.

final int getBackgroundColor()

Returns the background color.

final int getInitialState()

Returns the initial state used to create ViewHolder.

OnActionClickedListener getOnActionClickedListener()

Returns the listener for Action click events.

final boolean isParticipatingEntranceTransition()

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

final boolean isUsingDefaultSelectEffect()

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

final void notifyOnBindLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder)

Called by DetailsOverviewLogoPresenter to notify logo was bound to view.

final void setActionsBackgroundColor(int color)

Sets the background color for Action Bar.

final void setAlignmentMode(int alignmentMode)

Set alignment mode of Description.

final void setBackgroundColor(int color)

Sets the background color.

void setEntranceTransitionState(RowPresenter.ViewHolder holder, boolean afterEntrance)

Changes the visibility of views.

final void setInitialState(int state)

Change the initial state used to create ViewHolder.

final void setListener(FullWidthDetailsOverviewRowPresenter.Listener listener)

Set listener for details overview presenter.

void setOnActionClickedListener(OnActionClickedListener listener)

Sets the listener for Action click events.

final void setParticipatingEntranceTransition(boolean participating)

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

final void setState(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int state)

Switch state of a ViewHolder.

Protected methods

RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent)

Called to create a ViewHolder object for a Row.

int getLayoutResourceId()

Get resource id to inflate the layout.

boolean isClippingChildren()

Returns true if the Row view should clip its children.

void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item)

Binds the given row object to the given ViewHolder.

void onLayoutLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState, boolean logoChanged)

Layout logo position based on current state.

void onLayoutOverviewFrame(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState, boolean logoChanged)

Layout overview frame based on current state.

void onRowViewAttachedToWindow(RowPresenter.ViewHolder vh)

Invoked when the row view is attached to the window.

void onRowViewDetachedFromWindow(RowPresenter.ViewHolder vh)

Invoked when the row view is detached from the window.

void onSelectLevelChanged(RowPresenter.ViewHolder holder)

Callback when the select level changes.

void onStateChanged(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState)

Called when FullWidthDetailsOverviewRowPresenter.ViewHolder.getState() changes.

void onUnbindRowViewHolder(RowPresenter.ViewHolder holder)

Unbinds the given ViewHolder.

Inherited methods

Constants

ALIGN_MODE_MIDDLE

int ALIGN_MODE_MIDDLE

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.

Constant Value: 1 (0x00000001)

ALIGN_MODE_START

int ALIGN_MODE_START

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

Constant Value: 0 (0x00000000)

STATE_FULL

int STATE_FULL

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

Constant Value: 1 (0x00000001)

STATE_HALF

int STATE_HALF

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

Constant Value: 0 (0x00000000)

STATE_SMALL

int STATE_SMALL

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

Constant Value: 2 (0x00000002)

Fields

mInitialState

int mInitialState

Public constructors

FullWidthDetailsOverviewRowPresenter

FullWidthDetailsOverviewRowPresenter (Presenter detailsPresenter)

Constructor for a FullWidthDetailsOverviewRowPresenter.

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

FullWidthDetailsOverviewRowPresenter

FullWidthDetailsOverviewRowPresenter (Presenter detailsPresenter, 
                DetailsOverviewLogoPresenter logoPresenter)

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 methods

getActionsBackgroundColor

int getActionsBackgroundColor ()

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

Returns
int

getAlignmentMode

int getAlignmentMode ()

Returns alignment mode of Description.

Returns
int One of ALIGN_MODE_MIDDLE or ALIGN_MODE_START.

getBackgroundColor

int getBackgroundColor ()

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

Returns
int

getInitialState

int getInitialState ()

Returns the initial state used to create ViewHolder.

Returns
int

getOnActionClickedListener

OnActionClickedListener getOnActionClickedListener ()

Returns the listener for Action click events.

Returns
OnActionClickedListener

isParticipatingEntranceTransition

boolean isParticipatingEntranceTransition ()

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

Returns
boolean

isUsingDefaultSelectEffect

boolean isUsingDefaultSelectEffect ()

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

Returns
boolean

notifyOnBindLogo

void notifyOnBindLogo (FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder)

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

void setActionsBackgroundColor (int color)

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

Parameters
color int

setAlignmentMode

void setAlignmentMode (int alignmentMode)

Set alignment mode of Description.

Parameters
alignmentMode int: One of ALIGN_MODE_MIDDLE or ALIGN_MODE_START

setBackgroundColor

void setBackgroundColor (int color)

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

Parameters
color int

setEntranceTransitionState

void setEntranceTransitionState (RowPresenter.ViewHolder holder, 
                boolean afterEntrance)

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

void setInitialState (int state)

Change the initial state used to create ViewHolder.

Parameters
state int

setListener

void setListener (FullWidthDetailsOverviewRowPresenter.Listener listener)

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

Parameters
listener FullWidthDetailsOverviewRowPresenter.Listener

setOnActionClickedListener

void setOnActionClickedListener (OnActionClickedListener listener)

Sets the listener for Action click events.

Parameters
listener OnActionClickedListener

setParticipatingEntranceTransition

void setParticipatingEntranceTransition (boolean participating)

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

Parameters
participating boolean

setState

void setState (FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, 
                int state)

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 methods

createRowViewHolder

RowPresenter.ViewHolder createRowViewHolder (ViewGroup parent)

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

int getLayoutResourceId ()

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

Returns
int

isClippingChildren

boolean isClippingChildren ()

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

Returns
boolean

onBindRowViewHolder

void onBindRowViewHolder (RowPresenter.ViewHolder holder, 
                Object item)

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

Parameters
holder RowPresenter.ViewHolder

item Object

onLayoutLogo

void onLayoutLogo (FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, 
                int oldState, 
                boolean logoChanged)

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

void onLayoutOverviewFrame (FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, 
                int oldState, 
                boolean logoChanged)

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

void onRowViewAttachedToWindow (RowPresenter.ViewHolder vh)

Invoked when the row view is attached to the window.

Parameters
vh RowPresenter.ViewHolder

onRowViewDetachedFromWindow

void onRowViewDetachedFromWindow (RowPresenter.ViewHolder vh)

Invoked when the row view is detached from the window.

Parameters
vh RowPresenter.ViewHolder

onSelectLevelChanged

void onSelectLevelChanged (RowPresenter.ViewHolder holder)

Callback when the select level changes. The default implementation applies the select level to RowHeaderPresenter.setSelectLevel(RowHeaderPresenter.ViewHolder, float) 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.

Parameters
holder RowPresenter.ViewHolder

onStateChanged

void onStateChanged (FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, 
                int oldState)

Called when FullWidthDetailsOverviewRowPresenter.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 int: The old state.

onUnbindRowViewHolder

void onUnbindRowViewHolder (RowPresenter.ViewHolder holder)

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

Parameters
holder RowPresenter.ViewHolder