DrawerItemViewHolder

open class DrawerItemViewHolder : RecyclerView.ViewHolder, OnUxRestrictionsChangedListener
kotlin.Any
   ↳ androidx.recyclerview.widget.RecyclerView.ViewHolder
   ↳ androidx.car.drawer.DrawerItemViewHolder

Re-usable RecyclerView.ViewHolder for displaying items in the androidx.car.drawer.CarDrawerAdapter.

Summary

Public constructors

<init>(@NonNull view: View)

Create a new ViewHolder that will parse the given view that is meant to displaying items in a drawer.

Public methods

open TextView?

Returns the view that is used for the body text that is smaller than the title text and appears beneath the title.

open ImageView?

Returns the icon that is displayed at the end of the view.

open ImageView

Returns the view that should be used to display the main icon.

open TextView

Returns the view that will display the main title.

open Unit

Updates child views with current car UX restrictions.

Inherited functions

Inherited properties

Public constructors

<init>

DrawerItemViewHolder(@NonNull view: View)

Create a new ViewHolder that will parse the given view that is meant to displaying items in a drawer.

The given view is required to have a title and icon view with an optional body and end icon view. These views are looked up via ids, specifically:

  • Icon - R.id.icon
  • Title - R.id.title
  • Body - R.id.body
  • End Icon - R.id.end_icon

This method is exposed for testing purposes. The DrawerItemViewHolder is automatically created by the CarDrawerAdapter.

Parameters
view View: The view that will represent an item in a drawer.

Public methods

getBodyView

@Nullable open fun getBodyView(): TextView?

Returns the view that is used for the body text that is smaller than the title text and appears beneath the title.

getEndIconView

@Nullable open fun getEndIconView(): ImageView?

Returns the icon that is displayed at the end of the view.

getIconView

@NonNull open fun getIconView(): ImageView

Returns the view that should be used to display the main icon.

getTitleView

@NonNull open fun getTitleView(): TextView

Returns the view that will display the main title.

onUxRestrictionsChanged

open fun onUxRestrictionsChanged(restrictionsInfo: CarUxRestrictions!): Unit

Updates child views with current car UX restrictions.

Text might be truncated to meet length limit required by regulation.

Parameters
restrictionInfo CarUxRestrictions!: The new UX restriction information
restrictionsInfo CarUxRestrictions!: current car UX restrictions.