public abstract class AbstractItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder> extends java.lang.Object implements IItem<Item,VH>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
AbstractItem.ReflectionBasedViewHolderFactory<VH extends android.support.v7.widget.RecyclerView.ViewHolder> |
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
mEnabled |
protected ViewHolderFactory<? extends VH> |
mFactory |
protected long |
mIdentifier |
protected boolean |
mSelectable |
protected boolean |
mSelected |
protected java.lang.Object |
mTag |
| Constructor and Description |
|---|
AbstractItem() |
| Modifier and Type | Method and Description |
|---|---|
void |
bindView(VH holder)
Binds the data of this item to the given holder
|
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
|
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
|
ViewHolderFactory<? extends VH> |
getFactory()
the abstract method to retrieve the ViewHolder factory
The ViewHolder factory implementation should look like (see the commented code above)
|
long |
getIdentifier()
returns the identifier of this item
-1 is the default not set state
|
java.lang.Object |
getTag()
return a Tag of the Item
|
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
|
protected java.lang.Class<? extends VH> |
viewHolderType()
gets the viewHolder via the generic superclass
|
Item |
withEnabled(boolean enabled)
set if this item is enabled
|
Item |
withFactory(ViewHolderFactory<? extends VH> factory)
set the view holder factory of this item
|
Item |
withIdentifier(long identifier)
set the identifier of this item
|
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 ViewHolderFactory<? extends VH extends android.support.v7.widget.RecyclerView.ViewHolder> mFactory
public Item withIdentifier(long identifier)
withIdentifier in interface IIdentifyable<Item extends AbstractItem<?,?>>identifier - public long getIdentifier()
IIdentifyablegetIdentifier in interface IIdentifyable<Item extends AbstractItem<?,?>>public Item withTag(java.lang.Object object)
withTag in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>object - public java.lang.Object getTag()
IItemgetTag in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>public Item withEnabled(boolean enabled)
withEnabled in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>enabled - true if this item is enabledpublic boolean isEnabled()
IItemisEnabled in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>public Item withSetSelected(boolean selected)
withSetSelected in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>selected - true if this item is selectedpublic boolean isSelected()
IItemisSelected in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>public Item withSelectable(boolean selectable)
withSelectable in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>selectable - true if this item is selectablepublic boolean isSelectable()
IItemisSelectable in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>public void bindView(VH holder)
IItembindView in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>public android.view.View generateView(android.content.Context ctx)
generateView in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>ctx - public android.view.View generateView(android.content.Context ctx,
android.view.ViewGroup parent)
generateView in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>ctx - parent - public VH getViewHolder(android.view.ViewGroup parent)
getViewHolder in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>parent - public Item withFactory(ViewHolderFactory<? extends VH> factory)
factory - to be setpublic ViewHolderFactory<? extends VH> getFactory()
protected java.lang.Class<? extends VH> viewHolderType()
public VH getViewHolder(android.view.View v)
v - public boolean equals(int id)
equals in interface IItem<Item extends AbstractItem<?,?>,VH extends android.support.v7.widget.RecyclerView.ViewHolder>id - identifierpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - public int hashCode()
hashCode in class java.lang.Object