# OnSwipe

Artifact: [androidx.constraintlayout:constraintlayout-core](https://developer.android.com/jetpack/androidx/releases/constraintlayout) [View Source](https://cs.android.com/search?q=file:androidx/constraintlayout/core/dsl/OnSwipe.java+class:androidx.constraintlayout.core.dsl.OnSwipe) Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

*** ** * ** ***


```
class OnSwipe
```

<br />

*** ** * ** ***

Create automatic swipe handling object

## Summary

| ### Nested types |
|---|
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Boundary` |
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Drag` |
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Mode` |
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Side` |
| `enum https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.TouchUp` |

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#FLAG_DISABLE_POST_SCROLL() = 1` |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#FLAG_DISABLE_SCROLL() = 2` |

| ### Public constructors |
|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#OnSwipe()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#OnSwipe(java.lang.String,androidx.constraintlayout.core.dsl.OnSwipe.Side,androidx.constraintlayout.core.dsl.OnSwipe.Drag)(anchor: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!, side: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Side!, dragDirection: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Drag!)` |

| ### Public functions |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Mode!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getAutoCompleteMode()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Drag!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getDragDirection()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getDragScale()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getDragThreshold()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getLimitBoundsTo()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getMaxAcceleration()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getMaxVelocity()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.TouchUp!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getOnTouchUp()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getRotationCenterId()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Boundary!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getSpringBoundary()()` The behaviour at the boundaries 0 and 1 |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getSpringDamping()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getSpringMass()()` Get the mass of the spring. the m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getSpringStiffness()()` get the stiffness of the spring |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getSpringStopThreshold()()` The threshold for spring motion to stop. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getTouchAnchorId()()` |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Side!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#getTouchAnchorSide()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setAutoCompleteMode(androidx.constraintlayout.core.dsl.OnSwipe.Mode)(autoCompleteMode: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Mode!)` sets the behaviour at the boundaries 0 and 1 COMPLETE_MODE_CONTINUOUS_VELOCITY = 0; COMPLETE_MODE_SPRING = 1; |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setDragDirection(androidx.constraintlayout.core.dsl.OnSwipe.Drag)(dragDirection: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Drag!)` The direction of the drag. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setDragScale(int)(dragScale: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Normally 1 this can be tweaked to make the acceleration faster |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setDragThreshold(int)(dragThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` This sets the threshold before the animation is kicked off. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setLimitBoundsTo(java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Only allow touch actions to be initiated within this region |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setMaxAcceleration(int)(maxAcceleration: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setMaxVelocity(int)(maxVelocity: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` The maximum velocity (Change in progress per second) animation can achieve |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setOnTouchUp(androidx.constraintlayout.core.dsl.OnSwipe.TouchUp)(mode: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.TouchUp!)` Configures what happens when the user releases on mouse up. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setRotateCenter(java.lang.String)(rotationCenterId: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` The view to center the rotation about |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setSpringBoundary(androidx.constraintlayout.core.dsl.OnSwipe.Boundary)(springBoundary: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Boundary!)` The behaviour at the boundaries 0 and 1. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setSpringDamping(float)(springDamping: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the damping of the spring if using spring. c in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setSpringMass(float)(springMass: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Set the Mass of the spring if using spring. m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setSpringStiffness(float)(springStiffness: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` set the stiffness of the spring if using spring. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setSpringStopThreshold(float)(springStopThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` set the threshold for spring motion to stop. |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setTouchAnchorId(java.lang.String)(id: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` 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 |
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#setTouchAnchorSide(androidx.constraintlayout.core.dsl.OnSwipe.Side)(side: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Side!)` This side of the view that matches the drag movement. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe#toString()()` |

## Constants

### FLAG_DISABLE_POST_SCROLL

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
const val FLAG_DISABLE_POST_SCROLL = 1: Int
```

### FLAG_DISABLE_SCROLL

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
const val FLAG_DISABLE_SCROLL = 2: Int
```

## Public constructors

### OnSwipe

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
OnSwipe()
```

### OnSwipe

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
OnSwipe(anchor: String!, side: OnSwipe.Side!, dragDirection: OnSwipe.Drag!)
```

## Public functions

### getAutoCompleteMode

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getAutoCompleteMode(): OnSwipe.Mode!
```

### getDragDirection

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getDragDirection(): OnSwipe.Drag!
```

### getDragScale

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getDragScale(): Float
```

### getDragThreshold

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getDragThreshold(): Float
```

### getLimitBoundsTo

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getLimitBoundsTo(): String!
```

### getMaxAcceleration

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getMaxAcceleration(): Float
```

### getMaxVelocity

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getMaxVelocity(): Float
```

### getOnTouchUp

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getOnTouchUp(): OnSwipe.TouchUp!
```

### getRotationCenterId

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getRotationCenterId(): String!
```

### getSpringBoundary

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getSpringBoundary(): OnSwipe.Boundary!
```

The behaviour at the boundaries 0 and 1

### getSpringDamping

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getSpringDamping(): Float
```

### getSpringMass

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getSpringMass(): Float
```

Get the mass of the spring. the m in "a = (-k\*x-c\*v)/m" equation for the acceleration of a spring

### getSpringStiffness

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getSpringStiffness(): Float
```

get the stiffness of the spring

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | NaN if not set |

### getSpringStopThreshold

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getSpringStopThreshold(): Float
```

The threshold for spring motion to stop.

### getTouchAnchorId

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getTouchAnchorId(): String!
```

### getTouchAnchorSide

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun getTouchAnchorSide(): OnSwipe.Side!
```

### setAutoCompleteMode

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setAutoCompleteMode(autoCompleteMode: OnSwipe.Mode!): Unit
```

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

### setDragDirection

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setDragDirection(dragDirection: OnSwipe.Drag!): OnSwipe!
```

The direction of the drag.

### setDragScale

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setDragScale(dragScale: Int): OnSwipe!
```

Normally 1 this can be tweaked to make the acceleration faster

### setDragThreshold

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setDragThreshold(dragThreshold: Int): OnSwipe!
```

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

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setLimitBoundsTo(id: String!): OnSwipe!
```

Only allow touch actions to be initiated within this region

### setMaxAcceleration

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setMaxAcceleration(maxAcceleration: Int): OnSwipe!
```

The maximum acceleration and deceleration of the animation (Change in Change in progress per second) Faster makes the object seem lighter and quicker

### setMaxVelocity

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setMaxVelocity(maxVelocity: Int): OnSwipe!
```

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

### setOnTouchUp

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setOnTouchUp(mode: OnSwipe.TouchUp!): OnSwipe!
```

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: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.TouchUp!` | default = ON_UP_AUTOCOMPLETE |

### setRotateCenter

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setRotateCenter(rotationCenterId: String!): OnSwipe!
```

The view to center the rotation about

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | this |

### setSpringBoundary

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpringBoundary(springBoundary: OnSwipe.Boundary!): OnSwipe!
```

The behaviour at the boundaries 0 and 1.

| Parameters |
|---|---|
| `springBoundary: https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe.Boundary!` | behaviour at the boundaries |

### setSpringDamping

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpringDamping(springDamping: Float): OnSwipe!
```

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 |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | this |

### setSpringMass

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpringMass(springMass: Float): OnSwipe!
```

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 |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/constraintlayout/core/dsl/OnSwipe!` | this |

### setSpringStiffness

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpringStiffness(springStiffness: Float): OnSwipe!
```

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

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setSpringStopThreshold(springStopThreshold: Float): OnSwipe!
```

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: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | when to stop. |

### setTouchAnchorId

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setTouchAnchorId(id: String!): 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

### setTouchAnchorSide

Added in [1.1.2](https://developer.android.com/jetpack/androidx/releases/constraintlayout#1.1.2)

```
fun setTouchAnchorSide(side: OnSwipe.Side!): OnSwipe!
```

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)

### toString

```
fun toString(): String!
```