Skip to content

Convert ReaderPostPagerActivity to Kotlin #21822

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

Merged
merged 27 commits into from
Apr 22, 2025

Conversation

nbradbury
Copy link
Contributor

@nbradbury nbradbury commented Apr 21, 2025

Fixes CMM-288

This PR converts ReaderPostPagerActivity to Kotlin. No new functionality has been added, but I've resolved all deprecation warnings apart from the PostPagerAdapter. That adapter and related view pager should be updated to ViewPager2, but that change will require a separate PR.

To test, simply use the Reader and verify that it still works as expected.

@dangermattic
Copy link
Collaborator

dangermattic commented Apr 21, 2025

4 Warnings
⚠️ This PR is larger than 300 lines of changes. Please consider splitting it into smaller PRs for easier and faster reviews.
⚠️ Class InterceptType is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ Class DirectOperation is missing tests, but unit-tests-exemption label was set to ignore this.
⚠️ PR is not assigned to a milestone.

Generated by 🚫 Danger

…-Android into issue/CMM-288-kotlin-reader-post-pager-activity

Conflicts:
	WordPress/src/main/java/org/wordpress/android/ui/reader/ReaderPostPagerActivity.java
@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 21, 2025

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21822-1f0f899
Commit1f0f899
Direct Downloadjetpack-prototype-build-pr21822-1f0f899.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

wpmobilebot commented Apr 21, 2025

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21822-1f0f899
Commit1f0f899
Direct Downloadwordpress-prototype-build-pr21822-1f0f899.apk
Note: Google Login is not supported on these builds.

@nbradbury nbradbury requested a review from Copilot April 21, 2025 22:33
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

@nbradbury nbradbury marked this pull request as ready for review April 22, 2025 15:35
@nbradbury nbradbury requested review from dcalhoun and adalpari April 22, 2025 15:35
Comment on lines +254 to +255
viewPager = findViewById(R.id.viewpager)
progressBar = findViewById(R.id.progress_loading)
Copy link
Contributor

Choose a reason for hiding this comment

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

❓ No need to take any action, but is there any reason why we are not using ViewBindings here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That class was created in 2014, before ViewBindings existed, but I'm not sure why it wasn't converted later.

blogIdentifier: String?,
postIdentifier: String?
) {
if (!TextUtils.isEmpty(blogIdentifier) && !TextUtils.isEmpty(postIdentifier)) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!TextUtils.isEmpty(blogIdentifier) && !TextUtils.isEmpty(postIdentifier)) {
if (!blogIdentifier.isNullOrEmpty() && !postIdentifier.isNullOrEmpty()) {

Just a nitpick to avoid using Java methods

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! I made that change in 1f0f899

Copy link
Contributor

@adalpari adalpari left a comment

Choose a reason for hiding this comment

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

Code LGTM and the reader tab seems to be loading correctly.
Just left a couple of minor comments.

Screenshot 2025-04-22 at 18 09 35

@nbradbury nbradbury enabled auto-merge (squash) April 22, 2025 16:23
@nbradbury nbradbury merged commit c99f6e0 into trunk Apr 22, 2025
26 checks passed
@nbradbury nbradbury deleted the issue/CMM-288-kotlin-reader-post-pager-activity branch April 22, 2025 16:36
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.

4 participants