class MotionScene


The information to transition between multiple ConstraintSets This Class is meant to be used from XML

Summary

Nested types

Transition defines the interaction from one state to another.

Constants

const Int
const Int
const Int
const Int
UNSET = -1

Public constructors

Create a motion scene.

Public functions

Unit
addOnClickListeners(motionLayout: MotionLayout!, currentState: Int)

Add all on click listeners for the current state

Unit

Add a transition to the motion scene.

Boolean
applyViewTransition(
    viewTransitionId: Int,
    motionController: MotionController!
)

Apply a view transition to the MotionController

MotionScene.Transition!
bestTransitionFor(
    currentState: Int,
    dx: Float,
    dy: Float,
    lastTouchDown: MotionEvent!
)

Find the best transition for the motion

Unit

this allow disabling autoTransitions to prevent design surface from being in undefined states

Unit

Enable this viewTransition

Int

The transition arc path mode

ConstraintSet!
getConstraintSet(context: Context!, id: String!)

Get the constraintSet given the id

IntArray<Int>!

Get the list of all Constraint Sets Know to the system

ArrayList<MotionScene.Transition!>!

Get list of Transitions know to the system

Int

Get Duration of the current transition.

Interpolator!

Get the interpolator define for the current Transition

Unit
getKeyFrames(motionController: MotionController!)

provides the key frames &CycleFrames to the motion view to

IntArray<Int>!

Get the id's of all constraintSets with the matching types

Float
getPathPercent(view: View!, position: Int)

Get the path percent (Non functional currently)

Float

Get the staggered value of the current transition.

MotionScene.Transition!

Find the transition based on the id

(Mutable)List<MotionScene.Transition!>!

Get all transitions that include this state

Boolean

Is this view transition enabled

Int

Used at design time

String!

used at design time

Unit

Remove the transition with the matching id from the motion scene.

Unit

Maps the Constraint set to the id.

Unit
setDuration(duration: Int)

Sets the duration of the current transition or the default if there is no current transition

Unit
setKeyframe(view: View!, position: Int, name: String!, value: Any!)

Set a keyFrame on the current Transition

Unit

Set Right to left

Unit

Set the transition to be the current transition of the motion scene.

java-static String!

Utility to strip the @id/ from an id

Boolean
Unit
viewTransition(id: Int, view: Array<View!>!)

Apply the viewTransition on the list of views

Protected functions

Unit
onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int)

Constants

LAYOUT_CALL_MEASURE

Added in 2.2.0
const val LAYOUT_CALL_MEASURE = 2: Int

LAYOUT_HONOR_REQUEST

Added in 2.2.0
const val LAYOUT_HONOR_REQUEST = 1: Int

LAYOUT_IGNORE_REQUEST

Added in 2.2.0
const val LAYOUT_IGNORE_REQUEST = 0: Int

UNSET

Added in 2.2.0
const val UNSET = -1: Int

Public constructors

MotionScene

Added in 2.2.0
MotionScene(layout: MotionLayout!)

Create a motion scene.

Parameters
layout: MotionLayout!

Motion layout to which the scene will be set.

Public functions

addOnClickListeners

Added in 2.2.0
fun addOnClickListeners(motionLayout: MotionLayout!, currentState: Int): Unit

Add all on click listeners for the current state

Parameters
motionLayout: MotionLayout!
currentState: Int

addTransition

Added in 2.2.0
fun addTransition(transition: MotionScene.Transition!): Unit

Add a transition to the motion scene. If a transition with the same id already exists in the scene, the new transition will replace the existing one.

Throws
java.lang.IllegalArgumentException

if the transition does not have an id.

applyViewTransition

Added in 2.2.0
fun applyViewTransition(
    viewTransitionId: Int,
    motionController: MotionController!
): Boolean

Apply a view transition to the MotionController

Parameters
viewTransitionId: Int

of viewTransition

motionController: MotionController!
Returns
Boolean

bestTransitionFor

Added in 2.2.0
fun bestTransitionFor(
    currentState: Int,
    dx: Float,
    dy: Float,
    lastTouchDown: MotionEvent!
): MotionScene.Transition!

Find the best transition for the motion

Parameters
currentState: Int
dx: Float

drag delta x

dy: Float

drag delta y

lastTouchDown: MotionEvent!

disableAutoTransition

Added in 2.2.0
fun disableAutoTransition(disable: Boolean): Unit

this allow disabling autoTransitions to prevent design surface from being in undefined states

Parameters
disable: Boolean

enableViewTransition

Added in 2.2.0
fun enableViewTransition(id: Int, enable: Boolean): Unit

Enable this viewTransition

Parameters
id: Int

of viewTransition

enable: Boolean

