OnSwipe
public class OnSwipe
Container for holding swipe information
Summary
Constants |
|
|---|---|
static final int |
|
static final int |
|
static final int |
|
static final int |
DRAG_CLOCKWISE = 6 |
static final int |
DRAG_DOWN = 1 |
static final int |
DRAG_END = 5 |
static final int |
DRAG_LEFT = 2 |
static final int |
DRAG_RIGHT = 3 |
static final int |
DRAG_START = 4 |
static final int |
DRAG_UP = 0 |
static final int |
|
static final int |
|
static final int |
|
static final int |
|
static final int |
|
static final int |
ON_UP_DECELERATE = 4 |
static final int |
|
static final int |
|
static final int |
|
static final int |
ON_UP_STOP = 3 |
static final int |
SIDE_BOTTOM = 3 |
static final int |
SIDE_END = 6 |
static final int |
SIDE_LEFT = 1 |
static final int |
SIDE_MIDDLE = 4 |
static final int |
SIDE_RIGHT = 2 |
static final int |
SIDE_START = 5 |
static final int |
SIDE_TOP = 0 |
static final int |
|
static final int |
|
static final int |
|
static final int |
Public constructors |
|---|
OnSwipe() |
Public methods |
|
|---|---|
int |
|
int |
|
float |
|
float |
|
int |
|
float |
|
float |
|
boolean |
|
int |
|
int |
|
int |
|
int |
The behaviour at the boundaries 0 and 1 |
float |
|
float |
Get the mass of the spring. the m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
float |
get the stiffness of the spring |
float |
The threshold for spring motion to stop. |
int |
|
int |
|
int |
|
void |
setAutoCompleteMode(int autoCompleteMode)sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1; |
OnSwipe |
setDragDirection(int dragDirection)The direction of the drag. |
OnSwipe |
setDragScale(int dragScale)Normally 1 this can be tweaked to make the acceleration faster |
OnSwipe |
setDragThreshold(int dragThreshold)This sets the threshold before the animation is kicked off. |
OnSwipe |
setLimitBoundsTo(int id)Only allow touch actions to be initiated within this region |
OnSwipe |
setMaxAcceleration(int maxAcceleration)The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker |
OnSwipe |
setMaxVelocity(int maxVelocity)The maximum velocity (Change in progress per second) animation can achieve |
OnSwipe |
setMoveWhenScrollAtTop(boolean moveWhenScrollAtTop)When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top. |
OnSwipe |
setNestedScrollFlags(int flags)Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2; |
OnSwipe |
setOnTouchUp(int mode)Configures what happens when the user releases on mouse up. |
OnSwipe |
setRotateCenter(int rotationCenterId)The view to center the rotation about |
OnSwipe |
setSpringBoundary(int springBoundary)The behaviour at the boundaries 0 and 1. |
OnSwipe |
setSpringDamping(float springDamping)Set the damping of the spring if using spring. c in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
OnSwipe |
setSpringMass(float springMass)Set the Mass of the spring if using spring. m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring |
OnSwipe |
setSpringStiffness(float springStiffness)set the stiffness of the spring if using spring. |
OnSwipe |
setSpringStopThreshold(float springStopThreshold)set the threshold for spring motion to stop. |
OnSwipe |
setTouchAnchorId(int side)The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout |
OnSwipe |
setTouchAnchorSide(int side)This side of the view that matches the drag movement. |
OnSwipe |
setTouchRegionId(int side) |
Constants
COMPLETE_MODE_CONTINUOUS_VELOCITY
public static final int COMPLETE_MODE_CONTINUOUS_VELOCITY = 0
ON_UP_DECELERATE_AND_COMPLETE
public static final int ON_UP_DECELERATE_AND_COMPLETE = 5
Public constructors
Public methods
getSpringBoundary
public int getSpringBoundary()
The behaviour at the boundaries 0 and 1
| Returns | |
|---|---|
int |
getSpringMass
public float getSpringMass()
Get the mass of the spring. the m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Returns | |
|---|---|
float |
getSpringStiffness
public float getSpringStiffness()
get the stiffness of the spring
| Returns | |
|---|---|
float |
NaN if not set |
getSpringStopThreshold
public float getSpringStopThreshold()
The threshold for spring motion to stop.
| Returns | |
|---|---|
float |
setAutoCompleteMode
public void setAutoCompleteMode(int autoCompleteMode)
sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;
setDragDirection
public OnSwipe setDragDirection(int dragDirection)
The direction of the drag.
| Parameters | |
|---|---|
int dragDirection |
| Returns | |
|---|---|
OnSwipe |
setDragScale
public OnSwipe setDragScale(int dragScale)
Normally 1 this can be tweaked to make the acceleration faster
| Parameters | |
|---|---|
int dragScale |
| Returns | |
|---|---|
OnSwipe |
setDragThreshold
public OnSwipe setDragThreshold(int dragThreshold)
This sets the threshold before the animation is kicked off. It is important when have multi state animations the have some play before the System decides which animation to jump on.
| Parameters | |
|---|---|
int dragThreshold |
| Returns | |
|---|---|
OnSwipe |
setLimitBoundsTo
public OnSwipe setLimitBoundsTo(int id)
Only allow touch actions to be initiated within this region
| Parameters | |
|---|---|
int id |
| Returns | |
|---|---|
OnSwipe |
setMaxAcceleration
public OnSwipe setMaxAcceleration(int maxAcceleration)
The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker
| Parameters | |
|---|---|
int maxAcceleration |
| Returns | |
|---|---|
OnSwipe |
setMaxVelocity
public OnSwipe setMaxVelocity(int maxVelocity)
The maximum velocity (Change in progress per second) animation can achieve
| Parameters | |
|---|---|
int maxVelocity |
| Returns | |
|---|---|
OnSwipe |
setMoveWhenScrollAtTop
public OnSwipe setMoveWhenScrollAtTop(boolean moveWhenScrollAtTop)
When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top.
| Parameters | |
|---|---|
boolean moveWhenScrollAtTop |
| Returns | |
|---|---|
OnSwipe |
setNestedScrollFlags
public OnSwipe setNestedScrollFlags(int flags)
Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2;
| Parameters | |
|---|---|
int flags |
| Returns | |
|---|---|
OnSwipe |
setOnTouchUp
public OnSwipe setOnTouchUp(int mode)
Configures what happens when the user releases on mouse up. One of: ON_UP_AUTOCOMPLETE, ON_UP_AUTOCOMPLETE_TO_START, ON_UP_AUTOCOMPLETE_TO_END, ON_UP_STOP, ON_UP_DECELERATE, ON_UP_DECELERATE_AND_COMPLETE
| Parameters | |
|---|---|
int mode |
default = ON_UP_AUTOCOMPLETE |
| Returns | |
|---|---|
OnSwipe |
setRotateCenter
public OnSwipe setRotateCenter(int rotationCenterId)
The view to center the rotation about
| Parameters | |
|---|---|
int rotationCenterId |
| Returns | |
|---|---|
OnSwipe |
this |
setSpringBoundary
public OnSwipe setSpringBoundary(int springBoundary)
The behaviour at the boundaries 0 and 1. SPRING_BOUNDARY_OVERSHOOT = 0; SPRING_BOUNDARY_BOUNCE_START = 1; SPRING_BOUNDARY_BOUNCE_END = 2; SPRING_BOUNDARY_BOUNCE_BOTH = 3;
| Parameters | |
|---|---|
int springBoundary |
| Returns | |
|---|---|
OnSwipe |
setSpringDamping
public OnSwipe setSpringDamping(float springDamping)
Set the damping of the spring if using spring. c in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Parameters | |
|---|---|
float springDamping |
| Returns | |
|---|---|
OnSwipe |
this |
setSpringMass
public OnSwipe setSpringMass(float springMass)
Set the Mass of the spring if using spring. m in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Parameters | |
|---|---|
float springMass |
| Returns | |
|---|---|
OnSwipe |
this |
setSpringStiffness
public OnSwipe setSpringStiffness(float springStiffness)
set the stiffness of the spring if using spring. If this is set the swipe will use a spring return system. If set to NaN it will revert to the norm system. K in "a = (-k*x-c*v)/m" equation for the acceleration of a spring
| Parameters | |
|---|---|
float springStiffness |
| Returns | |
|---|---|
OnSwipe |
setSpringStopThreshold
public OnSwipe setSpringStopThreshold(float springStopThreshold)
set the threshold for spring motion to stop. This is in change in progress / second If the spring will never go above that threshold again it will stop.
| Parameters | |
|---|---|
float springStopThreshold |
| Returns | |
|---|---|
OnSwipe |
setTouchAnchorId
public OnSwipe setTouchAnchorId(int side)
The id of the view who's movement is matched to your drag If not specified it will map to a linear movement across the width of the motionLayout
| Parameters | |
|---|---|
int side |
| Returns | |
|---|---|
OnSwipe |
setTouchAnchorSide
public OnSwipe setTouchAnchorSide(int side)
This side of the view that matches the drag movement. Only meaning full if the object changes size during the movement. (rotation is not considered)
| Parameters | |
|---|---|
int side |
| Returns | |
|---|---|
OnSwipe |
setTouchRegionId
public OnSwipe setTouchRegionId(int side)
| Parameters | |
|---|---|
int side |
| Returns | |
|---|---|
OnSwipe |