OnSwipe
public class OnSwipe
Create automatic swipe handling object
Summary
Nested types |
|---|
public enum OnSwipe.Boundary |
public enum OnSwipe.Drag |
public enum OnSwipe.Mode |
public enum OnSwipe.Side |
public enum OnSwipe.TouchUp |
Constants |
|
|---|---|
static final int |
|
static final int |
Public constructors |
|---|
OnSwipe() |
OnSwipe(String anchor, OnSwipe.Side side, OnSwipe.Drag dragDirection) |
Public methods |
|
|---|---|
OnSwipe.Mode |
|
OnSwipe.Drag |
|
float |
|
float |
|
String |
|
float |
|
float |
|
OnSwipe.TouchUp |
|
String |
|
OnSwipe.Boundary |
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. |
String |
|
OnSwipe.Side |
|
void |
setAutoCompleteMode(OnSwipe.Mode autoCompleteMode)sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1; |
OnSwipe |
setDragDirection(OnSwipe.Drag 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 |
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 |
setOnTouchUp(OnSwipe.TouchUp mode)Configures what happens when the user releases on mouse up. |
OnSwipe |
setRotateCenter(String rotationCenterId)The view to center the rotation about |
OnSwipe |
setSpringBoundary(OnSwipe.Boundary 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 |
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 |
This side of the view that matches the drag movement. |
String |
toString() |
Constants
Public constructors
Public methods
getSpringBoundary
public OnSwipe.Boundary getSpringBoundary()
The behaviour at the boundaries 0 and 1
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
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.
setAutoCompleteMode
public void setAutoCompleteMode(OnSwipe.Mode autoCompleteMode)
sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;
setDragDirection
public OnSwipe setDragDirection(OnSwipe.Drag dragDirection)
The direction of the drag.
setDragScale
public OnSwipe setDragScale(int dragScale)
Normally 1 this can be tweaked to make the acceleration faster
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.
setLimitBoundsTo
public OnSwipe setLimitBoundsTo(String id)
Only allow touch actions to be initiated within this region
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
setMaxVelocity
public OnSwipe setMaxVelocity(int maxVelocity)
The maximum velocity (Change in progress per second) animation can achieve
setOnTouchUp
public OnSwipe setOnTouchUp(OnSwipe.TouchUp 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 | |
|---|---|
OnSwipe.TouchUp mode |
default = ON_UP_AUTOCOMPLETE |
setRotateCenter
public OnSwipe setRotateCenter(String rotationCenterId)
The view to center the rotation about
| Returns | |
|---|---|
OnSwipe |
this |
setSpringBoundary
public OnSwipe setSpringBoundary(OnSwipe.Boundary springBoundary)
The behaviour at the boundaries 0 and 1.
| Parameters | |
|---|---|
OnSwipe.Boundary springBoundary |
behaviour at the boundaries |
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
| 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
| 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
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 |
when to stop. |
setTouchAnchorId
public OnSwipe setTouchAnchorId(String id)
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
setTouchAnchorSide
public OnSwipe setTouchAnchorSide(OnSwipe.Side 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)