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

[Android] Modal Animation Repeats When Returning from Background - Fix #28522

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

Conversation

kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Mar 19, 2025

Issues Fixed

Fixes #28492

Before After
Screen.Recording.2025-03-19.at.20.33.12.mov
Screen.Recording.2025-03-19.at.20.32.14.mov
Window!.Page!.Navigation.PushModalAsync(new ContentPage()
{
	Content = new Label() { Text = "Hello from Modal Page!" }
}, true);

What do you think @pictos?

@kubaflo kubaflo requested a review from a team as a code owner March 19, 2025 19:37
@kubaflo kubaflo self-assigned this Mar 19, 2025
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Mar 19, 2025
Copy link
Contributor

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

Copy link
Contributor

@pictos pictos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM,

but thinking loud here... isn't a way to say if the animation happened? If already happened we don't want to trigger it again, I think it will be more robust and possibly cover more scenarios, what do you think?

@kubaflo
Copy link
Contributor Author

kubaflo commented Mar 19, 2025

LGTM,

but thinking loud here... isn't a way to say if the animation happened? If already happened we don't want to trigger it again, I think it will be more robust and possibly cover more scenarios, what do you think?

Yea, initially I thought the same, but I wasn't sure if the animation should trigger only once for an instance of a fragment, or maybe there were some cases where it should trigger again

@PureWeen what do you think?

@@ -346,14 +353,16 @@ public override void OnStart()
int height = ViewGroup.LayoutParams.MatchParent;
dialog.Window.SetLayout(width, height);

if (IsAnimated)
if (IsAnimated && !_wasStopped)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of any scenario where the animation should restart after the initial OnStart() call. We can use _pendingAnimation instead of overriding OnStop() and introducing a new flag.

if (IsAnimated && _pendingAnimation)

I also think that starting the animation from OnStart() is a poor choice to begin with, as it has led us to introduce flags to handle everything properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Ready To Review
Development

Successfully merging this pull request may close these issues.

[Android] Modal Animation Repeats When Returning from Background
5 participants