DesignTool
class DesignTool
Utility class to manipulate MotionLayout from the layout editor
Summary
Public constructors |
|---|
DesignTool(motionLayout: MotionLayout!) |
Public functions |
|
|---|---|
Int |
designAccess(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 |
disableAutoTransition(disable: Boolean)this allow disabling autoTransitions to prevent design surface from being in undefined states |
Unit |
dumpConstraintSet(set: String!) |
Int |
getAnimationKeyFrames(view: Any!, key: FloatArray!)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 |
getAnimationRectangles(view: Any!, path: FloatArray!)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( |
Float |
Return the current progress of the current transition |
String! |
|
String! |
getState()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(Live setting of attributes on a view |
Unit |
setKeyFrame(view: Any!, position: Int, name: String!, value: Any!) |
Boolean |
Move the widget directly |
Unit |
setKeyframe(keyFrame: Any!, tag: String!, value: Any!) |
Unit |
This sets the constraint set based on a string. |
Unit |
setToolPosition(position: Float) |
Unit |
setTransition(start: String!, end: String!)This sets the constraint set based on a string. |
Unit |
setViewDebug(view: Any!, debugMode: Int) |
Public constructors
Public functions
designAccess
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
fun disableAutoTransition(disable: Boolean): Unit
this allow disabling autoTransitions to prevent design surface from being in undefined states
| Parameters | |
|---|---|
disable: Boolean |
getAnimationKeyFrames
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
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
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...) |
getKeyFrameInfo
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
| Returns | |
|---|---|
Int |
Number of keyFrames found |
getKeyFramePosition
fun getKeyFramePosition(view: Any!, type: Int, x: Float, y: Float): Float
| Returns | |
|---|---|
Float |
getKeyFramePositions
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
fun getKeyframe(type: Int, target: Int, position: Int): Any!
| Returns | |
|---|---|
Any! |
getKeyframeAtLocation
fun getKeyframeAtLocation(viewObject: Any!, x: Float, y: Float): Any!
| Returns | |
|---|---|
Any! |
getPositionKeyframe
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
fun getProgress(): Float
Return the current progress of the current transition
| Returns | |
|---|---|
Float |
current transition's progress |
getState
fun getState(): String!
Return the current state (ConstraintSet id) as a string
| Returns | |
|---|---|
String! |
the last state set via the design tool bridge |
getTransitionTimeMs
fun getTransitionTimeMs(): Long
Gets the time of the currently set animation.
| Returns | |
|---|---|
Long |
time in Milliseconds |
isInTransition
fun isInTransition(): Boolean
Utility method, returns true if we are currently in a transition
| Returns | |
|---|---|
Boolean |
true if in a transition, false otherwise |
setAttributes
fun setAttributes(
dpi: Int,
constraintSetId: String!,
opaqueView: Any!,
opaqueAttributes: Any!
): Unit
Live setting of attributes on a view
setKeyFrame
fun setKeyFrame(view: Any!, position: Int, name: String!, value: Any!): Unit
setKeyFramePosition
fun setKeyFramePosition(view: Any!, position: Int, type: Int, x: Float, y: Float): Boolean
Move the widget directly
| Returns | |
|---|---|
Boolean |
setState
fun setState(id: String!): Unit
This sets the constraint set based on a string. (without the "@+id/")
| Parameters | |
|---|---|
id: String! |
setToolPosition
fun setToolPosition(position: Float): Unit
| Parameters | |
|---|---|
position: Float |
setTransition
fun setTransition(start: String!, end: String!): Unit
This sets the constraint set based on a string. (without the "@+id/")