public class AnimateAdditionAdapter<T>
extends com.nhaarman.listviewanimations.BaseAdapterDecorator
ListView with an animation. The root BaseAdapter should implement Insertable,
otherwise an IllegalArgumentException is thrown. This class only works with an instance of ListView!
Usage:BaseAdapter. ListView to this class using setListView(android.widget.ListView).insert(int, Object) to animate the addition of an item.
Extend this class and override getAdditionalAnimators(android.view.View,
android.view.ViewGroup) to provide extra Animators.IGNORE_ITEM_VIEW_TYPE, NO_SELECTION| Constructor and Description |
|---|
AnimateAdditionAdapter(BaseAdapter baseAdapter)
Create a new
AnimateAdditionAdapter with given BaseAdapter. |
| Modifier and Type | Method and Description |
|---|---|
protected com.nineoldandroids.animation.Animator[] |
getAdditionalAnimators(View view,
ViewGroup parent)
Override this method to provide additional animators on top of the default height and alpha animation.
|
View |
getView(int position,
View convertView,
ViewGroup parent) |
void |
insert(int index,
T... items)
Inserts items, starting at given index.
|
void |
insert(int index,
T item)
Inserts an item at given index.
|
void |
insert(Iterable<Pair<Integer,T>> indexItemPairs)
Inserts items at given indexes.
|
void |
insert(Pair<Integer,T>... indexItemPairs)
Inserts items at given indexes.
|
void |
setAbsListView(AbsListView absListView)
Deprecated.
use
setListView(android.widget.ListView) instead. |
void |
setInsertionAnimationDuration(long insertionAnimationDurationMs)
Set the duration of the insertion animation.
|
void |
setListView(ListView listView)
Sets the
ListView that is used for this AnimateAdditionAdapter. |
void |
setScrolldownAnimationDuration(long scrolldownAnimationDurationMs)
Set the duration of the scrolldown animation per item for when items are inserted above the first visible item.
|
void |
setShouldAnimateDown(boolean shouldAnimateDown)
Sets whether the list should animate downwards when items are added above the first visible item.
|
add, areAllItemsEnabled, getCount, getDecoratedBaseAdapter, getDropDownView, getItem, getItemId, getItemViewType, getListViewWrapper, getPositionForSection, getRootAdapter, getSectionForPosition, getSections, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, setListViewWrapper, swapItems, unregisterDataSetObserverpublic AnimateAdditionAdapter(BaseAdapter baseAdapter)
AnimateAdditionAdapter with given BaseAdapter.baseAdapter - should implement Insertable,
or be a BaseAdapterDecorator whose BaseAdapter implements the interface.@Deprecated public void setAbsListView(AbsListView absListView)
setListView(android.widget.ListView) instead.setAbsListView in class com.nhaarman.listviewanimations.BaseAdapterDecoratorpublic void setListView(ListView listView)
ListView that is used for this AnimateAdditionAdapter.public void setShouldAnimateDown(boolean shouldAnimateDown)
shouldAnimateDown - defaults to true.public void setScrolldownAnimationDuration(long scrolldownAnimationDurationMs)
scrolldownAnimationDurationMs - the duration in ms.public void setInsertionAnimationDuration(long insertionAnimationDurationMs)
insertionAnimationDurationMs - the duration in ms.public void insert(int index,
T item)
Insertable.add(int, Object) of the root BaseAdapter.index - the index the new item should be inserted at.item - the item to insert.public void insert(int index,
T... items)
Insertable.add(int, Object) of the root BaseAdapter.index - the starting index the new items should be inserted at.items - the items to insert.public void insert(Pair<Integer,T>... indexItemPairs)
Insertable.add(int, Object) of the root BaseAdapter.indexItemPairs - the index-item pairs to insert. The first argument of the Pair is the index, the second argument is the item.public void insert(Iterable<Pair<Integer,T>> indexItemPairs)
Insertable.add(int, Object) of the root BaseAdapter.indexItemPairs - the index-item pairs to insert. The first argument of the Pair is the index, the second argument is the item.protected com.nineoldandroids.animation.Animator[] getAdditionalAnimators(View view, ViewGroup parent)
view - The View that will get animated.parent - The parent that this view will eventually be attached to.