Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
added in version 1.0.0
belongs to Maven artifact androidx.recyclerview:recyclerview-selection:1.1.0-alpha01

ItemDetailsLookup

public abstract class ItemDetailsLookup
extends Object

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


The Selection library calls getItemDetails(MotionEvent) when it needs access to information about the area and/or ItemDetailsLookup.ItemDetails under a MotionEvent. Your implementation must negotiate ViewHolder lookup with the corresponding RecyclerView instance, and the subsequent conversion of the ViewHolder instance to an ItemDetailsLookup.ItemDetails instance.

Example

 final class MyDetailsLookup extends ItemDetailsLookup {

   private final RecyclerView mRecyclerView;

   MyDetailsLookup(RecyclerView recyclerView) {
       mRecyclerView = recyclerView;
   }

   public ItemDetails getItemDetails(MotionEvent e) {
       View view = mRecView.findChildViewUnder(e.getX(), e.getY());
       if (view != null) {
           ViewHolder holder = mRecView.getChildViewHolder(view);
           if (holder instanceof MyHolder) {
               return ((MyHolder) holder).getItemDetails();
           }
       }
       return null;
   }
}
 

Summary

Nested classes

class ItemDetailsLookup.ItemDetails<K>

An ItemDetails implementation provides the selection library with access to information about a specific RecyclerView item. 

Public constructors

ItemDetailsLookup()

Public methods

abstract ItemDetails<K> getItemDetails(MotionEvent e)

Inherited methods

Public constructors

ItemDetailsLookup

added in version 1.0.0
public ItemDetailsLookup ()

Public methods

getItemDetails

added in version 1.0.0
public abstract ItemDetails<K> getItemDetails (MotionEvent e)

Parameters
e MotionEvent

Returns
ItemDetails<K> the ItemDetails for the item under the event, or null.