TransitionSeekController
interface TransitionSeekController
Returned from controlDelayedTransition to allow manually controlling the animations within a Transition using setCurrentPlayTimeMillis. The transition will be ready to seek when isReady is true.
Summary
Public functions |
|
|---|---|
Unit |
addOnProgressChangedListener(Add a listener for whenever the progress of the transition is changed. |
Unit |
addOnReadyListener(onReadyListener: Consumer<TransitionSeekController!>)Adds a listener to know when |
Unit |
Runs the animation forwards toward the end. |
Unit |
animateToStart(resetToStartState: Runnable)Runs the animation backwards toward the start. |
@FloatRange(from = 0.0, to = 1.0) Float |
|
@IntRange(from = 0) Long |
|
@IntRange(from = 0) Long |
|
Boolean |
isReady()Returns |
Unit |
removeOnProgressChangedListener(Remove a listener previously added in |
Unit |
removeOnReadyListener(Removes |
Unit |
setCurrentFraction(fraction: @FloatRange(from = 0.0, to = 1.0) Float)Sets the position of the Transition's animation. |
Unit |
setCurrentPlayTimeMillis(playTimeMillis: @IntRange(from = 0) Long)Sets the position of the Transition's animation. |
Public functions
addOnProgressChangedListener
fun addOnProgressChangedListener(
consumer: Consumer<TransitionSeekController!>
): Unit
Add a listener for whenever the progress of the transition is changed. This will be called when setCurrentPlayTimeMillis or setCurrentFraction are called as well as when the animation from animateToEnd or animateToStart changes the progress.
| Parameters | |
|---|---|
consumer: Consumer<TransitionSeekController!> |
A method that accepts this TransitionSeekController. |
addOnReadyListener
fun addOnReadyListener(onReadyListener: Consumer<TransitionSeekController!>): Unit
Adds a listener to know when isReady is true. The listener will be removed once notified as isReady can only be made true once. If isReady is already true, then it will be notified immediately.
| Parameters | |
|---|---|
onReadyListener: Consumer<TransitionSeekController!> |
The listener to be notified when the Transition is ready. |
animateToEnd
fun animateToEnd(): Unit
Runs the animation forwards toward the end. setCurrentPlayTimeMillis will not be allowed after executing this. When the animation completes, onTransitionEnd will be called with the isReverse parameter false. After the Transition ends, the state will reach the final state set after controlDelayedTransition. After calling this, setCurrentPlayTimeMillis may not be called.
animateToStart
fun animateToStart(resetToStartState: Runnable): Unit
Runs the animation backwards toward the start. setCurrentPlayTimeMillis will not be allowed after executing this. When the animation completes, resetToStart will be executed to set the state back to the starting state and onTransitionEnd will be called with the isReverse parameter true. If resetToStartState does not properly set the state back to starting state, onTransitionEnd will still be called, but the UI will jump to the end state instead of the start state.
getCurrentFraction
fun getCurrentFraction(): @FloatRange(from = 0.0, to = 1.0) Float
| Returns | |
|---|---|
@FloatRange(from = 0.0, to = 1.0) Float |
The fraction, between 0 and 1, inclusive, of the progress of the transition. |
| See also | |
|---|---|
getCurrentPlayTimeMillis |
getCurrentPlayTimeMillis
fun getCurrentPlayTimeMillis(): @IntRange(from = 0) Long
| Returns | |
|---|---|
@IntRange(from = 0) Long |
The time, in milliseconds, of the animation. This will be between 0 and |
isReady
fun isReady(): Boolean
Returns true when the Transition is ready to seek or false when the Transition's animations have yet to be built.
removeOnProgressChangedListener
fun removeOnProgressChangedListener(
consumer: Consumer<TransitionSeekController!>
): Unit
Remove a listener previously added in addOnProgressChangedListener
| Parameters | |
|---|---|
consumer: Consumer<TransitionSeekController!> |
The listener to be removed. |
removeOnReadyListener
fun removeOnReadyListener(
onReadyListener: Consumer<TransitionSeekController!>
): Unit
Removes onReadyListener that was previously added in addOnReadyListener so that it won't be called.
| Parameters | |
|---|---|
onReadyListener: Consumer<TransitionSeekController!> |
The listener to be removed so that it won't be notified when ready. |
setCurrentFraction
fun setCurrentFraction(fraction: @FloatRange(from = 0.0, to = 1.0) Float): Unit
Sets the position of the Transition's animation. fraction should be between 0 and 1, inclusive, where 0 indicates that the transition hasn't progressed and 1 indicates that the transition is completed. Calling this before isReady is true will do nothing.
| Parameters | |
|---|---|
fraction: @FloatRange(from = 0.0, to = 1.0) Float |
The fraction, between 0 and 1, inclusive, of the progress of the transition. |
| See also | |
|---|---|
setCurrentPlayTimeMillis |
setCurrentPlayTimeMillis
fun setCurrentPlayTimeMillis(playTimeMillis: @IntRange(from = 0) Long): Unit
Sets the position of the Transition's animation. playTimeMillis should be between 0 and getDurationMillis. Calling this before isReady is true will do nothing.
| Parameters | |
|---|---|
playTimeMillis: @IntRange(from = 0) Long |
The time, between 0 and |
| See also | |
|---|---|
setCurrentFraction |