public abstract class AbstractItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder> extends java.lang.Object implements IItem<Item,VH>, IClickable<Item>
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
mEnabled |
protected long |
mIdentifier |
protected OnClickListener<Item> |
mOnItemClickListener |
protected OnClickListener<Item> |
mOnItemPreClickListener |
protected boolean |
mSelectable |
protected boolean |
mSelected |
protected java.lang.Object |
mTag |
| Constructor and Description |
|---|
AbstractItem() |
| Modifier and Type | Method and Description |
|---|---|
void |
attachToWindow(VH holder)
View got attached to the window
|
void |
bindView(VH holder,
java.util.List<java.lang.Object> payloads)
Binds the data of this item to the given holder
|
android.view.View |
createView(android.content.Context ctx,
android.view.ViewGroup parent)
this method is called by generateView(Context ctx), generateView(Context ctx, ViewGroup parent) and getViewHolder(ViewGroup parent)
it will generate the View from the layout, overwrite this if you want to implement your view creation programatically
|
void |
detachFromWindow(VH holder)
View got detached from the window
|
boolean |
equals(int id)
If this item equals to the given identifier
|
boolean |
equals(java.lang.Object o)
If this item equals to the given object
|
boolean |
failedToRecycle(VH holder)
RecyclerView was not able to recycle that viewHolder because it's in a transient state
Implement this and clear any animations, to allow recycling.
|
android.view.View |
generateView(android.content.Context ctx)
generates a view by the defined LayoutRes
|
android.view.View |
generateView(android.content.Context ctx,
android.view.ViewGroup parent)
generates a view by the defined LayoutRes and pass the LayoutParams from the parent
|
long |
getIdentifier()
returns the identifier of this item
-1 is the default not set state
|
OnClickListener<Item> |
getOnItemClickListener() |
OnClickListener<Item> |
getOnPreItemClickListener() |
java.lang.Object |
getTag()
return a Tag of the Item
|
abstract VH |
getViewHolder(android.view.View v)
This method returns the ViewHolder for our item, using the provided View.
|
VH |
getViewHolder(android.view.ViewGroup parent)
Generates a ViewHolder from this Item with the given parent
|
int |
hashCode()
the hashCode implementation
|
boolean |
isEnabled()
return if the item is enabled
|
boolean |
isSelectable()
return if the item is selectable
|
boolean |
isSelected()
return if the item is selected
|
void |
unbindView(VH holder)
View needs to release resources when its recycled
|
Item |
withEnabled(boolean enabled)
set if this item is enabled
|
Item |
withIdentifier(long identifier)
set the identifier of this item
|
Item |
withOnItemClickListener(OnClickListener<Item> onItemClickListener)
provide a listener which is called before the click listener is called within the adapter
return true if you want to consume the event
|
Item |
withOnItemPreClickListener(OnClickListener<Item> onItemPreClickListener)
provide a listener which is called before any processing is done within the adapter
return true if you want to consume the event
|
Item |
withSelectable(boolean selectable)
set if this item is selectable
|
Item |
withSetSelected(boolean selected)
set if this item is selected
|
Item |
withTag(java.lang.Object object)
set the tag of this item
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetLayoutRes, getTypeprotected long mIdentifier
protected java.lang.Object mTag
protected boolean mEnabled
protected boolean mSelected
protected boolean mSelectable
protected OnClickListener<Item extends IItem & IClickable> mOnItemPreClickListener
protected OnClickListener<Item extends IItem & IClickable> mOnItemClickListener
public Item withIdentifier(long identifier)
withIdentifier in interface IIdentifyable<Item extends IItem & IClickable>identifier - public long getIdentifier()
IIdentifyablegetIdentifier in interface IIdentifyable<Item extends IItem & IClickable>public Item withTag(java.lang.Object object)
public java.lang.Object getTag()
IItempublic Item withEnabled(boolean enabled)
withEnabled in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>enabled - true if this item is enabledpublic boolean isEnabled()
IItempublic Item withSetSelected(boolean selected)
withSetSelected in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>selected - true if this item is selectedpublic boolean isSelected()
IItemisSelected in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>public Item withSelectable(boolean selectable)
withSelectable in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>selectable - true if this item is selectablepublic boolean isSelectable()
IItemisSelectable in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>public Item withOnItemPreClickListener(OnClickListener<Item> onItemPreClickListener)
withOnItemPreClickListener in interface IClickable<Item extends IItem & IClickable>onItemPreClickListener - the listenerpublic OnClickListener<Item> getOnPreItemClickListener()
getOnPreItemClickListener in interface IClickable<Item extends IItem & IClickable>public Item withOnItemClickListener(OnClickListener<Item> onItemClickListener)
withOnItemClickListener in interface IClickable<Item extends IItem & IClickable>onItemClickListener - the listenerpublic OnClickListener<Item> getOnItemClickListener()
getOnItemClickListener in interface IClickable<Item extends IItem & IClickable>public void bindView(VH holder, java.util.List<java.lang.Object> payloads)
public void unbindView(VH holder)
unbindView in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>holder - public void attachToWindow(VH holder)
attachToWindow in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>holder - public void detachFromWindow(VH holder)
detachFromWindow in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>holder - public boolean failedToRecycle(VH holder)
failedToRecycle in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>holder - public android.view.View createView(android.content.Context ctx,
android.view.ViewGroup parent)
ctx - parent - public android.view.View generateView(android.content.Context ctx)
generateView in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>ctx - public android.view.View generateView(android.content.Context ctx,
android.view.ViewGroup parent)
generateView in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>ctx - parent - public VH getViewHolder(android.view.ViewGroup parent)
getViewHolder in interface IItem<Item extends IItem & IClickable,VH extends RecyclerView.ViewHolder>parent - public abstract VH getViewHolder(android.view.View v)
v - public boolean equals(int id)
public boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - public int hashCode()
hashCode in class java.lang.Object