The information to transition between multiple ConstraintSets
This Class is meant to be used from XML
Nested classes |
class |
MotionScene.Transition
Transition defines the interaction from one state to another.
|
Public methods |
void
|
addOnClickListeners(MotionLayout motionLayout, int currentState)
|
void
|
addTransition(MotionScene.Transition transition)
Add a transition to the motion scene.
|
boolean
|
applyViewTransition(int viewTransitionId, MotionController motionController)
|
MotionScene.Transition
|
bestTransitionFor(int currentState, float dx, float dy, MotionEvent lastTouchDown)
|
void
|
disableAutoTransition(boolean disable)
this allow disabling autoTransitions to prevent design surface from being in undefined states
|
void
|
enableViewTransition(int id, boolean enable)
|
int
|
gatPathMotionArc()
|
ConstraintSet
|
getConstraintSet(Context context, String id)
|
int[]
|
getConstraintSetIds()
|
ArrayList<MotionScene.Transition>
|
getDefinedTransitions()
|
int
|
getDuration()
Get Duration of the current transition.
|
Interpolator
|
getInterpolator()
|
void
|
getKeyFrames(MotionController motionController)
provides the key frames & CycleFrames to the motion view to
|
float
|
getPathPercent(View view, int position)
|
float
|
getStaggered()
Get the staggered value of the current transition.
|
MotionScene.Transition
|
getTransitionById(int id)
|
List<MotionScene.Transition>
|
getTransitionsWithState(int stateId)
|
boolean
|
isViewTransitionEnabled(int id)
|
int
|
lookUpConstraintId(String id)
Used at design time
|
String
|
lookUpConstraintName(int id)
used at design time
|
void
|
removeTransition(MotionScene.Transition transition)
Remove the transition with the matching id from the motion scene.
|
void
|
setConstraintSet(int id, ConstraintSet set)
Maps the Constraint set to the id.
|
void
|
setDuration(int duration)
Sets the duration of the current transition or the default if there is no current transition
|
void
|
setKeyframe(View view, int position, String name, Object value)
|
void
|
setRtl(boolean rtl)
|
void
|
setTransition(MotionScene.Transition transition)
Set the transition to be the current transition of the motion scene.
|
static
String
|
stripID(String id)
|
boolean
|
validateLayout(MotionLayout layout)
|
void
|
viewTransition(int id, View... view)
|
Protected methods |
void
|
onLayout(boolean changed, int left, int top, int right, int bottom)
|
Inherited methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
Constants
LAYOUT_CALL_MEASURE
public static final int LAYOUT_CALL_MEASURE
Constant Value:
2
(0x00000002)
LAYOUT_HONOR_REQUEST
public static final int LAYOUT_HONOR_REQUEST
Constant Value:
1
(0x00000001)
LAYOUT_IGNORE_REQUEST
public static final int LAYOUT_IGNORE_REQUEST
Constant Value:
0
(0x00000000)
UNSET
public static final int UNSET
Constant Value:
-1
(0xffffffff)
Public constructors
public MotionScene (MotionLayout layout)
Create a motion scene.
Parameters |
layout |
MotionLayout : Motion layout to which the scene will be set.
|
Public methods
public void addOnClickListeners (MotionLayout motionLayout,
int currentState)
Parameters |
motionLayout |
MotionLayout |
currentState |
int |
public void addTransition (MotionScene.Transition transition)
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.
Parameters |
transition |
MotionScene.Transition |
Throws |
IllegalArgumentException |
if the transition does not have an id.
|
public boolean applyViewTransition (int viewTransitionId,
MotionController motionController)
Parameters |
viewTransitionId |
int |
motionController |
MotionController |
bestTransitionFor
public MotionScene.Transition bestTransitionFor (int currentState,
float dx,
float dy,
MotionEvent lastTouchDown)
Parameters |
currentState |
int |
dx |
float |
dy |
float |
lastTouchDown |
MotionEvent |
disableAutoTransition
public void disableAutoTransition (boolean disable)
this allow disabling autoTransitions to prevent design surface from being in undefined states
enableViewTransition
public void enableViewTransition (int id,
boolean enable)
Parameters |
id |
int |
enable |
boolean |
gatPathMotionArc
public int gatPathMotionArc ()
getConstraintSet
public ConstraintSet getConstraintSet (Context context,
String id)
Parameters |
context |
Context |
id |
String |
getConstraintSetIds
public int[] getConstraintSetIds ()
getDuration
public int getDuration ()
Get Duration of the current transition.
Returns |
int |
duration in milliseconds
|
public void getKeyFrames (MotionController motionController)
provides the key frames & CycleFrames to the motion view to
getPathPercent
public float getPathPercent (View view,
int position)
Parameters |
view |
View |
position |
int |
getStaggered
public float getStaggered ()
Get the staggered value of the current transition.
Will default to 0 staggered if there is no current transition.
isViewTransitionEnabled
public boolean isViewTransitionEnabled (int id)
lookUpConstraintId
public int lookUpConstraintId (String id)
Used at design time
lookUpConstraintName
public String lookUpConstraintName (int id)
used at design time
public void removeTransition (MotionScene.Transition transition)
Remove the transition with the matching id from the motion scene. If no matching transition
is found, it does nothing.
Parameters |
transition |
MotionScene.Transition |
Throws |
IllegalArgumentException |
if the transition does not have an id.
|
public void setConstraintSet (int id,
ConstraintSet set)
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
public void setDuration (int duration)
Sets the duration of the current transition or the default if there is no current transition
Parameters |
duration |
int : in milliseconds
|
setKeyframe
public void setKeyframe (View view,
int position,
String name,
Object value)
Parameters |
view |
View |
position |
int |
name |
String |
value |
Object |
setRtl
public void setRtl (boolean rtl)
public void setTransition (MotionScene.Transition transition)
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(Transition) )
|
stripID
public static String stripID (String id)
public boolean validateLayout (MotionLayout layout)
Parameters |
layout |
MotionLayout |
Returns |
boolean |
true if the layout is valid for the scene. False otherwise. Use it for the debugging
purposes.
|
viewTransition
public void viewTransition (int id,
View... view)
Parameters |
id |
int |
view |
View |
Protected methods
onLayout
protected void onLayout (boolean changed,
int left,
int top,
int right,
int bottom)
Parameters |
changed |
boolean |
left |
int |
top |
int |
right |
int |
bottom |
int |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2022-01-24 UTC.
[]
[]