DetailsOverviewLogoPresenter
public class DetailsOverviewLogoPresenter extends Presenter
| java.lang.Object | ||
| ↳ | androidx.leanback.widget.Presenter | |
| ↳ | androidx.leanback.widget.DetailsOverviewLogoPresenter |
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 |
|---|
public class DetailsOverviewLogoPresenter.ViewHolder extends Presenter.ViewHolderViewHolder for Logo view of DetailsOverviewRow. |
Public constructors |
|---|
Public methods |
|
|---|---|
boolean |
isBoundToImage(Returns true if the logo view is bound to image. |
void |
onBindViewHolder(Bind logo View to drawable of DetailsOverviewRow and call notifyOnBindLogo(). |
@NonNull View |
onCreateView(@NonNull ViewGroup parent)Create a View for the Logo, default implementation loads from |
@NonNull Presenter.ViewHolder |
onCreateViewHolder(@NonNull ViewGroup parent)Creates a new |
void |
onUnbindViewHolder(@NonNull Presenter.ViewHolder viewHolder)Unbinds a |
void |
setContext(Called from |
Inherited methods |
||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Public constructors
Public methods
isBoundToImage
public boolean isBoundToImage(
@NonNull DetailsOverviewLogoPresenter.ViewHolder viewHolder,
@Nullable DetailsOverviewRow row
)
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
public void onBindViewHolder(
@NonNull Presenter.ViewHolder viewHolder,
@Nullable Object item
)
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 | |
|---|---|
@NonNull Presenter.ViewHolder viewHolder |
ViewHolder to bind. |
@Nullable Object item |
DetailsOverviewRow object to bind. |
onCreateView
public @NonNull View onCreateView(@NonNull ViewGroup parent)
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.
onCreateViewHolder
public @NonNull Presenter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent)
Creates a new View.
onUnbindViewHolder
public void onUnbindViewHolder(@NonNull Presenter.ViewHolder viewHolder)
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
public void setContext(
@NonNull DetailsOverviewLogoPresenter.ViewHolder viewHolder,
@Nullable FullWidthDetailsOverviewRowPresenter.ViewHolder parentViewHolder,
@Nullable FullWidthDetailsOverviewRowPresenter parentPresenter
)
Called from FullWidthDetailsOverviewRowPresenter to setup FullWidthDetailsOverviewRowPresenter and FullWidthDetailsOverviewRowPresenter.ViewHolder that hosts the logo.
| Parameters | |
|---|---|
@NonNull DetailsOverviewLogoPresenter.ViewHolder viewHolder |
|
@Nullable FullWidthDetailsOverviewRowPresenter.ViewHolder parentViewHolder |
|
@Nullable FullWidthDetailsOverviewRowPresenter parentPresenter |