public class SwipeListViewTouchListener extends Object implements View.OnTouchListener
Modifier and Type | Class and Description |
---|---|
static interface |
SwipeListViewTouchListener.OnSwipeCallback
The callback interface used by
SwipeListViewTouchListener to inform its client
about a successful swipe of one or more list item positions. |
Constructor and Description |
---|
SwipeListViewTouchListener(ListView listView,
SwipeListViewTouchListener.OnSwipeCallback callback)
Constructs a new swipe-to-action touch listener for the given list view.
|
SwipeListViewTouchListener(ListView listView,
SwipeListViewTouchListener.OnSwipeCallback callback,
boolean dismissLeft,
boolean dismissRight)
Constructs a new swipe-to-action touch listener for the given list view.
|
Modifier and Type | Method and Description |
---|---|
AbsListView.OnScrollListener |
makeScrollListener()
Returns an
AbsListView.OnScrollListener to be added to the
ListView using
AbsListView.setOnScrollListener(android.widget.AbsListView.OnScrollListener) . |
boolean |
onTouch(View view,
MotionEvent motionEvent) |
void |
setEnabled(boolean enabled)
Enables or disables (pauses or resumes) watching for swipe-to-dismiss gestures.
|
public SwipeListViewTouchListener(ListView listView, SwipeListViewTouchListener.OnSwipeCallback callback)
listView
- The list view whose items should be dismissable.callback
- The callback to trigger when the user has indicated that she would like to
dismiss one or more list items.public SwipeListViewTouchListener(ListView listView, SwipeListViewTouchListener.OnSwipeCallback callback, boolean dismissLeft, boolean dismissRight)
listView
- The list view whose items should be dismissable.callback
- The callback to trigger when the user has indicated that she would like to
dismiss one or more list items.dismissLeft
- set if the dismiss animation is up when the user swipe to the leftdismissRight
- set if the dismiss animation is up when the user swipe to the rightSwipeListViewTouchListener(ListView, OnSwipeCallback, boolean, boolean)
public void setEnabled(boolean enabled)
enabled
- Whether or not to watch for gestures.public AbsListView.OnScrollListener makeScrollListener()
AbsListView.OnScrollListener
to be added to the
ListView
using
AbsListView.setOnScrollListener(android.widget.AbsListView.OnScrollListener)
.
If a scroll listener is already assigned, the caller should still pass scroll changes
through to this listener. This will ensure that this
SwipeListViewTouchListener
is paused during list view scrolling.SwipeListViewTouchListener}
public boolean onTouch(View view, MotionEvent motionEvent)
onTouch
in interface View.OnTouchListener