ItemDetailsLookup.ItemDetails

public static abstract class ItemDetailsLookup.ItemDetails
extends Object

java.lang.Object
   ↳ androidx.recyclerview.selection.ItemDetailsLookup.ItemDetails<K>


An ItemDetails implementation provides the selection library with access to information about a specific RecyclerView item. This class is a key component in controling the behaviors of the selection library in the context of a specific activity.

Selection Hotspot

This is an optional feature identifying an area within a view that is single-tap to select. Ordinarily a single tap on an item when there is no existing selection will result in that item being activated. If the tap occurs within the "selection hotspot" the item will instead be selected.

See OnItemActivatedListener for details on handling item activation.

Drag Region

The selection library provides support for mouse driven band selection. The "lasso" typically associated with mouse selection can be started only in an empty area of the RecyclerView (an area where the item position == RecyclerView#NO_POSITION, or where RecyclerView#findChildViewUnder returns null). But in many instances the item views presented by RecyclerView will contain areas that may be perceived by the user as being empty. The user may expect to be able to initiate band selection in these empty areas.

The "drag region" concept exists in large part to accommodate this user expectation. Drag region is the content in an item view that the user doesn't otherwise perceive to be empty or part of the background of recycler view. Take for example a traditional single column layout where the view layout width is "match_parent":

 -------------------------------------------------------
 | [icon]  A string label.   ...empty space...         |
 -------------------------------------------------------
   < ---  drag region  --> < --treated as background-->

Further more, within a drag region, a mouse click and drag will immediately initiate drag and drop (if supported by your configuration).

As user expectations around touch and mouse input differ substantially, "drag region" has no effect on handling of touch input.

Summary

Public constructors

ItemDetails()

Public methods

boolean equals(Object obj)
abstract int getPosition()

Returns the adapter position of the item.

abstract K getSelectionKey()
boolean hasSelectionKey()
int hashCode()
boolean inDragRegion(MotionEvent e)

"Item Drag Region" identifies areas of an item that are not considered when the library evaluates whether or not to initiate band-selection for mouse input.

boolean inSelectionHotspot(MotionEvent e)

Areas are often included in a view that behave similar to checkboxes, such as the icon to the left of an email message.

Inherited methods