Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve animation runner interaction with view #7280

Open
wants to merge 1 commit into
base: google
Choose a base branch
from

Conversation

copybara-service[bot]
Copy link

Improve animation runner interaction with view

In real View implementation, during drawing, the animation will be initialized on the first frame and cleared when it has finished (if it does not fill). Without these interactions if draw is actually called on the view then the animation is put into an inconsistent state. To support existing use cases getAnimations and clearAnimations methods are added to the shadow to allow test authors to inspect the animations that are applied to a view.

Note that the real implementation would also call onAnimationStart/onAnimationEnd on the view too, but in kitkat and below this interacts with the drawing cache in a way that is not well supported by Robolectric so continue to avoid doing this.

In real `View` implementation, during drawing, the animation will be initialized on the first frame and cleared when it has finished (if it does not fill). Without these interactions if `draw` is actually called on the view then the animation is put into an inconsistent state. To support existing use cases `getAnimations` and `clearAnimations` methods are added to the shadow to allow test authors to inspect the animations that are applied to a view.

Note that the real implementation would also call `onAnimationStart`/`onAnimationEnd` on the view too, but in kitkat and below this interacts with the drawing cache in a way that is not well supported by Robolectric so continue to avoid doing this.

PiperOrigin-RevId: 444084414
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant