Merged
Conversation
1 task
malinajirka
approved these changes
Nov 26, 2021
Contributor
malinajirka
left a comment
There was a problem hiding this comment.
LGTM, great improvement! :)
Member
Author
|
Thanks for the review @malinajirka, do you have permission to merge, or do we need to ask someone else? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The DisplayUtils is using deprecated functions for calculating the display size, since Android 11, the Android team introduced the notion of WindowMetrics to account for the aspect of resizability of windows in Android in the future, this new API should offer more accurate results, and allow taking the insets (system bars) into account when calculating it.
The change I did here uses the default value returned by
getCurrentWindowMetricswithout excluding the insets, as it's same as whatgetDefaultDisplayis giving, in the future, we can decide if we want to update it.I also included another change, the API currently has two methods called
getDisplayPixelWidth, one of them needs a Context, and the other one doesn't, but the real issue is that they give different results when the screen is split, since one will return the actual size of the display, while the one acceptingContextwill return the size of the app's window, so I renamed the functions a bit to make it clear togetWindowPixelWidthandgetWindowPixelHeight.I deprecated the other ones to avoid breaking anything, but I wonder if this is the right move, or should we remove them and update the clients right away, WDYT?
For testing, please refer to the PR woocommerce/woocommerce-android#5346