DisposableAnimationClock
class DisposableAnimationClock : AnimationClockObservable
kotlin.Any | |
↳ | androidx.compose.animation.DisposableAnimationClock |
Clock that remembers all of its active subscriptions so that it can dispose of upstream subscriptions. Create auto-disposing clocks in composition using asDisposableClock.
Summary
Public constructors | |
---|---|
<init>(clock: AnimationClockObservable) Clock that remembers all of its active subscriptions so that it can dispose of upstream subscriptions. |
Public methods | |
---|---|
Unit |
dispose() Unsubscribe all current subscriptions to the clock. |
Unit |
subscribe(observer: AnimationClockObserver) Subscribes an observer to the animation clock source. |
Unit |
unsubscribe(observer: AnimationClockObserver) Unsubscribes an observer from the animation clock. |
Inherited extension functions | ||
---|---|---|
From androidx.compose.animation
|
Properties | |
---|---|
Boolean |
|
Public constructors
<init>
DisposableAnimationClock(clock: AnimationClockObservable)
Clock that remembers all of its active subscriptions so that it can dispose of upstream subscriptions. Create auto-disposing clocks in composition using asDisposableClock.
Public methods
dispose
fun dispose(): Unit
Unsubscribe all current subscriptions to the clock. No new subscriptions are permitted;
further calls to subscribe will be ignored.
After a call to dispose, isDisposed will return true
.
subscribe
fun subscribe(observer: AnimationClockObserver): Unit
Subscribes an observer to the animation clock source.
Observers may only be added to a clock once. Calls to add the same observer more than once will be ignored, and a single call to unsubscribe will unregister from further callbacks.
Parameters | |
---|---|
observer: AnimationClockObserver | The observer that will be notified when animation clock time is updated. |
unsubscribe
fun unsubscribe(observer: AnimationClockObserver): Unit
Unsubscribes an observer from the animation clock.
Observers may only be added to a clock once. If subscribe has been called multiple times with the same observer, a single call to this method will unregister the observer completely.
Parameters | |
---|---|
observer: AnimationClockObserver | The observer to be removed from the subscription list. |