DetailsOverviewRow

public class DetailsOverviewRow extends Row


An overview Row for a details fragment. This row consists of an image, a description view, and optionally a series of Actions that can be taken for the item.

Actions

Application uses setActionsAdapter to set actions on the overview row. SparseArrayObjectAdapter is recommended for easily updating actions while maintaining the order. The application can add or remove actions on the UI thread after the row is bound to a view.

Updating main item

After the row is bound to a view, the application may call setItem on UI thread and the view will be updated.

Updating image

After the row is bound to view, the application may change the image by calling setImageBitmap or setImageDrawable on the UI thread, and the view will be updated.

Summary

Nested types

Listener for changes of DetailsOverviewRow.

Public constructors

Constructor for a DetailsOverviewRow.

Public methods

final void
addAction(Action action)

This method is deprecated.

Use setActionsAdapter and getActionsAdapter

final void
addAction(int pos, Action action)

This method is deprecated.

Use setActionsAdapter and getActionsAdapter

@Nullable Action
getActionForKeyCode(int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists.

final List<Action>

This method is deprecated.

Use setActionsAdapter and getActionsAdapter

final @NonNull ObjectAdapter

Returns the ObjectAdapter for actions.

final @Nullable Drawable

Returns the image drawable of this details overview.

final @NonNull Object

Returns the main item for the details page.

boolean

Returns true if the image may be scaled up; false otherwise.

final boolean

This method is deprecated.

Use setActionsAdapter and getActionsAdapter

final void

Sets the ObjectAdapter for actions.

final void

Sets a Bitmap as the image of this details overview.

final void

Sets a drawable as the image of this details overview.

void
setImageScaleUpAllowed(boolean allowed)

Allows or disallows scaling up of images.

final void

Sets the main item for the details page.

Inherited methods

From androidx.leanback.widget.Row
final HeaderItem

Returns the HeaderItem that represents metadata for the row.

final long

Returns a unique identifier for this row.

boolean

Returns true if this Row can be rendered in a visible row view, false otherwise.

final void

Sets the HeaderItem that represents metadata for the row.

final void
setId(long id)

Sets the id for this row.

Public constructors

DetailsOverviewRow

Added in 1.1.0
public DetailsOverviewRow(@NonNull Object item)

Constructor for a DetailsOverviewRow.

Parameters
@NonNull Object item

The main item for the details page.

Public methods

addAction

Added in 1.1.0
Deprecated in 1.1.0
public final void addAction(Action action)

Adds an Action to the overview. It will throw ClassCastException if the current actions adapter is not an instance of ArrayObjectAdapter. Must be called on the UI thread.

Parameters
Action action

The Action to add.

addAction

Added in 1.1.0
Deprecated in 1.1.0
public final void addAction(int pos, Action action)

Adds an Action to the overview at the specified position. It will throw ClassCastException if current actions adapter is not an instance of fArrayObjectAdapter. Must be called on the UI thread.

Parameters
int pos

The position to insert the Action.

Action action

The Action to add.

getActionForKeyCode

Added in 1.1.0
public @Nullable Action getActionForKeyCode(int keyCode)

Returns the Action associated with the given keycode, or null if no associated action exists.

getActions

Added in 1.1.0
Deprecated in 1.1.0
public final List<ActiongetActions()

Returns a read-only view of the list of Actions of this details overview. It will throw ClassCastException if current actions adapter is not ArrayObjectAdapter. Must be called on UI thread.

Returns
List<Action>

An unmodifiable view of the list of Actions.

getActionsAdapter

Added in 1.1.0
public final @NonNull ObjectAdapter getActionsAdapter()

Returns the ObjectAdapter for actions.

getImageDrawable

Added in 1.1.0
public final @Nullable Drawable getImageDrawable()

Returns the image drawable of this details overview.

Returns
@Nullable Drawable

The overview's image drawable, or null if no drawable has been assigned.

getItem

Added in 1.1.0
public final @NonNull Object getItem()

Returns the main item for the details page.

isImageScaleUpAllowed

Added in 1.1.0
public boolean isImageScaleUpAllowed()

Returns true if the image may be scaled up; false otherwise.

removeAction

Added in 1.1.0
Deprecated in 1.1.0
public final boolean removeAction(Action action)

Removes the given Action from the overview. It will throw ClassCastException if current actions adapter is not ArrayObjectAdapter. Must be called on UI thread.

Parameters
Action action

The Action to remove.

Returns
boolean

true if the overview contained the specified Action.

setActionsAdapter

Added in 1.1.0
public final void setActionsAdapter(@NonNull ObjectAdapter adapter)

Sets the ObjectAdapter for actions. A default PresenterSelector will be attached to the adapter if it doesn't have one.

Parameters
@NonNull ObjectAdapter adapter

Adapter for actions.

setImageBitmap

Added in 1.1.0
public final void setImageBitmap(@NonNull Context context, @NonNull Bitmap bm)

Sets a Bitmap as the image of this details overview. Must be called on UI thread after row is bound to view.

Parameters
@NonNull Context context

The context to retrieve display metrics from.

@NonNull Bitmap bm

The bitmap to set.

setImageDrawable

Added in 1.1.0
public final void setImageDrawable(@Nullable Drawable drawable)

Sets a drawable as the image of this details overview. Must be called on UI thread after row is bound to view.

Parameters
@Nullable Drawable drawable

The drawable to set.

setImageScaleUpAllowed

Added in 1.1.0
public void setImageScaleUpAllowed(boolean allowed)

Allows or disallows scaling up of images. Images will always be scaled down if necessary. Must be called on UI thread after row is bound to view.

setItem

Added in 1.1.0
public final void setItem(@NonNull Object item)

Sets the main item for the details page. Must be called on UI thread after row is bound to view.