DetailsOverviewRowPresenter

Added in 1.1.0
Deprecated in 1.1.0

class DetailsOverviewRowPresenter : 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 DetailsFragment. The View created by the DetailsOverviewRowPresenter is made in three parts: ImageView on the left, action list view on the bottom and a customizable detailed description view on the right.

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

To participate in activity transition, call setSharedElementEnterTransition during Activity's onCreate().

Because transition support and layout are fully controlled by DetailsOverviewRowPresenter, developer can not override DetailsOverviewRowPresenter.ViewHolder for adding/replacing views of DetailsOverviewRowPresenter. If further customization is required beyond replacing the detailed description, the application should create a new row presenter class.

Summary

Nested types

A ViewHolder for the DetailsOverviewRow.

Public constructors

Constructor for a DetailsOverviewRowPresenter.

Public functions

@ColorInt Int

Returns the background color.

OnActionClickedListener!

Returns the listener for Action click events.

Boolean

Returns true if the layout style is large.

Boolean

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

Unit

Sets the background color.

Unit

Sets the listener for Action click events.

Unit
setSharedElementEnterTransition(
    activity: Activity!,
    sharedElementName: String!
)

Sets the enter transition of target activity to be transiting into overview row created by this presenter.

Unit
setSharedElementEnterTransition(
    activity: Activity!,
    sharedElementName: String!,
    timeoutMs: Long
)

Sets the enter transition of target activity to be transiting into overview row created by this presenter.

Unit

Sets the layout style to be large or small.

Protected functions

RowPresenter.ViewHolder!

Called to create a ViewHolder object for a Row.

Unit

Binds the given row object to the given ViewHolder.

Unit

Invoked when the row view is attached to the window.

Unit

Invoked when the row view is detached from the window.

Unit

Called when the given row view changes selection state.

Unit

Callback when the select level changes.

Unit

Unbinds the given ViewHolder.

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.

Boolean

Returns true if the Row view should clip its children.

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

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
setEntranceTransitionState(
    holder: RowPresenter.ViewHolder,
    afterEntrance: Boolean
)

Changes the visibility of views.

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.

Public constructors

DetailsOverviewRowPresenter

Added in 1.1.0
Deprecated in 1.1.0
DetailsOverviewRowPresenter(detailsPresenter: Presenter!)

Constructor for a DetailsOverviewRowPresenter.

Parameters
detailsPresenter: Presenter!

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

Public functions

getBackgroundColor

Added in 1.1.0
Deprecated in 1.1.0
fun getBackgroundColor(): @ColorInt Int

Returns the background color. If no background color was set, transparent is returned.

getOnActionClickedListener

Added in 1.1.0
Deprecated in 1.1.0
fun getOnActionClickedListener(): OnActionClickedListener!

Returns the listener for Action click events.

isStyleLarge

Added in 1.1.0
Deprecated in 1.1.0
fun isStyleLarge(): Boolean

Returns true if the layout style is large.

isUsingDefaultSelectEffect

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

setBackgroundColor

Added in 1.1.0
Deprecated in 1.1.0
fun setBackgroundColor(color: @ColorInt Int): Unit

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

setOnActionClickedListener

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

Sets the listener for Action click events.

setSharedElementEnterTransition

Added in 1.1.0
Deprecated in 1.1.0
fun setSharedElementEnterTransition(
    activity: Activity!,
    sharedElementName: String!
): Unit

Sets the enter transition of target activity to be transiting into overview row created by this presenter. The transition will be cancelled if overview image is not loaded in a default timeout period.

It assumes shared element passed from calling activity is an ImageView; the shared element transits to overview image on the starting edge of the detail overview row, while bounds of overview row grows and reveals text and action buttons.

The method must be invoked in target Activity's onCreate().

setSharedElementEnterTransition

Added in 1.1.0
Deprecated in 1.1.0
fun setSharedElementEnterTransition(
    activity: Activity!,
    sharedElementName: String!,
    timeoutMs: Long
): Unit

Sets the enter transition of target activity to be transiting into overview row created by this presenter. The transition will be cancelled if the overview image is not loaded in the timeout period.

It assumes shared element passed from calling activity is an ImageView; the shared element transits to overview image on the starting edge of the detail overview row, while bounds of overview row grows and reveals text and action buttons.

The method must be invoked in target Activity's onCreate().

setStyleLarge

Added in 1.1.0
Deprecated in 1.1.0
fun setStyleLarge(large: Boolean): Unit

Sets the layout style to be large or small. This affects the height of the overview, including the text description. The default is large.

Protected functions

createRowViewHolder

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

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.

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.

onRowViewSelected

protected fun onRowViewSelected(vh: RowPresenter.ViewHolder!, selected: Boolean): Unit

Called when the given row view changes selection state. A subclass may override this to respond to selected state changes of a Row. A subclass may make visual changes to Row view but must not create animation on the Row view.

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.

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.