public class FullWidthDetailsOverviewRowPresenter extends RowPresenter
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 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
DetailsFragment
where it switches states based on
selected row position.
Modifier and Type | Class and Description |
---|---|
static class |
FullWidthDetailsOverviewRowPresenter.Listener
Listeners for events on ViewHolder.
|
class |
FullWidthDetailsOverviewRowPresenter.ViewHolder
A ViewHolder for the DetailsOverviewRow.
|
Presenter.ViewHolderTask
Modifier and Type | Field and Description |
---|---|
static 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.
|
static int |
ALIGN_MODE_START
This is the alignment mode that the logo and description align to the starting edge of the
overview view.
|
protected int |
mInitialState |
static int |
STATE_FULL
This is the state when the view covers full width and height of screen.
|
static int |
STATE_HALF
This is the default state corresponding to layout file.
|
static int |
STATE_SMALL
This is the state where the view shrinks to a small banner.
|
SYNC_ACTIVATED_CUSTOM, SYNC_ACTIVATED_TO_EXPANDED, SYNC_ACTIVATED_TO_EXPANDED_AND_SELECTED, SYNC_ACTIVATED_TO_SELECTED
Constructor and Description |
---|
FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter)
Constructor for a FullWidthDetailsOverviewRowPresenter.
|
FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter,
DetailsOverviewLogoPresenter logoPresenter)
Constructor for a FullWidthDetailsOverviewRowPresenter.
|
Modifier and Type | Method and Description |
---|---|
protected RowPresenter.ViewHolder |
createRowViewHolder(ViewGroup parent)
Called to create a ViewHolder object for a Row.
|
int |
getActionsBackgroundColor()
Returns the background color of actions.
|
int |
getAlignmentMode()
Returns alignment mode of Description.
|
int |
getBackgroundColor()
Returns the background color.
|
int |
getInitialState()
Returns the initial state used to create ViewHolder.
|
protected int |
getLayoutResourceId()
Get resource id to inflate the layout.
|
OnActionClickedListener |
getOnActionClickedListener()
Returns the listener for Action click events.
|
protected boolean |
isClippingChildren()
Returns true if the Row view should clip it's children.
|
boolean |
isParticipatingEntranceTransition()
Returns true if the overview should be part of shared element transition.
|
boolean |
isUsingDefaultSelectEffect()
Returns true if this RowPresenter is using the default dimming effect.
|
void |
notifyOnBindLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder)
Called by
DetailsOverviewLogoPresenter to notify logo was bound to view. |
protected void |
onBindRowViewHolder(RowPresenter.ViewHolder holder,
Object item)
Binds the given row object to the given ViewHolder.
|
protected void |
onLayoutLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder,
int oldState,
boolean logoChanged)
Layout logo position based on current state.
|
protected void |
onLayoutOverviewFrame(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder,
int oldState,
boolean logoChanged)
Layout overview frame based on current state.
|
protected void |
onRowViewAttachedToWindow(RowPresenter.ViewHolder vh)
Invoked when the row view is attached to the window.
|
protected void |
onRowViewDetachedFromWindow(RowPresenter.ViewHolder vh)
Invoked when the row view is detached from the window.
|
protected void |
onSelectLevelChanged(RowPresenter.ViewHolder holder)
Callback when the select level changes.
|
protected void |
onStateChanged(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder,
int oldState)
Called when
ViewHolder#getState() changes. |
protected void |
onUnbindRowViewHolder(RowPresenter.ViewHolder holder)
Unbinds the given ViewHolder.
|
void |
setActionsBackgroundColor(int color)
Sets the background color for Action Bar.
|
void |
setAlignmentMode(int alignmentMode)
Set alignment mode of Description.
|
void |
setBackgroundColor(int color)
Sets the background color.
|
void |
setEntranceTransitionState(RowPresenter.ViewHolder holder,
boolean afterEntrance)
Changes the visibility of views.
|
void |
setInitialState(int state)
Change the initial state used to create ViewHolder.
|
void |
setListener(FullWidthDetailsOverviewRowPresenter.Listener listener)
Set listener for details overview presenter.
|
void |
setOnActionClickedListener(OnActionClickedListener listener)
Sets the listener for Action click events.
|
void |
setParticipatingEntranceTransition(boolean participating)
Sets if the overview should be part of shared element transition.
|
void |
setState(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder,
int state)
Switch state of a ViewHolder.
|
dispatchItemSelectedListener, freeze, getHeaderPresenter, getRowViewHolder, getSelectEffectEnabled, getSelectLevel, getSyncActivatePolicy, initializeRowViewHolder, onBindViewHolder, onCreateViewHolder, onRowViewExpanded, onRowViewSelected, onUnbindViewHolder, onViewAttachedToWindow, onViewDetachedFromWindow, setHeaderPresenter, setRowViewExpanded, setRowViewSelected, setSelectEffectEnabled, setSelectLevel, setSyncActivatePolicy
cancelAnimationsRecursive, getFacet, setFacet, setOnClickListener
public static final int STATE_HALF
public static final int STATE_FULL
public static final int STATE_SMALL
public static final int ALIGN_MODE_START
public static final int ALIGN_MODE_MIDDLE
protected int mInitialState
public FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter)
detailsPresenter
- The Presenter
used to render the detailed
description of the row.public FullWidthDetailsOverviewRowPresenter(Presenter detailsPresenter, DetailsOverviewLogoPresenter logoPresenter)
public void setOnActionClickedListener(OnActionClickedListener listener)
public OnActionClickedListener getOnActionClickedListener()
public final void setBackgroundColor(int color)
public final int getBackgroundColor()
setBackgroundColor(int)
, transparent
is returned.public final void setActionsBackgroundColor(int color)
public final int getActionsBackgroundColor()
setActionsBackgroundColor(int)
is not called, transparent is returned.public final boolean isParticipatingEntranceTransition()
public final void setParticipatingEntranceTransition(boolean participating)
public final void setInitialState(int state)
public final int getInitialState()
public final void setAlignmentMode(int alignmentMode)
alignmentMode
- One of ALIGN_MODE_MIDDLE
or ALIGN_MODE_START
public final int getAlignmentMode()
ALIGN_MODE_MIDDLE
or ALIGN_MODE_START
.protected boolean isClippingChildren()
RowPresenter
RowPresenter.initializeRowViewHolder(ViewHolder)
. Note that
Slide transition or explode transition need turn off clipChildren.
Default value is false.isClippingChildren
in class RowPresenter
public final void setListener(FullWidthDetailsOverviewRowPresenter.Listener listener)
protected int getLayoutResourceId()
STATE_HALF
protected RowPresenter.ViewHolder createRowViewHolder(ViewGroup parent)
RowPresenter
createRowViewHolder
in class RowPresenter
parent
- The parent View for the Row's view holder.protected void onBindRowViewHolder(RowPresenter.ViewHolder holder, Object item)
RowPresenter
RowPresenter
overriding
RowPresenter.onBindRowViewHolder(ViewHolder, Object)
must call through the super class's
implementation of this method.onBindRowViewHolder
in class RowPresenter
protected void onUnbindRowViewHolder(RowPresenter.ViewHolder holder)
RowPresenter
RowPresenter
overriding RowPresenter.onUnbindRowViewHolder(ViewHolder)
must call through the super class's implementation of this method.onUnbindRowViewHolder
in class RowPresenter
public final boolean isUsingDefaultSelectEffect()
RowPresenter
RowPresenter.onSelectLevelChanged(ViewHolder)
.isUsingDefaultSelectEffect
in class RowPresenter
protected void onSelectLevelChanged(RowPresenter.ViewHolder holder)
RowPresenter
RowHeaderPresenter.setSelectLevel(RowHeaderPresenter.ViewHolder, float)
when RowPresenter.getSelectEffectEnabled()
is true. Subclasses may override
this function and implement a different select effect. In this case,
the method RowPresenter.isUsingDefaultSelectEffect()
should also be overridden to disable
the default dimming effect.onSelectLevelChanged
in class RowPresenter
protected void onRowViewAttachedToWindow(RowPresenter.ViewHolder vh)
RowPresenter
onRowViewAttachedToWindow
in class RowPresenter
protected void onRowViewDetachedFromWindow(RowPresenter.ViewHolder vh)
RowPresenter
onRowViewDetachedFromWindow
in class RowPresenter
public final void notifyOnBindLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder)
DetailsOverviewLogoPresenter
to notify logo was bound to view.
Application should not directly call this method.viewHolder
- The row ViewHolder that has logo bound to view.protected void onLayoutLogo(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState, boolean logoChanged)
viewHolder
- The row ViewHolder that contains the logo.oldState
- The old state, can be same as current viewHolder.getState()logoChanged
- Whether logo was changed.protected void onLayoutOverviewFrame(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState, boolean logoChanged)
viewHolder
- The row ViewHolder that contains the logo.oldState
- The old state, can be same as current viewHolder.getState()logoChanged
- Whether logo was changed.public final void setState(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int state)
viewHolder
- The ViewHolder to change state.state
- New state, can be STATE_FULL
, STATE_HALF
or STATE_SMALL
.protected void onStateChanged(FullWidthDetailsOverviewRowPresenter.ViewHolder viewHolder, int oldState)
ViewHolder#getState()
changes. Subclass may override.
The default implementation calls onLayoutLogo(ViewHolder, int, boolean)
and
onLayoutOverviewFrame(ViewHolder, int, boolean)
.viewHolder
- The ViewHolder which state changed.oldState
- The old state.public void setEntranceTransitionState(RowPresenter.ViewHolder holder, boolean afterEntrance)
RowPresenter
setEntranceTransitionState
in class RowPresenter
holder
- The ViewHolder of the row.afterEntrance
- true if children of row participating in entrance transition
should be set to visible, false otherwise.