Package org.robolectric.shadows
Class ShadowChoreographer
java.lang.Object
org.robolectric.shadows.ShadowChoreographer
- Direct Known Subclasses:
- ShadowLegacyChoreographer,- ShadowPausedChoreographer
@Implements(value=android.view.Choreographer.class, shadowPicker=Picker.class) public abstract class ShadowChoreographer extends Object
The shadow API for 
Choreographer.
 Different shadow implementations will be used depending on the current LooperMode. See
 ShadowLegacyChoreographer and ShadowPausedChoreographer for details.
- 
Nested Class SummaryNested Classes Modifier and Type Class Description protected static interfaceShadowChoreographer.ChoreographerReflectorAccessor interface forChoreographer's internalsstatic classShadowChoreographer.Picker
- 
Constructor SummaryConstructors Constructor Description ShadowChoreographer()
- 
Method SummaryModifier and Type Method Description protected voiddoFrame(long frameTimeNanos, int frame)static DurationgetFrameDelay()static longgetFrameInterval()Deprecated.Use theLooperMode.Mode.PAUSEDlooper andgetFrameDelay()to configure the frame delay.static booleanisPaused()SeesetPaused(boolean).static voidreset()static voidsetFrameDelay(Duration delay)Sets the delay between each frame.static voidsetFrameInterval(long frameInterval)Deprecated.Use theLooperMode.Mode.PAUSEDlooper andsetFrameDelay(Duration)to configure the frame delay.static voidsetPaused(boolean paused)Sets whether posting a frame should auto advance the clock or not.static voidsetPostCallbackDelay(int delayMillis)Deprecated.Use theLooperMode.Mode.PAUSEDlooper instead.static voidsetPostFrameCallbackDelay(int delayMillis)Deprecated.Use theLooperMode.Mode.PAUSEDlooper andsetPaused(boolean)andsetFrameDelay(Duration)to configure the vsync event behavior.
- 
Constructor Details- 
ShadowChoreographerpublic ShadowChoreographer()
 
- 
- 
Method Details- 
setFrameDelaySets the delay between each frame. Note that the frames use theShadowSystemClockand so have the same fidelity, when using the paused looper mode (which is the only mode supported byShadowDisplayEventReceiver) the clock has millisecond fidelity.Reasonable delays may be 15ms (approximating 60fps ~16.6ms), 10ms (approximating 90fps ~11.1ms), and 30ms (approximating 30fps ~33.3ms). Choosing too small of a frame delay may increase runtime as animation frames will have more steps. Only works in LooperMode.Mode.PAUSEDlooper mode.
- 
getFrameDelay
- 
setPausedpublic static void setPaused(boolean paused)Sets whether posting a frame should auto advance the clock or not. When paused the clock is not auto advanced, when unpaused the clock is advanced by the frame delay every time a frame callback is added. The default is not paused.Only works in LooperMode.Mode.PAUSEDlooper mode.
- 
isPausedpublic static boolean isPaused()SeesetPaused(boolean).
- 
setPostCallbackDelayDeprecated.Use theLooperMode.Mode.PAUSEDlooper instead.Allows application to specify a fixed amount of delay when#postCallback(int, Runnable, Object)is invoked. The default delay value is 0. This can be used to avoid infinite animation tasks to be spawned when the RobolectricScheduleris inScheduler.IdleState.PAUSEDmode.Only supported in LooperMode.Mode.LEGACY
- 
setPostFrameCallbackDelayDeprecated.Use theLooperMode.Mode.PAUSEDlooper andsetPaused(boolean)andsetFrameDelay(Duration)to configure the vsync event behavior.Allows application to specify a fixed amount of delay when#postFrameCallback(FrameCallback)is invoked. The default delay value is 0. This can be used to avoid infinite animation tasks to be spawned when in LooperMode PAUSED orScheduler.IdleState.PAUSEDand displaying an animation.
- 
getFrameIntervalDeprecated.Use theLooperMode.Mode.PAUSEDlooper andgetFrameDelay()to configure the frame delay.Return the current inter-frame interval.Can only be used in LooperMode.Mode.LEGACY- Returns:
- Inter-frame interval.
 
- 
setFrameIntervalDeprecated.Use theLooperMode.Mode.PAUSEDlooper andsetFrameDelay(Duration)to configure the frame delay.Set the inter-frame interval used to advance the clock. By default, this is set to 1ms.Only supported in LooperMode.Mode.LEGACY- Parameters:
- frameInterval- Inter-frame interval.
 
- 
doFrame
- 
reset
 
-