Skip to content

Replace deprecated display apis with windowmetrics apis#16677

Merged
ashiagr merged 8 commits intotrunkfrom
issue/16073-replace-deprecated-display-apis-with-windowmetrics-apis
Jun 2, 2022
Merged

Replace deprecated display apis with windowmetrics apis#16677
ashiagr merged 8 commits intotrunkfrom
issue/16073-replace-deprecated-display-apis-with-windowmetrics-apis

Conversation

@AjeshRPai
Copy link
Copy Markdown
Contributor

@AjeshRPai AjeshRPai commented Jun 1, 2022

Parent #16073

As part of the changes for Android 12. This PR replaces the usages of the deprecated functions in DisplayUtils.kt in the WordPress Utils library.

Functions replaced in the PR are

  1. DisplayUtils.getDisplayPixelWidth(context)with DisplayUtils.getWindowPixelWidth(context)
  2. DisplayUtils.getDisplayPixelHeight(context) with DisplayUtils.getWindowPixelHeight(context)
  3. DisplayUtils.getDisplayPixelSize(context) with DisplayUtils.getWindowSize(context)

To test:

Testing instructions

The APIs are used in the following places

  1. MediaBrowserActivity.java
  2. MediaGridAdapter.java
  3. MediaPreviewFragment.java
  4. MediaSettingsActivity.java
  5. MediaSettingsActivity.java
  6. EditPostActivity.java
  7. PostListFragment.kt
  8. EditorPhotoPicker.kt
  9. ReaderPhotoViewerFragment.java
  10. ReaderPostListFragment.java
  11. ReaderResourceVars.java
  12. ReaderCommentAdapter.java
  13. ReaderPostAdapter.java
  14. ReaderPostTagsUiStateBuilder.kt
  15. HistoryDetailContainerFragment
  16. EditorMediaUtils.java
  17. StockMediaPickerActivity.java
  18. ReaderThumbnailStrip.java

In order to confirm that there is no regression issue we can test the following places.

Test 1 - Test on Android 11 and Android 12

ReaderPhotoViewerFragment.java

  • Log in to the app
  • Go to the reader tab
  • Click on any reader post with multiple images
  • Click at the image and swipe between the images
  • Click back
  • Switch off the WIFI/Internet
  • Click at the image and swipe between the images
  • Verify that the Image is shown properly in portrait and landscape orientation

Test 2

EditorMediaUtils.java

  • Log in to the app
  • Go to the My Site Dashboard
  • Create a post with a video
  • Verify that the Video thumbnail is shown properly

Test 3

ReaderCommentAdapter.java

  • Log in to the app
  • Go to a post with comments
  • Verify that the comments and nested comments(replies to the comments) are shown with the correct padding

Regression Notes

  1. Potential unintended areas of impact

  2. What I did to test those areas of impact (or what existing automated tests I relied on)

  3. What automated tests I added (or what prevented me from doing so)

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Jun 1, 2022

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-wordpress-mobile
Copy link
Copy Markdown

peril-wordpress-mobile bot commented Jun 1, 2022

You can test the changes on this Pull Request by downloading the APKs:

@AjeshRPai AjeshRPai requested a review from ashiagr June 2, 2022 04:30
@AjeshRPai AjeshRPai marked this pull request as ready for review June 2, 2022 04:30
@AjeshRPai
Copy link
Copy Markdown
Contributor Author

cc:@hichamboushaba 👋🏼
I have replaced the deprecated Display metrics API with Window metrics API in this PR. As the deprecated APIs are no longer needed in WordPress Utils, We can remove them from the repo.

@AjeshRPai AjeshRPai added this to the Future milestone Jun 2, 2022
@ashiagr ashiagr self-assigned this Jun 2, 2022
Copy link
Copy Markdown
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

Changes look good overall, I left two questions for you to consider.
Also, we might want to create a PR in WordPress-Utils to remove deprecated methods. Let me know if you need help with it. You can add me as a reviewer.

@AjeshRPai
Copy link
Copy Markdown
Contributor Author

AjeshRPai commented Jun 2, 2022

Also, we might want to create a PR in WordPress-Utils to remove deprecated methods. Let me know if you need help with it. You can add me as a reviewer.

Yup, Thanks. I have created a PR for the same here

Copy link
Copy Markdown
Contributor

@ashiagr ashiagr left a comment

Choose a reason for hiding this comment

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

LGTM 👍

:shipit:

@ashiagr ashiagr merged commit 619d38a into trunk Jun 2, 2022
@ashiagr ashiagr deleted the issue/16073-replace-deprecated-display-apis-with-windowmetrics-apis branch June 2, 2022 10:39
@ashiagr ashiagr modified the milestones: Future, 20.1 Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android 12: User experience - Replace deprecated Display APIs with WindowMetrics APIs

2 participants