Class OnSwipe
- java.lang.Object
-
- androidx.constraintlayout.core.dsl.OnSwipe
-
public class OnSwipe extends java.lang.ObjectCreate automatic swipe handling object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOnSwipe.Boundarystatic classOnSwipe.Dragstatic classOnSwipe.Modestatic classOnSwipe.Sidestatic classOnSwipe.TouchUp
-
Field Summary
Fields Modifier and Type Field Description static intFLAG_DISABLE_POST_SCROLLstatic intFLAG_DISABLE_SCROLL
-
Constructor Summary
Constructors Constructor Description OnSwipe()OnSwipe(java.lang.String anchor, OnSwipe.Side side, OnSwipe.Drag dragDirection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OnSwipe.ModegetAutoCompleteMode()OnSwipe.DraggetDragDirection()floatgetDragScale()floatgetDragThreshold()java.lang.StringgetLimitBoundsTo()floatgetMaxAcceleration()floatgetMaxVelocity()OnSwipe.TouchUpgetOnTouchUp()java.lang.StringgetRotationCenterId()OnSwipe.BoundarygetSpringBoundary()The behaviour at the boundaries 0 and 1floatgetSpringDamping()floatgetSpringMass()Get the mass of the spring.floatgetSpringStiffness()get the stiffness of the springfloatgetSpringStopThreshold()The threshold for spring motion to stop.java.lang.StringgetTouchAnchorId()OnSwipe.SidegetTouchAnchorSide()voidsetAutoCompleteMode(OnSwipe.Mode autoCompleteMode)sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1;OnSwipesetDragDirection(OnSwipe.Drag dragDirection)The direction of the drag.OnSwipesetDragScale(int dragScale)Normally 1 this can be tweaked to make the acceleration fasterOnSwipesetDragThreshold(int dragThreshold)This sets the threshold before the animation is kicked off.OnSwipesetLimitBoundsTo(java.lang.String id)Only allow touch actions to be initiated within this regionOnSwipesetMaxAcceleration(int maxAcceleration)The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quickerOnSwipesetMaxVelocity(int maxVelocity)The maximum velocity (Change in progress per second) animation can achieveOnSwipesetOnTouchUp(OnSwipe.TouchUp mode)Configures what happens when the user releases on mouse up.OnSwipesetRotateCenter(java.lang.String rotationCenterId)The view to center the rotation aboutOnSwipesetSpringBoundary(OnSwipe.Boundary springBoundary)The behaviour at the boundaries 0 and 1.OnSwipesetSpringDamping(float springDamping)Set the damping of the spring if using spring.OnSwipesetSpringMass(float springMass)Set the Mass of the spring if using spring.OnSwipesetSpringStiffness(float springStiffness)set the stiffness of the spring if using spring.OnSwipesetSpringStopThreshold(float springStopThreshold)set the threshold for spring motion to stop.OnSwipesetTouchAnchorId(java.lang.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 motionLayoutOnSwipesetTouchAnchorSide(OnSwipe.Side side)This side of the view that matches the drag movement.java.lang.StringtoString()
-
-
-
Field Detail
-
FLAG_DISABLE_POST_SCROLL
public static final int FLAG_DISABLE_POST_SCROLL
- See Also:
- Constant Field Values
-
FLAG_DISABLE_SCROLL
public static final int FLAG_DISABLE_SCROLL
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
OnSwipe
public OnSwipe()
-
OnSwipe
public OnSwipe(java.lang.String anchor, OnSwipe.Side side, OnSwipe.Drag dragDirection)
-
-
Method Detail
-
setTouchAnchorId
public OnSwipe setTouchAnchorId(java.lang.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
-
getTouchAnchorId
public java.lang.String getTouchAnchorId()
-
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)
-
getTouchAnchorSide
public OnSwipe.Side getTouchAnchorSide()
-
setDragDirection
public OnSwipe setDragDirection(OnSwipe.Drag dragDirection)
The direction of the drag.
-
getDragDirection
public OnSwipe.Drag getDragDirection()
-
setMaxVelocity
public OnSwipe setMaxVelocity(int maxVelocity)
The maximum velocity (Change in progress per second) animation can achieve
-
getMaxVelocity
public float getMaxVelocity()
-
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
-
getMaxAcceleration
public float getMaxAcceleration()
-
setDragScale
public OnSwipe setDragScale(int dragScale)
Normally 1 this can be tweaked to make the acceleration faster
-
getDragScale
public float getDragScale()
-
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.
-
getDragThreshold
public float getDragThreshold()
-
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:
mode- default = ON_UP_AUTOCOMPLETE
-
getOnTouchUp
public OnSwipe.TouchUp getOnTouchUp()
-
setLimitBoundsTo
public OnSwipe setLimitBoundsTo(java.lang.String id)
Only allow touch actions to be initiated within this region
-
getLimitBoundsTo
public java.lang.String getLimitBoundsTo()
-
setRotateCenter
public OnSwipe setRotateCenter(java.lang.String rotationCenterId)
The view to center the rotation about- Returns:
- this
-
getRotationCenterId
public java.lang.String getRotationCenterId()
-
getSpringDamping
public float getSpringDamping()
-
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:
- this
-
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
-
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:
- this
-
getSpringStiffness
public float getSpringStiffness()
get the stiffness of the spring- Returns:
- NaN if not set
-
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
-
getSpringStopThreshold
public float getSpringStopThreshold()
The threshold for spring motion to stop.
-
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:
springStopThreshold- when to stop.
-
getSpringBoundary
public OnSwipe.Boundary getSpringBoundary()
The behaviour at the boundaries 0 and 1
-
setSpringBoundary
public OnSwipe setSpringBoundary(OnSwipe.Boundary springBoundary)
The behaviour at the boundaries 0 and 1.- Parameters:
springBoundary- behaviour at the boundaries
-
getAutoCompleteMode
public OnSwipe.Mode getAutoCompleteMode()
-
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;
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-