features/characters_list / com.vmadalin.dynamicfeatures.characterslist.ui.list.adapter / CharactersListAdapter

CharactersListAdapter

class CharactersListAdapter : BasePagedListAdapter<CharacterItem>

Class for presenting characters List data in a RecyclerView, including computing diffs between Lists on a background thread.

See Also

BaseListAdapter

Constructors

<init>

Class for presenting characters List data in a RecyclerView, including computing diffs between Lists on a background thread.

CharactersListAdapter(viewModel: CharactersListViewModel)

Properties

viewModel

val viewModel: CharactersListViewModel

Functions

getItemCount

Returns the total number of items in the data set held by the adapter.

fun getItemCount(): Int

getItemId

Return the stable ID for the item at position.

fun getItemId(position: Int): Long

getItemViewType

Return the view type of the item at position for the purposes of view recycling.

fun getItemViewType(position: Int): Int

getSpanSizeLookup

Obtain helper class to provide the number of spans each item occupies.

fun getSpanSizeLookup(): SpanSizeLookup

onBindViewHolder

Called by RecyclerView to display the data at the specified position.

fun onBindViewHolder(holder: ViewHolder, position: Int): Unit

onCreateViewHolder

Called when RecyclerView needs a new RecyclerView.ViewHolder of the given type to represent an item.

fun onCreateViewHolder(parent: ViewGroup, inflater: LayoutInflater, viewType: Int): ViewHolder

submitState

Update current adapter state with the new one, applying visual changes.

fun submitState(newState: CharactersListAdapterState): Unit