public class OnSwipeListener extends Object implements View.OnTouchListener
Modifier and Type | Class and Description |
---|---|
static interface |
OnSwipeListener.OnScaleListenerImpl
This interface makes it easier to detect mouse/finger pinch-to-scale motions on a view.
|
static class |
OnSwipeListener.OnSwipeAdapterImpl
This class makes it easier to detect mouse/finger swipe motions on a view.
|
static interface |
OnSwipeListener.OnSwipeListenerImpl
This interface makes it easier to detect mouse/finger swipe motions on a view.
|
Constructor and Description |
---|
OnSwipeListener(Context context)
Constructs a new listener for the given context (activity or fragment).
|
Modifier and Type | Method and Description |
---|---|
void |
onScale(float factor)
You can override this method if you want to subclass OnSwipeListener.
|
void |
onSwipeDown(float distance)
You can override this method if you want to subclass OnSwipeListener.
|
void |
onSwipeLeft(float distance)
You can override this method if you want to subclass OnSwipeListener.
|
void |
onSwipeRight(float distance)
You can override this method if you want to subclass OnSwipeListener.
|
void |
onSwipeUp(float distance)
You can override this method if you want to subclass OnSwipeListener.
|
boolean |
onTouch(View view,
MotionEvent event)
Internal method used to implement mouse touch events.
|
OnSwipeListener |
setAnimated(boolean anim)
Sets whether the view should animate itself when it snaps back or slides off screen.
|
OnSwipeListener |
setAnimationDelay(long ms)
Sets the number of milliseconds long that each drag/snap animation will take.
|
OnSwipeListener |
setDistanceThreshold(float px)
Sets the number of pixels before the listener considers the user to have swiped.
|
OnSwipeListener |
setDragHorizontal(boolean drag)
Sets whether the view should track the user's finger as it is dragged horizontally.
|
OnSwipeListener |
setDragSnapBack(boolean snap)
Sets whether the view should snap back into position when the user stops dragging it.
|
OnSwipeListener |
setDragSnapThreshold(float px)
Sets the number of pixels in which the view will "snap back" if dragged.
|
OnSwipeListener |
setDragVertical(boolean drag)
Sets whether the view should track the user's finger as it is dragged vertically.
|
OnSwipeListener |
setExitScreenOnSwipe(boolean exit)
Sets whether the view should slide itself off the screen once it has been swiped.
|
OnSwipeListener |
setVelocityThreshold(float px)
Sets the rate of finger speed before the listener considers the user to have swiped.
|
public OnSwipeListener(Context context)
public void onSwipeLeft(float distance)
public void onSwipeRight(float distance)
public void onSwipeUp(float distance)
public void onSwipeDown(float distance)
public void onScale(float factor)
public final boolean onTouch(View view, MotionEvent event)
onTouch
in interface View.OnTouchListener
public OnSwipeListener setDistanceThreshold(float px)
public OnSwipeListener setVelocityThreshold(float px)
public OnSwipeListener setDragSnapThreshold(float px)
public OnSwipeListener setAnimationDelay(long ms)
public OnSwipeListener setExitScreenOnSwipe(boolean exit)
public OnSwipeListener setDragHorizontal(boolean drag)
public OnSwipeListener setDragVertical(boolean drag)
public OnSwipeListener setDragSnapBack(boolean snap)
public OnSwipeListener setAnimated(boolean anim)