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

[BUG] StatusBar.Android.PlatformSetColor() breaks ViewTreeObserver.IOnGlobalLayoutListener #2289

Open
2 tasks done
evgenyvalavin opened this issue Oct 17, 2024 · 3 comments
Open
2 tasks done
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified

Comments

@evgenyvalavin
Copy link

evgenyvalavin commented Oct 17, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Did you read the "Reporting a bug" section on Contributing file?

Current Behavior

This PR #1630 has broken ViewTreeObserver.IOnGlobalLayoutListener on Android API 29 and (protentional below).

var listener = new WindowInsetsOldApiListener(activity.Window.DecorView);
activity.Window.DecorView.RootView?.ViewTreeObserver?.AddOnGlobalLayoutListener(listener);

Expected Behavior

ViewTreeObserver.IOnGlobalLayoutListener works as before the PR #1630

Environment

  • .NET MAUI CommunityToolkit: 9.0.3 and 9.1.0
  • OS: Windows
  • .NET MAUI: .NET 8.0.91

Anything else?

Can't confirm which line of code in the PR has broken ViewTreeObserver.IOnGlobalLayoutListener. Also can't easily test the bug on Android emulators API 29 and below due to an old version of WebView on such emulators. I have a project using BlazorWebView. As I get more info I'll be back.
What I can say for sure is reverting the PR #1630 and using CommunityToolkit as a .dll makes ViewTreeObserver.IOnGlobalLayoutListener work normally.

@bijington
Copy link
Contributor

Thanks @evgenyvalavin that sounds plausible. Would you be willing to provide a sample or PR to help solve this?

@evgenyvalavin
Copy link
Author

I have a concern now whether .AddFlags() will solve the problem

@evgenyvalavin evgenyvalavin changed the title [BUG] StatusBar.Android.PlatformSetColor() accidently clears all Window flags [BUG] StatusBar.Android.PlatformSetColor() breaks ViewTreeObserver.IOnGlobalLayoutListener Oct 18, 2024
@evgenyvalavin
Copy link
Author

I'll add more info when I know more. Hope this bug will catch someone's attention who came across the same problem as me

@vhugogarcia vhugogarcia added the area/behaviors Issue/Discussion/PR that has to do with Behaviors label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/behaviors Issue/Discussion/PR that has to do with Behaviors bug Something isn't working unverified
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants