-
- All Implemented Interfaces:
-
android.view.View.OnClickListener
,android.view.View.OnLongClickListener
public abstract class BaseRecyclerViewHolder<T extends Object> extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener
A base ViewHolder that handles click and long click events.
-
-
Field Summary
Fields Modifier and Type Field Description private final Context
context
private final View
itemView
private final WeakReference<RecyclerView>
mNestedRecyclerView
private final Integer
mPosition
private final Integer
mOldPosition
private final Long
mItemId
private final Integer
mItemViewType
private final Integer
mPreLayoutPosition
private final RecyclerView.ViewHolder
mShadowedHolder
private final RecyclerView.ViewHolder
mShadowingHolder
private final Integer
mFlags
private final List<Object>
mPayloads
private final List<Object>
mUnmodifiedPayloads
private final RecyclerView.Recycler
mScrapContainer
private final Boolean
mInChangeScrap
private final Integer
mPendingAccessibilityState
private final RecyclerView
mOwnerRecyclerView
-
Constructor Summary
Constructors Constructor Description BaseRecyclerViewHolder(ViewGroup parentView, Integer layoutId)
Constructor. BaseRecyclerViewHolder(View itemView)
Constructor.
-
Method Summary
Modifier and Type Method Description final Context
getContext()
Unit
bindItem(T item)
Calls to update the contents with the item. final Unit
setItemClickListener(Function1<Integer, Unit> onItemClick)
Register a callback to be invoked when this item is clicked. final Unit
setItemLongClickListener(Function1<Integer, Unit> onItemLongClick)
Register a callback to be invoked when this item is clicked and held. Unit
onClick(View itemView)
Boolean
onLongClick(View itemView)
-
Methods inherited from class com.pointrlabs.core.map.views.helper_views.BaseRecyclerViewHolder
addChangePayload, addFlags, clearOldPosition, clearPayload, clearReturnedFromScrapFlag, clearTmpDetachFlag, doesTransientStatePreventRecycling, flagRemovedAndOffsetPosition, getAdapterPosition, getItemId, getItemViewType, getLayoutPosition, getOldPosition, getPosition, getUnmodifiedPayloads, hasAnyOfTheFlags, isAdapterPositionUnknown, isBound, isInvalid, isRecyclable, isRemoved, isScrap, isTmpDetached, isUpdated, needsUpdate, offsetPosition, onEnteredHiddenState, onLeftHiddenState, resetInternal, saveOldPosition, setFlags, setIsRecyclable, setScrapContainer, shouldBeKeptAsChild, shouldIgnore, stopIgnoring, toString, unScrap, wasReturnedFromScrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getContext
final Context getContext()
-
bindItem
@CallSuper() Unit bindItem(T item)
Calls to update the contents with the item.
Override to set up some private fields to be used by RecyclerView.
-
setItemClickListener
final Unit setItemClickListener(Function1<Integer, Unit> onItemClick)
Register a callback to be invoked when this item is clicked.
- Parameters:
onItemClick
- callback
-
setItemLongClickListener
final Unit setItemLongClickListener(Function1<Integer, Unit> onItemLongClick)
Register a callback to be invoked when this item is clicked and held.
- Parameters:
onItemLongClick
- callback
-
onLongClick
Boolean onLongClick(View itemView)
-
-
-
-