public class SwipeDismissAdapter
extends com.nhaarman.listviewanimations.BaseAdapterDecorator
AbsListView away.
Do not call View.setOnTouchListener(android.view.View.OnTouchListener) on your AbsListView!IGNORE_ITEM_VIEW_TYPE, NO_SELECTION| Constructor and Description |
|---|
SwipeDismissAdapter(BaseAdapter baseAdapter,
OnDismissCallback onDismissCallback)
Create a new SwipeDismissAdapter.
|
| Modifier and Type | Method and Description |
|---|---|
void |
dismiss(int position)
Dismisses the
View corresponding to given position. |
SwipeDismissTouchListener |
getDismissTouchListener()
Returns the
SwipeDismissTouchListener that is used by this SwipeDismissAdapter. |
void |
notifyDataSetChanged() |
void |
setDismissableManager(DismissableManager dismissableManager)
Sets the
DismissableManager to specify which views can or cannot be swiped. |
void |
setListViewWrapper(com.nhaarman.listviewanimations.util.ListViewWrapper listViewWrapper) |
void |
setParentIsHorizontalScrollContainer()
If the adapter's
AbsListView is hosted inside a parent(/grand-parent/etc) that can scroll horizontally, horizontal swipes won't
work, because the parent will prevent touch-events from reaching the AbsListView. |
void |
setSwipeTouchChildResId(int childResId)
If the adapter's
AbsListView is hosted inside a parent(/grand-parent/etc) that can scroll horizontally, horizontal swipes won't
work, because the parent will prevent touch events from reaching the AbsListView. |
add, areAllItemsEnabled, getCount, getDecoratedBaseAdapter, getDropDownView, getItem, getItemId, getItemViewType, getListViewWrapper, getPositionForSection, getRootAdapter, getSectionForPosition, getSections, getView, getViewTypeCount, hasStableIds, isEmpty, isEnabled, notifyDataSetChanged, notifyDataSetInvalidated, registerDataSetObserver, setAbsListView, swapItems, unregisterDataSetObserverpublic SwipeDismissAdapter(BaseAdapter baseAdapter, OnDismissCallback onDismissCallback)
baseAdapter - the to useonDismissCallback - the OnDismissCallback to be notified of dismissed items.public void setListViewWrapper(com.nhaarman.listviewanimations.util.ListViewWrapper listViewWrapper)
setListViewWrapper in interface com.nhaarman.listviewanimations.util.ListViewWrapperSettersetListViewWrapper in class com.nhaarman.listviewanimations.BaseAdapterDecoratorpublic void setDismissableManager(DismissableManager dismissableManager)
DismissableManager to specify which views can or cannot be swiped.dismissableManager - null for no restrictions.public void setParentIsHorizontalScrollContainer()
AbsListView is hosted inside a parent(/grand-parent/etc) that can scroll horizontally, horizontal swipes won't
work, because the parent will prevent touch-events from reaching the AbsListView.
Call this method to fix this behavior.
Note that this will prevent the parent from scrolling horizontally when the user touches anywhere in a list item.public void setSwipeTouchChildResId(int childResId)
AbsListView is hosted inside a parent(/grand-parent/etc) that can scroll horizontally, horizontal swipes won't
work, because the parent will prevent touch events from reaching the AbsListView.
If a AbsListView view has a child with the given resource id, the user can still swipe the list item by touching that child.
If the user touches an area outside that child (but inside the list item view), then the swipe will not happen and the parent
will do its job instead (scrolling horizontally).childResId - The resource id of the list items' child that the user should touch to be able to swipe the list items.public void dismiss(int position)
View corresponding to given position.
Calling this method has the same effect as manually swiping an item off the screen.position - the position of the item in the ListAdapter.public SwipeDismissTouchListener getDismissTouchListener()
SwipeDismissTouchListener that is used by this SwipeDismissAdapter.setListViewWrapper(com.nhaarman.listviewanimations.util.ListViewWrapper) has not been called yet.public void notifyDataSetChanged()
notifyDataSetChanged in class com.nhaarman.listviewanimations.BaseAdapterDecorator