ItemType - The type of the items, which should be visualized by inflated viewsParamType - The type of the optional parameters, which may be passed when inflating a viewpublic class AttachedViewRecycler<ItemType,ParamType> extends AbstractViewRecycler<ItemType,ParamType>
AttachedViewRecycler is bound to a
ViewGroup, which acts as the parent of all inflated views. Each time a view is inflated
using the inflate-method, it is added the the parent. By calling the
remove- or removeAll-method, previously inflated views can be removed
from the parent. They will be kept in a cache in order to reuse them later.AbstractViewRecycler.Adapter<ItemType,ParamType>| Constructor and Description |
|---|
AttachedViewRecycler(android.view.ViewGroup parent)
Creates a new recycler, which allows to cache views in order to be able to reuse them later
instead of inflating new instances.
|
AttachedViewRecycler(android.view.ViewGroup parent,
java.util.Comparator<ItemType> comparator)
Creates a new recycler, which allows to cache views in order to be able to reuse them later
instead of inflating new instances.
|
AttachedViewRecycler(android.view.ViewGroup parent,
android.view.LayoutInflater inflater)
Creates a new recycler, which allows to cache views in order to be able to reuse them later
instead of inflating new instances.
|
AttachedViewRecycler(android.view.ViewGroup parent,
android.view.LayoutInflater inflater,
java.util.Comparator<ItemType> comparator)
Creates a new recycler, which allows to cache views in order to be able to reuse them later
instead of inflating new instances.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bringToFront(ItemType item)
Brings a previously inflated view, which is used to visualize a specific item, to the front.
|
<any> |
inflate(ItemType item,
boolean useCache,
ParamType... params)
Inflates the view, which is used to visualize a specific item.
|
void |
remove(ItemType item)
Removes a previously inflated view, which is used to visualize a specific item.
|
void |
removeAll()
Removes all previously inflated views.
|
void |
setComparator(java.util.Comparator<ItemType> comparator)
Sets the comparator, which allows to determine the order, which should be used to add views
to the parent.
|
addUnusedView, clearCache, clearCache, getActiveViews, getAdapter, getContext, getLayoutInflater, getLogger, getLogLevel, getView, inflate, isCacheUsed, isInflated, pollUnusedView, setAdapter, setLogLevel, useCachepublic AttachedViewRecycler(android.view.ViewGroup parent)
parent - The parent, the recycler should be bound to, as an instance of the class ViewGroup. The parent may not be nullpublic AttachedViewRecycler(android.view.ViewGroup parent,
java.util.Comparator<ItemType> comparator)
parent - The parent, the recycler should be bound to, as an instance of the class ViewGroup. The parent may not be nullcomparator - The comparator, which allows to determine the order, which should be used to add
views to the parent, as an instance of the type Comparator or null, if the
views should be added in the order of their inflationpublic AttachedViewRecycler(android.view.ViewGroup parent,
android.view.LayoutInflater inflater)
parent - The parent, the recycler should be bound to, as an instance of the class ViewGroup. The parent may not be nullinflater - The layout inflater, which should be used to inflate views, as an instance of the
class LayoutInflater. The layout inflater may not be nullpublic AttachedViewRecycler(android.view.ViewGroup parent,
android.view.LayoutInflater inflater,
java.util.Comparator<ItemType> comparator)
parent - The parent, the recycler should be bound to, as an instance of the class ViewGroup. The parent may not be nullinflater - The layout inflater, which should be used to inflate views, as an instance of the
class LayoutInflater. The layout inflater may not be nullcomparator - The comparator, which allows to determine the order, which should be used to add
views to the parent, as an instance of the type Comparator or null, if the
views should be added in the order of their inflationpublic final void bringToFront(ItemType item)
Comparator for determining
the order of attached views. Otherwise, calling this method may cause the order of views to
conflict with the order, which is given by the comparator. Instead, the setComparator(Comparator) method should be used in such case. It allows
to set a new comparator and reorders the views accordingly.item - The item, which is visualized by the view, which should be brought to the front, as
an instance of the generic type ItemType. The item may not be nullsetComparator(Comparator)public final void setComparator(java.util.Comparator<ItemType> comparator)
comparator - The comparator, which allows to determine the order, which should be used to add
views to the parent, as an instance of the type Comparator or null, if the
views should be added in the order of their inflation@SafeVarargs public final <any> inflate(ItemType item, boolean useCache, ParamType... params)
AbstractViewRecyclerinflate in class AbstractViewRecycler<ItemType,ParamType>item - The item, which should be visualized by the inflated view, as an instance of the
generic type ItemType. The item may not be nulluseCache - True, if an unused view should retrieved from the cache, if possible, false, if a new
instance should be inflated insteadparams - An array, which may contain optional parameters, as an array of the generic type
ParamType or an empty array, if no optional parameters are availablepublic final void remove(ItemType item)
AbstractViewRecyclerremove in class AbstractViewRecycler<ItemType,ParamType>item - The item, which is visualized by the view, which should be removed, as an instance of
the generic type ItemType. The item may not be nullpublic final void removeAll()
AbstractViewRecyclerremoveAll in class AbstractViewRecycler<ItemType,ParamType>