The Android Developer Challenge is back! Submit your idea before December 2.

ItemDetailsLookup

abstract class ItemDetailsLookup<K : Any!>
kotlin.Any
   ↳ androidx.recyclerview.selection.ItemDetailsLookup

The Selection library calls getItemDetails(MotionEvent) when it needs access to information about the area and/or 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 ItemDetails instance.

Example

final class MyDetailsLookup extends ItemDetailsLookup<uri>
  {
 
    private final RecyclerView mRecyclerView;
 
    MyDetailsLookup(RecyclerView recyclerView) {
        mRecyclerView = recyclerView;
    }
 
    public ItemDetails
 <uri>
   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; } } 
 </uri>
</uri>

Summary

Nested classes

abstract

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

Public constructors

The Selection library calls getItemDetails(MotionEvent) when it needs access to information about the area and/or ItemDetails under a MotionEvent.

Public methods

abstract ItemDetailsLookup.ItemDetails<K>?

Public constructors

<init>

ItemDetailsLookup()

The Selection library calls getItemDetails(MotionEvent) when it needs access to information about the area and/or 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 ItemDetails instance.

Example

final class MyDetailsLookup extends ItemDetailsLookup<uri>
  {
 
    private final RecyclerView mRecyclerView;
 
    MyDetailsLookup(RecyclerView recyclerView) {
        mRecyclerView = recyclerView;
    }
 
    public ItemDetails
 <uri>
   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; } } 
 </uri>
</uri>

Public methods

getItemDetails

@Nullable abstract fun getItemDetails(@NonNull e: MotionEvent): ItemDetailsLookup.ItemDetails<K>?
Return
ItemDetailsLookup.ItemDetails<K>?: the ItemDetails for the item under the event, or null.