ListItemHeaderViewModel

class ListItemHeaderViewModel(val itemId: Any, val icon: ImageSource? = null, val text: StringResolver? = null) : ListItemViewModel

The ViewModel for populating a header item in a TtListRecyclerView.

A header consists of an Image section and a Text section. A schematic overview of the header looks as below:

________________________________
|  __   |                       |
| |__|  |       Text            |
|_______|_______________________|
  Image         Text
 section       section

Parameters

itemId

A unique stable ID for the header item. See ListItemViewModel.itemId.

icon

The icon for the header item displayed in Image section.

text

The text for the header item displayed in Text section.

Constructors

Link copied to clipboard
constructor(itemId: Any, iconDrawable: DrawableResolver? = null, text: StringResolver? = null)

A convenience constructor to populate the ViewModel with the given DrawableResolver and StringResolver.

constructor(itemId: Any, icon: ImageSource? = null, text: StringResolver? = null)

Properties

Link copied to clipboard
val icon: ImageSource? = null
Link copied to clipboard
open override val itemId: Any
Link copied to clipboard
val text: StringResolver? = null

Functions

Link copied to clipboard
open override fun getImageSource(): ImageSource?

Retrieves the ImageSource. If it returns null, no image information will be presented in the indicator. If both getStringResolver and getImageSource return a non-null value, the return value of getStringResolver will be adopted by TtScrollBar first.

Link copied to clipboard
open override fun getStringResolver(): StringResolver?

Retrieves the StringResolver. If it returns null, no text information will be presented in the indicator. If both getStringResolver and getImageSource return a non-null value, the return value of getStringResolver will be adopted by TtScrollBar first.