SupportLoadStateAdapter

open class SupportLoadStateAdapter(val resources: Resources, val stateConfiguration: IStateLayoutConfig, val mapper: (LoadState) -> IRecyclerItem = { when (it) { is LoadState.Loading -> SupportLoadingItem(stateConfiguration) is LoadState.Error -> SupportErrorItem(it, stateConfiguration) else -> SupportDefaultItem(it, stateConfiguration) } }, val customSupportAnimator: AbstractAnimator? = ScaleAnimator(), val supportAction: ISupportSelectionMode<Long>? = null) : ListAdapter<LoadState, SupportViewHolder> , ISupportAdapter<LoadState>

Constructors

Link copied to clipboard
constructor(resources: Resources, stateConfiguration: IStateLayoutConfig, mapper: (LoadState) -> IRecyclerItem = { when (it) { is LoadState.Loading -> SupportLoadingItem(stateConfiguration) is LoadState.Error -> SupportErrorItem(it, stateConfiguration) else -> SupportDefaultItem(it, stateConfiguration) } }, customSupportAnimator: AbstractAnimator? = ScaleAnimator(), supportAction: ISupportSelectionMode<Long>? = null)

Properties

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

An observer to listen for clicks on clickable items

Link copied to clipboard

Get currently set animation type for recycler view holder items

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

Mapper for adapters to converting models to recycler items

Link copied to clipboard
open override val resources: Resources
Link copied to clipboard

Configuration for the state based footer

Link copied to clipboard
open override val supportAction: ISupportSelectionMode<Long>? = null

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
open override fun createDefaultViewHolder(parent: ViewGroup, 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

Returns true if the LoadState should be displayed as a list item when active.

Link copied to clipboard
Link copied to clipboard
override fun getItemCount(): Int
Link copied to clipboard
open fun getItemId(p0: Int): Long
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
Link copied to clipboard

open override fun onBindViewHolder(holder: SupportViewHolder, position: Int)

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
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
Link copied to clipboard
Link copied to clipboard
open override fun requireItem(position: Int): LoadState

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