class DesignTool


Utility class to manipulate MotionLayout from the layout editor

Summary

Public constructors

DesignTool(motionLayout: MotionLayout!)

Public functions

Int
designAccess(
    cmd: Int,
    type: String!,
    viewObject: Any!,
    in: FloatArray!,
    inLength: Int,
    out: FloatArray!,
    outLength: Int
)

This is a general access to systems in the MotionLayout System This provides a series of commands used by the designer to access needed logic It is written this way to minimize the interface between the library and designer.

Unit

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

Unit
Int

Get the location of the start end and key frames

Int
getAnimationPath(view: Any!, path: FloatArray!, len: Int)

Get the center point of the animation path of a view

Unit

Get the center point of the animation path of a view

String!
Int
getKeyFrameInfo(view: Any!, type: Int, info: IntArray!)

Get the keyFrames for the view controlled by this MotionController.

Float
getKeyFramePosition(view: Any!, type: Int, x: Float, y: Float)
Int
getKeyFramePositions(view: Any!, type: IntArray!, pos: FloatArray!)

Get the keyFrames for the view controlled by this MotionController.

Any!
getKeyframe(type: Int, target: Int, position: Int)
Any!
getKeyframe(view: Any!, type: Int, position: Int)
Any!
getKeyframeAtLocation(viewObject: Any!, x: Float, y: Float)
Boolean!
getPositionKeyframe(
    keyFrame: Any!,
    view: Any!,
    x: Float,
    y: Float,
    attribute: Array<String!>!,
    value: FloatArray!
)
Float

Return the current progress of the current transition

String!
String!

Return the current state (ConstraintSet id) as a string

Long

Gets the time of the currently set animation.

Boolean

Utility method, returns true if we are currently in a transition

Unit
setAttributes(
    dpi: Int,
    constraintSetId: String!,
    opaqueView: Any!,
    opaqueAttributes: Any!
)

Live setting of attributes on a view

Unit
setKeyFrame(view: Any!, position: Int, name: String!, value: Any!)
Boolean
setKeyFramePosition(view: Any!, position: Int, type: Int, x: Float, y: Float)

Move the widget directly

Unit
setKeyframe(keyFrame: Any!, tag: String!, value: Any!)
Unit

This sets the constraint set based on a string.

Unit
Unit
setTransition(start: String!, end: String!)

This sets the constraint set based on a string.

Unit
setViewDebug(view: Any!, debugMode: Int)

Public constructors

DesignTool

Added in 2.2.0
DesignTool(motionLayout: MotionLayout!)

Public functions

designAccess

Added in 2.2.0
fun designAccess(
    cmd: Int,
    type: String!,
    viewObject: Any!,
    in: FloatArray!,
    inLength: Int,
    out: FloatArray!,
    outLength: Int
): Int

This is a general access to systems in the MotionLayout System This provides a series of commands used by the designer to access needed logic It is written this way to minimize the interface between the library and designer. It allows the logic to be kept only in the library not replicated in the gui builder. It also allows us to understand understand the version of MotionLayout in use commands 0 return the version number 1 Get the center point of the animation path of a view 2 Get the location of the start end and key frames

Parameters
cmd: Int

this provide the command needed

type: String!

support argument for command

viewObject: Any!

if this command references a view this provides access

in: FloatArray!

this allows for an array of float to be the input to the system

inLength: Int

this provides the length of the input

out: FloatArray!

this provide the output array

outLength: Int

the length of the output array

Returns
Int

command dependent -1 is typically an error (do not understand)

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

dumpConstraintSet

Added in 2.2.0
fun dumpConstraintSet(set: String!): Unit
Parameters
set: String!

getAnimationKeyFrames

Added in 2.2.0
fun getAnimationKeyFrames(view: Any!, key: FloatArray!): Int

Get the location of the start end and key frames

Parameters
view: Any!

the view to track

key: FloatArray!

array to be filled

Returns
Int

number of key frames + 2

getAnimationPath

Added in 2.2.0
fun getAnimationPath(view: Any!, path: FloatArray!, len: Int): Int

Get the center point of the animation path of a view

Parameters
view: Any!

view to getMap the animation of

path: FloatArray!

array to be filled (x1,y1,x2,y2...)

Returns
Int

-1 if not under and animation 0 if not animated or number of point along animation

getAnimationRectangles

Added in 2.2.0
fun getAnimationRectangles(view: Any!, path: FloatArray!): Unit

Get the center point of the animation path of a view

Parameters
view: Any!

view to getMap the animation of

path: FloatArray!

array to be filled (in groups of 8) (x1,y1,x2,y2...)

