AnimatedValue per-value animation end signal
This change reworks animation end signalling for AnimatedValue; rather than consuming a top-level Flow to signal that an animation has ended, each AnimatedValue exposes its own stopAnimating() method that, critically, only affects that specific AnimatedValue; if a new AnimatedValue is emitted by the Flow returned from toAnimatedValueFlow(), then a invoking stopAnimating() on a previously-emitted AnimatedValue will be ignored. This helps avoid a common pitfall with modelling animation state, where a new AnimatedValue is emitted whilst a previous animation is still occurring. In many cases, we want to cancel() the previous animation, which without careful management, will result in a cancel signal making it back to the toAnimatedValueFlow(), *before* the new animation is even started. This will cause a new AnimatedValue to be emitted with isAnimating == false, immediately cancelling the new animation. Bug: 278765923 Test: atest SystemUITests Change-Id: I3503cbf604d6b85b573987264c0bb7611632b293
Loading
Please register or sign in to comment