public abstract class ExpandableListItemAdapter<T>
extends com.nhaarman.listviewanimations.ArrayAdapter<T>
implements com.nhaarman.listviewanimations.util.ListViewWrapperSetter
ArrayAdapter which allows items to be expanded using an animation.| Modifier and Type | Class and Description |
|---|---|
static interface |
ExpandableListItemAdapter.ExpandCollapseListener |
IGNORE_ITEM_VIEW_TYPE, NO_SELECTION| Modifier | Constructor and Description |
|---|---|
protected |
ExpandableListItemAdapter(Context context)
Creates a new ExpandableListItemAdapter with an empty list.
|
protected |
ExpandableListItemAdapter(Context context,
int layoutResId,
int titleParentResId,
int contentParentResId)
Creates a new ExpandableListItemAdapter with an empty list.
|
protected |
ExpandableListItemAdapter(Context context,
int layoutResId,
int titleParentResId,
int contentParentResId,
List<T> items)
Creates a new ExpandableListItemAdapter with the specified list, or an
empty list if items == null.
|
protected |
ExpandableListItemAdapter(Context context,
List<T> items)
Creates a new
ExpandableListItemAdapter with the specified list,
or an empty list if items == null. |
| Modifier and Type | Method and Description |
|---|---|
void |
collapse(int position)
Collapse the view at given position.
|
void |
expand(int position)
Expand the view at given position.
|
View |
getContentView(int position)
Return the content view at the specified position.
|
abstract View |
getContentView(int position,
View convertView,
ViewGroup parent)
Get a View that displays the content of the data at the specified
position in the data set.
|
View |
getTitleView(int position)
Return the title view at the specified position.
|
abstract View |
getTitleView(int position,
View convertView,
ViewGroup parent)
Get a View that displays the title of the data at the specified
position in the data set.
|
View |
getView(int position,
View convertView,
ViewGroup parent) |
boolean |
isExpanded(int position)
Indicates if the item at the specified position is expanded.
|
void |
notifyDataSetChanged() |
void |
setActionViewResId(int resId)
Set the resource id of the child
View contained in the View
returned by getTitleView(int, android.view.View, android.view.ViewGroup) that will be the
actuator of the expand / collapse animations.If there is no View in the title View with given resId, a NullPointerException is thrown. |
void |
setExpandCollapseListener(ExpandableListItemAdapter.ExpandCollapseListener expandCollapseListener)
Set the
ExpandableListItemAdapter.ExpandCollapseListener that should be notified of expand / collapse events. |
void |
setLimit(int limit)
Set the maximum number of items allowed to be expanded.
|
void |
setListViewWrapper(com.nhaarman.listviewanimations.util.ListViewWrapper listViewWrapper) |
void |
toggle(int position)
Toggle the
View at given position, ignores header or footer Views. |
add, add, addAll, clear, contains, getCount, getItem, getItemId, getItems, propagateNotifyDataSetChanged, remove, remove, swapItemsareAllItemsEnabled, getDropDownView, getItemViewType, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetInvalidated, registerDataSetObserver, unregisterDataSetObserverprotected ExpandableListItemAdapter(Context context)
protected ExpandableListItemAdapter(Context context, List<T> items)
ExpandableListItemAdapter with the specified list,
or an empty list if items == null.protected ExpandableListItemAdapter(Context context, int layoutResId, int titleParentResId, int contentParentResId)
protected ExpandableListItemAdapter(Context context, int layoutResId, int titleParentResId, int contentParentResId, List<T> items)
public void setListViewWrapper(com.nhaarman.listviewanimations.util.ListViewWrapper listViewWrapper)
setListViewWrapper in interface com.nhaarman.listviewanimations.util.ListViewWrapperSetterpublic void setActionViewResId(int resId)
View contained in the View
returned by getTitleView(int, android.view.View, android.view.ViewGroup) that will be the
actuator of the expand / collapse animations.NullPointerException is thrown. Default behavior: the whole
title View acts as the actuator.resId - the resource id.public void setLimit(int limit)
limit - the maximum number of items allowed to be expanded. Use <= 0
for no limit.public void setExpandCollapseListener(ExpandableListItemAdapter.ExpandCollapseListener expandCollapseListener)
ExpandableListItemAdapter.ExpandCollapseListener that should be notified of expand / collapse events.public abstract View getTitleView(int position, View convertView, ViewGroup parent)
LayoutInflater.inflate(int, android.view.ViewGroup, boolean)
to specify a root view and to prevent attachment to the root.position - The position of the item within the adapter's data set of the
item whose view we want.convertView - The old view to reuse, if possible. Note: You should check
that this view is non-null and of an appropriate type before
using. If it is not possible to convert this view to display
the correct data, this method can create a new view.parent - The parent that this view will eventually be attached topublic abstract View getContentView(int position, View convertView, ViewGroup parent)
LayoutInflater.inflate(int, android.view.ViewGroup, boolean)
to specify a root view and to prevent attachment to the root.position - The position of the item within the adapter's data set of the
item whose view we want.convertView - The old view to reuse, if possible. Note: You should check
that this view is non-null and of an appropriate type before
using. If it is not possible to convert this view to display
the correct data, this method can create a new view.parent - The parent that this view will eventually be attached topublic boolean isExpanded(int position)
position - Index of the view whose state we want.public View getTitleView(int position)
position - Index of the view we want.public View getContentView(int position)
position - Index of the view we want.public void notifyDataSetChanged()
notifyDataSetChanged in class com.nhaarman.listviewanimations.ArrayAdapter<T>public void expand(int position)
position - the position to expand.public void collapse(int position)
position - the position to collapse.public void toggle(int position)
View at given position, ignores header or footer Views.position - the position of the view to toggle.