getEndState

Added in 2.2.0
fun getEndState(): String!
Returns
String!

getKeyFrameInfo

Added in 2.2.0
fun getKeyFrameInfo(view: Any!, type: Int, info: IntArray!): Int

Get the keyFrames for the view controlled by this MotionController. The call is designed to be efficient because it will be called 30x Number of views a second

Parameters
view: Any!

the view to return keyframe positions

info: IntArray!
Returns
Int

Number of keyFrames found

getKeyFramePosition

Added in 2.2.0
fun getKeyFramePosition(view: Any!, type: Int, x: Float, y: Float): Float
Parameters
view: Any!
type: Int
x: Float
y: Float
Returns
Float

getKeyFramePositions

Added in 2.2.0
fun getKeyFramePositions(view: Any!, type: IntArray!, pos: FloatArray!): Int

Get the keyFrames for the view controlled by this MotionController. The call is designed to be efficient because it will be called 30x Number of views a second

Parameters
view: Any!

the view to return keyframe positions

type: IntArray!

is pos(0-100) + 1000*mType(1=Attrib, 2=Position, 3=TimeCycle 4=Cycle 5=Trigger

pos: FloatArray!

the x&y position of the keyFrame along the path

Returns
Int

Number of keyFrames found

getKeyframe

Added in 2.2.0
fun getKeyframe(type: Int, target: Int, position: Int): Any!
Parameters
type: Int
target: Int
position: Int
Returns
Any!

getKeyframe

Added in 2.2.0
fun getKeyframe(view: Any!, type: Int, position: Int): Any!
Parameters
view: Any!
type: Int
position: Int
Returns
Any!

getKeyframeAtLocation

Added in 2.2.0
fun getKeyframeAtLocation(viewObject: Any!, x: Float, y: Float): Any!
Parameters
viewObject: Any!
x: Float
y: Float
Returns
Any!

getPositionKeyframe

Added in 2.2.0
fun getPositionKeyframe(
    keyFrame: Any!,
    view: Any!,
    x: Float,
    y: Float,
    attribute: Array<String!>!,
    value: FloatArray!
): Boolean!
Parameters
keyFrame: Any!
view: Any!
x: Float
y: Float
attribute: Array<String!>!
value: FloatArray!
Returns
Boolean!

getProgress

Added in 2.2.0
fun getProgress(): Float

Return the current progress of the current transition

Returns
Float

current transition's progress

getStartState

Added in 2.2.0
fun getStartState(): String!
Returns
String!

getState

Added in 2.2.0
fun getState(): String!

Return the current state (ConstraintSet id) as a string

Returns
String!

the last state set via the design tool bridge

getTransitionTimeMs

Added in 2.2.0
fun getTransitionTimeMs(): Long

Gets the time of the currently set animation.

Returns
Long

time in Milliseconds

isInTransition

Added in 2.2.0
fun isInTransition(): Boolean

Utility method, returns true if we are currently in a transition

Returns
Boolean

true if in a transition, false otherwise

setAttributes

Added in 2.2.0
fun setAttributes(
    dpi: Int,
    constraintSetId: String!,
    opaqueView: Any!,
    opaqueAttributes: Any!
): Unit

Live setting of attributes on a view

Parameters
dpi: Int

dpi used by the application

constraintSetId: String!

ConstraintSet id

opaqueView: Any!

the Android View we operate on, passed as an Object

opaqueAttributes: Any!

the list of attributes (hash) we pass to the view

setKeyFrame

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

setKeyFramePosition

Added in 2.2.0
fun setKeyFramePosition(view: Any!, position: Int, type: Int, x: Float, y: Float): Boolean

Move the widget directly

Parameters
view: Any!
position: Int
type: Int
x: Float
y: Float
Returns
Boolean

setKeyframe

Added in 2.2.0
fun setKeyframe(keyFrame: Any!, tag: String!, value: Any!): Unit
Parameters
keyFrame: Any!
tag: String!
value: Any!

setState

Added in 2.2.0
fun setState(id: String!): Unit

This sets the constraint set based on a string. (without the "@+id/")

Parameters
id: String!

setToolPosition

Added in 2.2.0
fun setToolPosition(position: Float): Unit
Parameters
position: Float

setTransition

Added in 2.2.0
fun setTransition(start: String!, end: String!): Unit

This sets the constraint set based on a string. (without the "@+id/")

Parameters
start: String!
end: String!

setViewDebug

Added in 2.2.0
fun setViewDebug(view: Any!, debugMode: Int): Unit
Parameters
view: Any!
debugMode: Int