Skip to content

Android 12: migrate to WindowMetrics API#5346

Merged
hichamboushaba merged 5 commits intodevelopfrom
issue/5342-android12-display-size
Nov 26, 2021
Merged

Android 12: migrate to WindowMetrics API#5346
hichamboushaba merged 5 commits intodevelopfrom
issue/5342-android12-display-size

Conversation

@hichamboushaba
Copy link
Copy Markdown
Member

Closes: #5342

Please don't merge until a develop commit from WordPress-Utils is used.

Description

This PR updates the WordPress-Utils library to make sure we use the updated API WindowMetrics for calculating the window sizes, and update the method calls to use the ones with clearer names (refer to wordpress-mobile/WordPress-Utils-Android#99 for more details).

Just as an example of what those changes will fix, is for Dialogs where we need a fixed size related to the Window size, we've been wrongly using DisplayUtils#getDisplayPixelWidth without passing a context, which resulted in the following issues:

Before After
Screenshot_20211125_111031 Screenshot_20211125_111904

Testing instructions

The APIs are used in multiple places, but just to confirm there is no regression, go to the Product images gallery, and check that the images have the right size, with fullscreen, and with split-screen.
And for the PR review, check if I didn't use a wrong version of any method.

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@hichamboushaba hichamboushaba added type: enhancement A request for an enhancement. status: do not merge Dependent on another PR, ready for review but not ready for merge. labels Nov 25, 2021
@hichamboushaba hichamboushaba added this to the 8.1 milestone Nov 25, 2021
@hichamboushaba hichamboushaba marked this pull request as ready for review November 25, 2021 10:30
@peril-woocommerce
Copy link
Copy Markdown

peril-woocommerce bot commented Nov 25, 2021

You can test the changes on this Pull Request by downloading the APK here.

@malinajirka malinajirka self-assigned this Nov 26, 2021
Copy link
Copy Markdown
Contributor

@malinajirka malinajirka left a comment

Choose a reason for hiding this comment

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

LGTM, thanks! Not merging since we need to update the hash first.

@hichamboushaba hichamboushaba removed the status: do not merge Dependent on another PR, ready for review but not ready for merge. label Nov 26, 2021
@hichamboushaba hichamboushaba merged commit e454bc7 into develop Nov 26, 2021
@hichamboushaba hichamboushaba deleted the issue/5342-android12-display-size branch November 26, 2021 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement A request for an enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android 12: migrate from Display API to WindowMetrics

2 participants