SupportListAdapter

abstract class SupportListAdapter<T>(differCallback: DiffUtil.ItemCallback<T>, supportsStableIds: Boolean = false) : ListAdapter<T, SupportViewHolder> , SupportAdapter<T>

Core implementation for handling complex logic for Lists and androidx.recyclerview.widget.RecyclerView.ViewHolder binding logic

Since

v1.2.0

Parameters

differCallback

Callback for calculating the diff between two non-null items in a list.

supportsStableIds

Sets PagedListAdapter.setHasStableIds which is defaulted to true

Constructors

Link copied to clipboard
constructor(differCallback: DiffUtil.ItemCallback<T>, supportsStableIds: Boolean = false)

Properties

Link copied to clipboard
open override val clickableFlow: MutableStateFlow<ClickableItem>

An observer to listen for clicks on clickable items

Link copied to clipboard

Special dispatcher controller for custom logic handling

Link copied to clipboard

Get currently set animation type for recycler view holder items

Link copied to clipboard
open override var isUsingConcatAdapter: Boolean

Internal use only indicator for checking against the use of a concat adapter for headers and footers, which is in turn used to figure out how to get the view holder id

Link copied to clipboard
open override var lastAnimatedPosition: Int
Link copied to clipboard
abstract val mapper: (T) -> IRecyclerItem

Mapper for adapters to converting models to recycler items

Link copied to clipboard
abstract val resources: Resources
Link copied to clipboard

Configuration for the state based footer

Link copied to clipboard

Assigned if the current adapter supports needs to supports action mode

Functions

Link copied to clipboard
open fun animateViewHolder(holder: SupportViewHolder?, position: Int)

Applies an animation on a SupportViewHolder when it is seen for the first time

Link copied to clipboard
Link copied to clipboard
open fun bindViewHolderByType(holder: SupportViewHolder, position: Int, payloads: List<Any> = emptyList())

Binds view holder by view type at position

Link copied to clipboard
abstract fun createDefaultViewHolder(parent: ViewGroup, @LayoutRes viewType: Int, layoutInflater: LayoutInflater): SupportViewHolder

Should provide the required view holder, this function is a substitute for androidx.recyclerview.widget.RecyclerView.Adapter.onCreateViewHolder which now has extended functionality

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun getItemCount(): Int
Link copied to clipboard
open override fun getItemId(position: Int): Long

Return the stable ID for the item at position. If hasStableIds would return false this method should return RecyclerView.NO_ID.

Link copied to clipboard
open override fun getItemViewType(position: Int): Int

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

Link copied to clipboard
open fun getSpanSizeForItemAt(position: Int, spanCount: Int?): Int?

Should return the span size for the item at position, when called from androidx.recyclerview.widget.GridLayoutManager will be the span size for the item at the position.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Check if ISupportAdapter ->SupportListAdapter contains any list items

Link copied to clipboard
Link copied to clipboard
open override fun notifyDataSetNeedsRefreshing()

Informs view adapter of changes related to it's view holder

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun notifyItemMoved(p0: Int, p1: Int)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun onAttachedToRecyclerView(recyclerView: RecyclerView)

Called by RecyclerView when it starts observing this Adapter.

Link copied to clipboard
open override fun onBindViewHolder(holder: SupportViewHolder, position: Int)
open override fun onBindViewHolder(holder: SupportViewHolder, position: Int, payloads: MutableList<Any>)

Calls the the recycler view holder to perform view binding, and selection mode decorations are set up

Link copied to clipboard
open override fun onCreate(owner: LifecycleOwner)
Link copied to clipboard
open override fun onCreateViewHolder(parent: ViewGroup, @LayoutRes viewType: Int): SupportViewHolder

Overridden implementation createDefaultViewHolder calls to resolve the view holder type

Link copied to clipboard
Link copied to clipboard
open override fun onDestroy(owner: LifecycleOwner)
Link copied to clipboard
open override fun onPause(owner: LifecycleOwner)

Notifies that ON_PAUSE event occurred.

Link copied to clipboard
open override fun onResume(owner: LifecycleOwner)
Link copied to clipboard
open override fun onStart(owner: LifecycleOwner)
Link copied to clipboard
open override fun onStop(owner: LifecycleOwner)
Link copied to clipboard
open override fun onViewAttachedToWindow(holder: SupportViewHolder)

Called when a view created by this adapter has been attached to a window.

Link copied to clipboard
open override fun onViewDetachedFromWindow(holder: SupportViewHolder)

Called when a view created by this adapter has been detached from its window.

Link copied to clipboard
open override fun onViewRecycled(holder: SupportViewHolder)

Calls the the recycler view holder impl to perform view recycling

Link copied to clipboard
open override fun requireItem(position: Int): T

Returns the non-nullable item for this adapter

Link copied to clipboard
open fun setHasStableIds(p0: Boolean)
Link copied to clipboard
open fun setLayoutSpanSize(layoutManager: GridLayoutManager)

Initial implementation is only specific for group types of recyclers, in order to customize this an override is required.

Link copied to clipboard
open fun setLoadState(state: LoadState)

Sets loading state

Link copied to clipboard
open fun submitList(@Nullable p0: MutableList<T>?)
open fun submitList(@Nullable p0: MutableList<T>?, @Nullable p1: Runnable?)
Link copied to clipboard
Link copied to clipboard