gatPathMotionArc

Added in 2.2.0
fun gatPathMotionArc(): Int

The transition arc path mode

Returns
Int

getConstraintSet

Added in 2.2.0
fun getConstraintSet(context: Context!, id: String!): ConstraintSet!

Get the constraintSet given the id

Parameters
context: Context!
id: String!
Returns
ConstraintSet!

getConstraintSetIds

Added in 2.2.0
fun getConstraintSetIds(): IntArray<Int>!

Get the list of all Constraint Sets Know to the system

Returns
IntArray<Int>!

getDefinedTransitions

Added in 2.2.0
fun getDefinedTransitions(): ArrayList<MotionScene.Transition!>!

Get list of Transitions know to the system

getDuration

Added in 2.2.0
fun getDuration(): Int

Get Duration of the current transition.

Returns
Int

duration in milliseconds

getInterpolator

Added in 2.2.0
fun getInterpolator(): Interpolator!

Get the interpolator define for the current Transition

Returns
Interpolator!

getKeyFrames

Added in 2.2.0
fun getKeyFrames(motionController: MotionController!): Unit

provides the key frames &CycleFrames to the motion view to

Parameters
motionController: MotionController!

getMatchingStateLabels

fun getMatchingStateLabels(types: Array<String!>!): IntArray<Int>!

Get the id's of all constraintSets with the matching types

Returns
IntArray<Int>!

getPathPercent

Added in 2.2.0
fun getPathPercent(view: View!, position: Int): Float

Get the path percent (Non functional currently)

Parameters
view: View!
position: Int
Returns
Float

getStaggered

Added in 2.2.0
fun getStaggered(): Float

Get the staggered value of the current transition. Will default to 0 staggered if there is no current transition.

Returns
Float

getTransitionById

Added in 2.2.0
fun getTransitionById(id: Int): MotionScene.Transition!

Find the transition based on the id

Parameters
id: Int

getTransitionsWithState

Added in 2.2.0
fun getTransitionsWithState(stateId: Int): (Mutable)List<MotionScene.Transition!>!

Get all transitions that include this state

Parameters
stateId: Int

isViewTransitionEnabled

Added in 2.2.0
fun isViewTransitionEnabled(id: Int): Boolean

Is this view transition enabled

Parameters
id: Int

of viewTransition

Returns
Boolean

lookUpConstraintId

Added in 2.2.0
fun lookUpConstraintId(id: String!): Int

Used at design time

Parameters
id: String!
Returns
Int

lookUpConstraintName

Added in 2.2.0
fun lookUpConstraintName(id: Int): String!

used at design time

Returns
String!

removeTransition

Added in 2.2.0
fun removeTransition(transition: MotionScene.Transition!): Unit

Remove the transition with the matching id from the motion scene. If no matching transition is found, it does nothing.

Throws
java.lang.IllegalArgumentException

if the transition does not have an id.

setConstraintSet

Added in 2.2.0
fun setConstraintSet(id: Int, set: ConstraintSet!): Unit

Maps the Constraint set to the id.

Parameters
id: Int

- unique id to represent the ConstraintSet

set: ConstraintSet!

- ConstraintSet to be represented with the id.

setDuration

Added in 2.2.0
fun setDuration(duration: Int): Unit

Sets the duration of the current transition or the default if there is no current transition

Parameters
duration: Int

in milliseconds

setKeyframe

Added in 2.2.0
fun setKeyframe(view: View!, position: Int, name: String!, value: Any!): Unit

Set a keyFrame on the current Transition

Parameters
view: View!
position: Int
name: String!
value: Any!

setRtl

Added in 2.2.0
fun setRtl(rtl: Boolean): Unit

Set Right to left

Parameters
rtl: Boolean

setTransition

Added in 2.2.0
fun setTransition(transition: MotionScene.Transition!): Unit

Set the transition to be the current transition of the motion scene.

Parameters
transition: MotionScene.Transition!

a transition to be set. The transition must exist within the motion scene. (e.g. addTransition)

stripID

Added in 2.2.0
java-static fun stripID(id: String!): String!

Utility to strip the @id/ from an id

Parameters
id: String!
Returns
String!

validateLayout

Added in 2.2.0
fun validateLayout(layout: MotionLayout!): Boolean
Returns
Boolean

true if the layout is valid for the scene. False otherwise. Use it for the debugging purposes.

viewTransition

fun viewTransition(id: Int, view: Array<View!>!): Unit

Apply the viewTransition on the list of views

Parameters
id: Int
view: Array<View!>!

Protected functions

onLayout

Added in 2.2.0
protected fun onLayout(changed: Boolean, left: Int, top: Int, right: Int, bottom: Int): Unit