Google is committed to advancing racial equity for Black communities. See how.

TestAnimationClock

interface TestAnimationClock : AnimationClockObservable
androidx.ui.test.TestAnimationClock

Interface for animation clocks that can report their idleness and can switch between ticking automatically (e.g., if it's driven by the main loop of the host) and ticking manually.

An idle clock is one that is currently not driving any animations. Typically, that means a clock where no observers are registered. The idleness can be retrieved by isIdle.

Use pauseClock to switch from automatic ticking to manual ticking, resumeClock to switch from manual to automatic with; and manually tick the clock with advanceClock.

Summary

Public methods
abstract Unit
advanceClock(milliseconds: Long)

Advances the clock by the given number of milliseconds.

abstract Unit

Pauses the automatic ticking of the clock.

abstract Unit

Resumes the automatic ticking of the clock.

Inherited functions
Inherited extension functions
From androidx.ui.animation
DisposableAnimationClock

Return a new AnimationClockObservable wrapping this one that will auto-unsubscribe all AnimationClockObservers when this call leaves the composition, preventing clock subscriptions from persisting beyond the composition lifecycle.

Properties
abstract Boolean

Whether the clock is idle or not.

abstract Boolean

Whether the clock is paused or not.

Public methods

advanceClock

abstract fun advanceClock(milliseconds: Long): Unit

Advances the clock by the given number of milliseconds. It is safe to call this method both when the clock is paused and resumed.

pauseClock

abstract fun pauseClock(): Unit

Pauses the automatic ticking of the clock. The clock shall only tick in response to advanceClock, and shall continue ticking automatically when resumeClock is called. It's safe to call this method when the clock is already paused.

resumeClock

abstract fun resumeClock(): Unit

Resumes the automatic ticking of the clock. It's safe to call this method when the clock is already resumed.

Properties

isIdle

abstract val isIdle: Boolean

Whether the clock is idle or not. An idle clock is one that is not driving animations, which happens (1) when no observers are observing this clock, or (2) when the clock is paused.

isPaused

abstract val isPaused: Boolean

Whether the clock is paused or not.