-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[Android] [Shell] Ensure AnimationFinished
is called when app backgrounds mid-animation
#27534
[Android] [Shell] Ensure AnimationFinished
is called when app backgrounds mid-animation
#27534
Conversation
…rounds mid-animation
Hey there @albyrock87! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
/azp run |
Azure Pipelines successfully started running 3 pipeline(s). |
// the app enters background state in the middle of the animation causing the fragment to be destroyed without completing the animation. | ||
// That'll cause `IAnimationListener.onAnimationEnd` to not be called, so we need to call it manually if something is still subscribed to the event | ||
// to avoid the navigation `TaskCompletionSource` to be stuck forever. | ||
AnimationFinished?.Invoke(this, EventArgs.Empty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just wondering: Should this method be called only if _isAnimating == true
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question! _isAnimating = true
happens after AnimationFinished +=
subscription, so it's better to trust the event to avoid race conditions.
…rounds mid-animation (dotnet#27534)
Issue
Consider this shell stack:
ShellContent
>InnerPage
.The user presses a button to pop the page programmatically:
DoSomethingElse
is never being called if the user presses the android back button quickly while the animation is still in progress.This is caused because
IAnimationListener.onAnimationEnd
is never being invoked by android as the animation was canceled.Description of Change
Trigger the animation complete even upon fragment
Destroy
so that if the navigation is still waiting, it can complete.Issues Fixed
Relates to #26617 (#27364)