-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
Fix status bar height calculation for all cutout sizes #44805
Conversation
This pull request was exported from Phabricator. Differential Revision: D58088036 |
Base commit: ce10ce4 |
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 solution
Summary: Google has discouraged attempting to read the `status_bar_height` resource [since 2017](https://youtu.be/_mGDMVRO3iE?si=qGQd7gLa_qTmfLGL&t=1079). With the introduction of display cutouts there can be a mismatch between the resource value and the true status bar size (and issues like [this one](facebook#33612) popped up). The recommended approach is to instead call `getInsets` with the proper status bar and navigation flags provided by `WindowInsets`. On older APIs where `getInsets` is not supported, we have access to `systemWindowInsetTop`. Changelog: [Android][Fixed] - Fixed StatusBar.currentHeight calculations to honor all cutout sizes Differential Revision: D58088036
f462726
to
76e658c
Compare
This pull request was exported from Phabricator. Differential Revision: D58088036 |
Summary: Google has discouraged attempting to read the `status_bar_height` resource [since 2017](https://youtu.be/_mGDMVRO3iE?si=qGQd7gLa_qTmfLGL&t=1079). With the introduction of display cutouts there can be a mismatch between the resource value and the true status bar size (and issues like [this one](facebook#33612) popped up). The recommended approach is to instead call `getInsets` with the proper status bar and navigation flags provided by `WindowInsets`. On older APIs where `getInsets` is not supported, we have access to `systemWindowInsetTop`. Changelog: [Android][Fixed] - Fixed StatusBar.currentHeight calculations to honor all cutout sizes Reviewed By: tdn120 Differential Revision: D58088036
76e658c
to
b734645
Compare
This pull request was exported from Phabricator. Differential Revision: D58088036 |
This pull request has been merged in 0b8222a. |
This pull request was successfully merged by Peter Abbondanzo in 0b8222a. When will my fix make it into a release? | How to file a pick request? |
Summary:
Google has discouraged attempting to read the
status_bar_height
resource since 2017. With the introduction of display cutouts there can be a mismatch between the resource value and the true status bar size (and issues like this one popped up). The recommended approach is to instead callgetInsets
with the proper status bar and navigation flags provided byWindowInsets
. On older APIs wheregetInsets
is not supported, we have access tosystemWindowInsetTop
.Changelog:
[Android][Fixed] - Fixed StatusBar.currentHeight calculations to honor all cutout sizes
Differential Revision: D58088036