Swipe Dismiss Touch Listener
A android.view.View.OnTouchListener that makes any android.view.View dismissable when the user swipes (drags her finger) horizontally across the view. Optionally supports vertical swipe dismissal in a single configured direction (up or down).
For android.widget.ListView list items that don't manage their own touch events (i.e. you're using setOnItemClickListener or an equivalent listener on android.app.ListActivity or android.app.ListFragment, use SwipeDismissListViewTouchListener instead.
Example usage:
view.setOnTouchListener(new SwipeDismissTouchListener(
view,
null, // Optional token/cookie object
new SwipeDismissTouchListener.OnDismissCallback() {
public void onDismiss(View view, Object token) {
parent.removeView(view);
}
}));
Content copied to clipboard
This class Requires API level 12 or later due to use of android.view.ViewPropertyAnimator.
See also
Swipe Dismiss List View Touch Listener
Inheritors
Constructors
Link copied to clipboard
Constructs a new swipe-to-dismiss touch listener for the given view with horizontal-only dismissal.
constructor(view: View, token: Any, callbacks: SwipeDismissTouchListener.DismissCallbacks, verticalDismissDirection: SwipeDismissTouchListener.VerticalDismissDirection)
Constructs a new swipe-to-dismiss touch listener for the given view.
Types
Link copied to clipboard
interface DismissCallbacks
The callback interface used by SwipeDismissTouchListener to inform its client about a successful dismissal of the view for which it was created.
Link copied to clipboard
Specifies which vertical swipe direction, if any, should trigger a dismiss.