DesignTool
public class DesignTool
Utility class to manipulate MotionLayout from the layout editor
Summary
Public constructors |
|---|
DesignTool(MotionLayout motionLayout) |
Public methods |
|
|---|---|
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. |
void |
disableAutoTransition(boolean disable)this allow disabling autoTransitions to prevent design surface from being in undefined states |
void |
dumpConstraintSet(String set) |
int |
getAnimationKeyFrames(Object view, float[] key)Get the location of the start end and key frames |
int |
getAnimationPath(Object view, float[] path, int len)Get the center point of the animation path of a view |
void |
getAnimationRectangles(Object view, float[] path)Get the center point of the animation path of a view |
String |
|
int |
getKeyFrameInfo(Object view, int type, int[] info)Get the keyFrames for the view controlled by this MotionController. |
float |
getKeyFramePosition(Object view, int type, float x, float y) |
int |
getKeyFramePositions(Object view, int[] type, float[] pos)Get the keyFrames for the view controlled by this MotionController. |
Object |
getKeyframe(int type, int target, int position) |
Object |
getKeyframe(Object view, int type, int position) |
Object |
getKeyframeAtLocation(Object viewObject, float x, float y) |
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 |
void |
setAttributes(Live setting of attributes on a view |
void |
setKeyFrame(Object view, int position, String name, Object value) |
boolean |
setKeyFramePosition(Object view, int position, int type, float x, float y)Move the widget directly |
void |
setKeyframe(Object keyFrame, String tag, Object value) |
void |
This sets the constraint set based on a string. |
void |
setToolPosition(float position) |
void |
setTransition(String start, String end)This sets the constraint set based on a string. |
void |
setViewDebug(Object view, int debugMode) |
Public constructors
Public methods
designAccess
public int designAccess(
int cmd,
String type,
Object viewObject,
float[] in,
int inLength,
float[] out,
int outLength
)
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 | |
|---|---|
int cmd |
this provide the command needed |
String type |
support argument for command |
Object viewObject |
if this command references a view this provides access |
float[] in |
this allows for an array of float to be the input to the system |
int inLength |
this provides the length of the input |
float[] out |
this provide the output array |
int outLength |
the length of the output array |
| Returns | |
|---|---|
int |
command dependent -1 is typically an error (do not understand) |
disableAutoTransition
public void disableAutoTransition(boolean disable)
this allow disabling autoTransitions to prevent design surface from being in undefined states
| Parameters | |
|---|---|
boolean disable |
getAnimationKeyFrames
public int getAnimationKeyFrames(Object view, float[] key)
Get the location of the start end and key frames
| Parameters | |
|---|---|
Object view |
the view to track |
float[] key |
array to be filled |
| Returns | |
|---|---|
int |
number of key frames + 2 |
getAnimationPath
public int getAnimationPath(Object view, float[] path, int len)
Get the center point of the animation path of a view
| Parameters | |
|---|---|
Object view |
view to getMap the animation of |
float[] path |
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
public void getAnimationRectangles(Object view, float[] path)
Get the center point of the animation path of a view
| Parameters | |
|---|---|
Object view |
view to getMap the animation of |
float[] path |
array to be filled (in groups of 8) (x1,y1,x2,y2...) |
getKeyFrameInfo
public int getKeyFrameInfo(Object view, int type, int[] info)
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 | |
|---|---|
Object view |
the view to return keyframe positions |
int[] info |
| Returns | |
|---|---|
int |
Number of keyFrames found |
getKeyFramePosition
public float getKeyFramePosition(Object view, int type, float x, float y)
| Parameters | |
|---|---|
Object view |
|
int type |
|
float x |
|
float y |
| Returns | |
|---|---|
float |
getKeyFramePositions
public int getKeyFramePositions(Object view, int[] type, float[] pos)
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 | |
|---|---|
Object view |
the view to return keyframe positions |
int[] type |
is pos(0-100) + 1000*mType(1=Attrib, 2=Position, 3=TimeCycle 4=Cycle 5=Trigger |
float[] pos |
the x&y position of the keyFrame along the path |
| Returns | |
|---|---|
int |
Number of keyFrames found |
getKeyframe
public Object getKeyframe(int type, int target, int position)
| Parameters | |
|---|---|
int type |
|
int target |
|
int position |
| Returns | |
|---|---|
Object |
getKeyframe
public Object getKeyframe(Object view, int type, int position)
| Parameters | |
|---|---|
Object view |
|
int type |
|
int position |
| Returns | |
|---|---|
Object |
getKeyframeAtLocation
public Object getKeyframeAtLocation(Object viewObject, float x, float y)
| Parameters | |
|---|---|
Object viewObject |
|
float x |
|
float y |
| Returns | |
|---|---|
Object |
getPositionKeyframe
public Boolean getPositionKeyframe(
Object keyFrame,
Object view,
float x,
float y,
String[] attribute,
float[] value
)
| Returns | |
|---|---|
Boolean |
getProgress
public float getProgress()
Return the current progress of the current transition
| Returns | |
|---|---|
float |
current transition's progress |
getState
public String getState()
Return the current state (ConstraintSet id) as a string
| Returns | |
|---|---|
String |
the last state set via the design tool bridge |
getTransitionTimeMs
public long getTransitionTimeMs()
Gets the time of the currently set animation.
| Returns | |
|---|---|
long |
time in Milliseconds |
isInTransition
public boolean isInTransition()
Utility method, returns true if we are currently in a transition
| Returns | |
|---|---|
boolean |
true if in a transition, false otherwise |
setAttributes
public void setAttributes(
int dpi,
String constraintSetId,
Object opaqueView,
Object opaqueAttributes
)
Live setting of attributes on a view
setKeyFrame
public void setKeyFrame(Object view, int position, String name, Object value)
setKeyFramePosition
public boolean setKeyFramePosition(Object view, int position, int type, float x, float y)
Move the widget directly
| Parameters | |
|---|---|
Object view |
|
int position |
|
int type |
|
float x |
|
float y |
| Returns | |
|---|---|
boolean |
setState
public void setState(String id)
This sets the constraint set based on a string. (without the "@+id/")
| Parameters | |
|---|---|
String id |
setToolPosition
public void setToolPosition(float position)
| Parameters | |
|---|---|
float position |
setTransition
public void setTransition(String start, String end)
This sets the constraint set based on a string. (without the "@+id/")
setViewDebug
public void setViewDebug(Object view, int debugMode)
| Parameters | |
|---|---|
Object view |
|
int debugMode |