OnSwipe

public class OnSwipe


Container for holding swipe infomation

Summary

Constants

static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int
static final @NonNull int

Public methods

@NonNull int
@NonNull int
@NonNull float
@NonNull float
@NonNull int
@NonNull float
@NonNull float
@NonNull boolean
@NonNull int
@NonNull int
@NonNull int
@NonNull int

The behaviour at the boundaries 0 and 1

@NonNull float
@NonNull float

Get the mass of the spring.

@NonNull float

get the stiffness of the spring

@NonNull float

The threshold for spring motion to stop.

@NonNull int
@NonNull int
@NonNull int
@NonNull void
setAutoCompleteMode(@NonNull int autoCompleteMode)

sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;

@NonNull OnSwipe
setDragDirection(@NonNull int dragDirection)

The direction of the drag.

@NonNull OnSwipe
setDragScale(@NonNull int dragScale)

Normally 1 this can be tweaked to make the acceleration faster

@NonNull OnSwipe
setDragThreshold(@NonNull int dragThreshold)

This sets the threshold before the animation is kicked off.

@NonNull OnSwipe

Only allow touch actions to be initiated within this region

@NonNull OnSwipe
setMaxAcceleration(@NonNull 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

@NonNull OnSwipe
setMaxVelocity(@NonNull int maxVelocity)

The maximum velocity (Change in progress per second) animation can achive

@NonNull OnSwipe
setMoveWhenScrollAtTop(@NonNull boolean moveWhenScrollAtTop)

When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top.

@NonNull OnSwipe

Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2;

@NonNull OnSwipe
setOnTouchUp(@NonNull int mode)

Configures what happens when the user releases on mouse up.

@NonNull OnSwipe
setRotateCenter(@NonNull int rotationCenterId)

The view to center the rotation about

@NonNull OnSwipe
setSpringBoundary(@NonNull int springBoundary)

The behaviour at the boundaries 0 and 1.

@NonNull OnSwipe
setSpringDamping(@NonNull float springDamping)

Set the damping of the spring if using spring.

@NonNull OnSwipe
setSpringMass(@NonNull float springMass)

Set the Mass of the spring if using spring.

@NonNull OnSwipe
setSpringStiffness(@NonNull float springStiffness)

set the stiffness of the spring if using spring.

@NonNull OnSwipe
setSpringStopThreshold(@NonNull float springStopThreshold)

set the threshold for spring motion to stop.

@NonNull 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

@NonNull OnSwipe

This side of the view that matches the drag movement.

@NonNull OnSwipe

Constants

COMPLETE_MODE_CONTINUOUS_VELOCITY

@NonNull
public static final @NonNull int COMPLETE_MODE_CONTINUOUS_VELOCITY

COMPLETE_MODE_SPRING

@NonNull
public static final @NonNull int COMPLETE_MODE_SPRING

DRAG_ANTICLOCKWISE

@NonNull
public static final @NonNull int DRAG_ANTICLOCKWISE

DRAG_CLOCKWISE

@NonNull
public static final @NonNull int DRAG_CLOCKWISE

DRAG_DOWN

@NonNull
public static final @NonNull int DRAG_DOWN

DRAG_END

@NonNull
public static final @NonNull int DRAG_END

DRAG_LEFT

@NonNull
public static final @NonNull int DRAG_LEFT

DRAG_RIGHT

@NonNull
public static final @NonNull int DRAG_RIGHT

DRAG_START

@NonNull
public static final @NonNull int DRAG_START

DRAG_UP

@NonNull
public static final @NonNull int DRAG_UP

FLAG_DISABLE_POST_SCROLL

@NonNull
public static final @NonNull int FLAG_DISABLE_POST_SCROLL

FLAG_DISABLE_SCROLL

@NonNull
public static final @NonNull int FLAG_DISABLE_SCROLL

ON_UP_AUTOCOMPLETE

@NonNull
public static final @NonNull int ON_UP_AUTOCOMPLETE

ON_UP_AUTOCOMPLETE_TO_END

@NonNull
public static final @NonNull int ON_UP_AUTOCOMPLETE_TO_END

ON_UP_AUTOCOMPLETE_TO_START

@NonNull
public static final @NonNull int ON_UP_AUTOCOMPLETE_TO_START

ON_UP_DECELERATE

@NonNull
public static final @NonNull int ON_UP_DECELERATE

ON_UP_DECELERATE_AND_COMPLETE

@NonNull
public static final @NonNull int ON_UP_DECELERATE_AND_COMPLETE

ON_UP_NEVER_TO_END

@NonNull
public static final @NonNull int ON_UP_NEVER_TO_END

ON_UP_NEVER_TO_START

@NonNull
public static final @NonNull int ON_UP_NEVER_TO_START

ON_UP_STOP

@NonNull
public static final @NonNull int ON_UP_STOP

SIDE_BOTTOM

@NonNull
public static final @NonNull int SIDE_BOTTOM

SIDE_END

@NonNull
public static final @NonNull int SIDE_END

SIDE_LEFT

@NonNull
public static final @NonNull int SIDE_LEFT

SIDE_MIDDLE

@NonNull
public static final @NonNull int SIDE_MIDDLE

SIDE_RIGHT

@NonNull
public static final @NonNull int SIDE_RIGHT

SIDE_START

@NonNull
public static final @NonNull int SIDE_START

SIDE_TOP

@NonNull
public static final @NonNull int SIDE_TOP

SPRING_BOUNDARY_BOUNCEBOTH

@NonNull
public static final @NonNull int SPRING_BOUNDARY_BOUNCEBOTH

SPRING_BOUNDARY_BOUNCEEND

@NonNull
public static final @NonNull int SPRING_BOUNDARY_BOUNCEEND

SPRING_BOUNDARY_BOUNCESTART

@NonNull
public static final @NonNull int SPRING_BOUNDARY_BOUNCESTART

SPRING_BOUNDARY_OVERSHOOT

@NonNull
public static final @NonNull int SPRING_BOUNDARY_OVERSHOOT

Public methods

getAutoCompleteMode

@NonNull
public int getAutoCompleteMode()

getDragDirection

@NonNull
public int getDragDirection()

getDragScale

@NonNull
public float getDragScale()

getDragThreshold

@NonNull
public float getDragThreshold()

getLimitBoundsTo

@NonNull
public int getLimitBoundsTo()

getMaxAcceleration

@NonNull
public float getMaxAcceleration()

getMaxVelocity

@NonNull
public float getMaxVelocity()

getMoveWhenScrollAtTop

@NonNull
public boolean getMoveWhenScrollAtTop()

getNestedScrollFlags

@NonNull
public int getNestedScrollFlags()

getOnTouchUp

@NonNull
public int getOnTouchUp()

getRotationCenterId

@NonNull
public int getRotationCenterId()

getSpringBoundary

@NonNull
public int getSpringBoundary()

The behaviour at the boundaries 0 and 1

Returns
int

getSpringDamping

@NonNull
public float getSpringDamping()

getSpringMass

@NonNull
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

@NonNull
public float getSpringStiffness()

get the stiffness of the spring

Returns
float

NaN if not set

getSpringStopThreshold

@NonNull
public float getSpringStopThreshold()

The threshold for spring motion to stop.

Returns
float

getTouchAnchorId

@NonNull
public int getTouchAnchorId()

getTouchAnchorSide

@NonNull
public int getTouchAnchorSide()

getTouchRegionId

@NonNull
public int getTouchRegionId()

setAutoCompleteMode

@NonNull
public void setAutoCompleteMode(@NonNull int autoCompleteMode)

sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;

setDragDirection

@NonNull
public OnSwipe setDragDirection(@NonNull int dragDirection)

The direction of the drag.

Parameters
@NonNull int dragDirection
Returns
OnSwipe

setDragScale

@NonNull
public OnSwipe setDragScale(@NonNull int dragScale)

Normally 1 this can be tweaked to make the acceleration faster

Parameters
@NonNull int dragScale
Returns
OnSwipe

setDragThreshold

@NonNull
public OnSwipe setDragThreshold(@NonNull 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
@NonNull int dragThreshold
Returns
OnSwipe

setLimitBoundsTo

@NonNull
public OnSwipe setLimitBoundsTo(@NonNull int id)

Only allow touch actions to be initiated within this region

Parameters
@NonNull int id
Returns
OnSwipe

setMaxAcceleration

@NonNull
public OnSwipe setMaxAcceleration(@NonNull 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
@NonNull int maxAcceleration
Returns
OnSwipe

setMaxVelocity

@NonNull
public OnSwipe setMaxVelocity(@NonNull int maxVelocity)

The maximum velocity (Change in progress per second) animation can achive

Parameters
@NonNull int maxVelocity
Returns
OnSwipe

setMoveWhenScrollAtTop

@NonNull
public OnSwipe setMoveWhenScrollAtTop(@NonNull boolean moveWhenScrollAtTop)

When collaborating with a NestedScrollView do you progress form 0-1 only when the scroll view is at the top.

Parameters
@NonNull boolean moveWhenScrollAtTop
Returns
OnSwipe

setNestedScrollFlags

@NonNull
public OnSwipe setNestedScrollFlags(@NonNull int flags)

Various flag to control behaviours of nested scroll FLAG_DISABLE_POST_SCROLL = 1; FLAG_DISABLE_SCROLL = 2;

Parameters
@NonNull int flags
Returns
OnSwipe

setOnTouchUp

@NonNull
public OnSwipe setOnTouchUp(@NonNull 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
@NonNull int mode

default = ON_UP_AUTOCOMPLETE

Returns
OnSwipe

setRotateCenter

@NonNull
public OnSwipe setRotateCenter(@NonNull int rotationCenterId)

The view to center the rotation about

Parameters
@NonNull int rotationCenterId
Returns
OnSwipe

this

setSpringBoundary

@NonNull
public OnSwipe setSpringBoundary(@NonNull 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
@NonNull int springBoundary
Returns
OnSwipe

setSpringDamping

@NonNull
public OnSwipe setSpringDamping(@NonNull 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
@NonNull float springDamping
Returns
OnSwipe

this

setSpringMass

@NonNull
public OnSwipe setSpringMass(@NonNull 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
@NonNull float springMass
Returns
OnSwipe

this

setSpringStiffness

@NonNull
public OnSwipe setSpringStiffness(@NonNull 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
@NonNull float springStiffness
Returns
OnSwipe

setSpringStopThreshold

@NonNull
public OnSwipe setSpringStopThreshold(@NonNull 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
@NonNull float springStopThreshold
Returns
OnSwipe

setTouchAnchorId

@NonNull
public OnSwipe setTouchAnchorId(@NonNull 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
@NonNull int side
Returns
OnSwipe

setTouchAnchorSide

@NonNull
public OnSwipe setTouchAnchorSide(@NonNull 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
@NonNull int side
Returns
OnSwipe

setTouchRegionId

@NonNull
public OnSwipe setTouchRegionId(@NonNull int side)
Parameters
@NonNull int side
Returns
OnSwipe