SwipeDismissTouchListener

Source : https://github.com/romannurik/Android-SwipeToDismiss/blob/master/src/com/example/android/swipedismiss/SwipeDismissTouchListener.java

A View.OnTouchListener that makes any View dismissable when the user swipes (drags her finger) horizontally across the view.

For ListView list items that don't manage their own touch events (i.e. you're using setOnItemClickListener or an equivalent listener on ListActivity or https://github.com/romannurik/Android-SwipeToDismiss/blob/master/src/com/example/android/swipedismiss/SwipeDismissListViewTouchListener.java .

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);
            }
        }));

This class Requires API level 12 or later due to use of android.view.ViewPropertyAnimator.

Constructors

Link copied to clipboard
constructor(view: View, token: Any, callbacks: SwipeDismissTouchListener.DismissCallbacks)
Constructs a new swipe-to-dismiss touch listener for the given view.

Types

Link copied to clipboard
The callback interface used by SwipeDismissTouchListener to inform its client about a successful dismissal of the view for which it was created.

Functions

Link copied to clipboard
open fun onTouch(view: View, motionEvent: MotionEvent): Boolean