Adapter
Base class for an Adapter
Adapters provide a binding from an app-specific data set to views that are displayed within a RecyclerView.
Parameters
<VH>
A class that extends ViewHolder that will be used by the adapter.
Inheritors
Types
Functions
Link copied to clipboard
This method internally calls onBindViewHolder to update the ViewHolder contents with the item at the given position and also sets up some private fields to be used by RecyclerView.
Link copied to clipboard
This method calls onCreateViewHolder to create a new ViewHolder and initializes some private fields to be used by RecyclerView.
Link copied to clipboard
open fun findRelativeAdapterPositionIn(@NonNull adapter: RecyclerView.Adapter<out RecyclerView.ViewHolder>, @NonNull viewHolder: RecyclerView.ViewHolder, localPosition: Int): Int
Returns the position of the given ViewHolder in the given Adapter.
Link copied to clipboard
Returns the total number of items in the data set held by the adapter.
Link copied to clipboard
Return the view type of the item at
position
for the purposes of view recycling.Link copied to clipboard
Returns when this Adapter wants to restore the state.
Link copied to clipboard
Returns true if one or more observers are attached to this adapter.
Link copied to clipboard
Returns true if this adapter publishes a unique
long
value that can act as a key for the item at a given position in the data set.Link copied to clipboard
Notify any registered observers that the data set has changed.
Link copied to clipboard
Notify any registered observers that the item at
position
has changed.Notify any registered observers that the item at
position
has changed with an optional payload object.Link copied to clipboard
Notify any registered observers that the item reflected at
position
has been newly inserted.Link copied to clipboard
Notify any registered observers that the item reflected at
fromPosition
has been moved to toPosition
.Link copied to clipboard
Notify any registered observers that the
itemCount
items starting at position positionStart
have changed.Link copied to clipboard
Notify any registered observers that the currently reflected
itemCount
items starting at positionStart
have been newly inserted.Link copied to clipboard
Notify any registered observers that the
itemCount
items previously located at positionStart
have been removed from the data set.Link copied to clipboard
Notify any registered observers that the item previously located at
position
has been removed from the data set.Link copied to clipboard
Called by RecyclerView when it starts observing this Adapter.
Link copied to clipboard
Link copied to clipboard
Called when RecyclerView needs a new ViewHolder of the given type to represent an item.
Link copied to clipboard
Called by RecyclerView when it stops observing this Adapter.
Link copied to clipboard
Called by the RecyclerView if a ViewHolder created by this Adapter cannot be recycled due to its transient state.
Link copied to clipboard
Called when a view created by this adapter has been attached to a window.
Link copied to clipboard
Called when a view created by this adapter has been detached from its window.
Link copied to clipboard
Called when a view created by this adapter has been recycled.
Link copied to clipboard
Register a new observer to listen for data changes.
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Indicates whether each item in the data set can be represented with a unique identifier of type java.lang.Long.
Link copied to clipboard
Sets the state restoration strategy for the Adapter.
Link copied to clipboard
Unregister an observer currently listening for data changes.