DetailsOverviewLogoPresenter


class DetailsOverviewLogoPresenter : Presenter


Presenter that responsible to create a ImageView and bind to DetailsOverviewRow. The default implementation uses getImageDrawable and binds to ImageView.

Default implementation assumes no scaleType on ImageView and uses intrinsic width and height of getImageDrawable to initialize ImageView's layout params. To specify a fixed size and/or specify a scapeType, subclass should change ImageView's layout params and scaleType in onCreateView.

Subclass may override and has its own image view. Subclass may also download image from URL instead of using getImageDrawable. It's subclass's responsibility to call notifyOnBindLogo whenever isBoundToImage turned to true so that activity transition can be started.

Summary

Nested types

ViewHolder for Logo view of DetailsOverviewRow.

Public constructors

Public functions

Boolean

Returns true if the logo view is bound to image.

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

Bind logo View to drawable of DetailsOverviewRow and call notifyOnBindLogo().

View

Create a View for the Logo, default implementation loads from lb_fullwidth_details_overview_logo.

Presenter.ViewHolder

Creates a new View.

Unit

Unbinds a View from an item.

Unit

Called from FullWidthDetailsOverviewRowPresenter to setup FullWidthDetailsOverviewRowPresenter and FullWidthDetailsOverviewRowPresenter.ViewHolder that hosts the logo.

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.

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

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

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.

Public constructors

DetailsOverviewLogoPresenter

Added in 1.1.0
DetailsOverviewLogoPresenter()

Public functions

isBoundToImage

Added in 1.1.0
fun isBoundToImage(
    viewHolder: DetailsOverviewLogoPresenter.ViewHolder,
    row: DetailsOverviewRow?
): Boolean

Returns true if the logo view is bound to image. Subclass may override. The default implementation returns true when getImageDrawable is not null. If subclass of DetailsOverviewLogoPresenter manages its own image drawable, it should override this function to report status correctly and invoke notifyOnBindLogo when image view is bound to the drawable.

onBindViewHolder

Added in 1.2.0-alpha04
fun onBindViewHolder(viewHolder: Presenter.ViewHolder, item: Any?): Unit

Bind logo View to drawable of DetailsOverviewRow and call notifyOnBindLogo(). The default implementation assumes the Logo View is an ImageView and change layout size to intrinsic size of ImageDrawable if isSizeFromDrawableIntrinsic is true.

Parameters
viewHolder: Presenter.ViewHolder

ViewHolder to bind.

item: Any?

DetailsOverviewRow object to bind.

onCreateView

Added in 1.1.0
fun onCreateView(parent: ViewGroup): View

Create a View for the Logo, default implementation loads from lb_fullwidth_details_overview_logo. Subclass may override this method to use a fixed layout size and change ImageView scaleType. If the layout params is WRAP_CONTENT for both width and size, the ViewHolder would be using intrinsic size of Drawable in onBindViewHolder.

Parameters
parent: ViewGroup

Parent view.

Returns
View

View created for the logo.

onCreateViewHolder

Added in 1.2.0-alpha04
fun onCreateViewHolder(parent: ViewGroup): Presenter.ViewHolder

Creates a new View.

onUnbindViewHolder

Added in 1.2.0-alpha04
fun onUnbindViewHolder(viewHolder: Presenter.ViewHolder): Unit

Unbinds a View from an item. Any expensive references may be released here, and any fields that are not bound for every item should be cleared here.

setContext

Added in 1.1.0
fun setContext(
    viewHolder: DetailsOverviewLogoPresenter.ViewHolder,
    parentViewHolder: FullWidthDetailsOverviewRowPresenter.ViewHolder?,
    parentPresenter: FullWidthDetailsOverviewRowPresenter?
): Unit

Called from FullWidthDetailsOverviewRowPresenter to setup FullWidthDetailsOverviewRowPresenter and FullWidthDetailsOverviewRowPresenter.ViewHolder that hosts the logo.