Class ShadowLegacyChoreographer

    • Constructor Detail

      • ShadowLegacyChoreographer

        public ShadowLegacyChoreographer()
    • Method Detail

      • setPostCallbackDelay

        public static void setPostCallbackDelay​(int delayMillis)
        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 Robolectric Scheduler is in Scheduler.IdleState.PAUSED mode.
      • setPostFrameCallbackDelay

        public static void setPostFrameCallbackDelay​(int delayMillis)
        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 the Robolectric Scheduler is in Scheduler.IdleState.PAUSED mode.
      • postCallback

        @Implementation
        protected void postCallback​(int callbackType,
                                    Runnable action,
                                    Object token)
        The default implementation will call postCallbackDelayed(int, Runnable, Object, long) with no delay. AnimationHandler calls this method to schedule animation updates infinitely. Because during a Robolectric test the system time is paused and execution of the event loop is invoked for each test instruction, the behavior of AnimationHandler would result in endless looping (the execution of the task results in a new animation task created and scheduled to the front of the event loop queue).

        To prevent endless looping, a test may call setPostCallbackDelay(int) to specify a small delay when animation is scheduled.

        See Also:
        setPostCallbackDelay(int)
      • postCallbackDelayed

        @Implementation
        protected void postCallbackDelayed​(int callbackType,
                                           Runnable action,
                                           Object token,
                                           long delayMillis)
      • getFrameInterval

        public static long getFrameInterval()
        Return the current inter-frame interval.
        Returns:
        Inter-frame interval.
      • setFrameInterval

        public static void setFrameInterval​(long frameInterval)
        Set the inter-frame interval used to advance the clock. By default, this is set to 1ms.
        Parameters:
        frameInterval - Inter-frame interval.
      • reset

        @Resetter
        public static void reset()