Skip to content

[Dependency Updates] Update androidxRecyclerviewVersion to 1.2.1#17952

Merged
ParaskP7 merged 3 commits intotrunkfrom
deps/update-androidx-recyclerview-to-1.2.1
Feb 14, 2023
Merged

[Dependency Updates] Update androidxRecyclerviewVersion to 1.2.1#17952
ParaskP7 merged 3 commits intotrunkfrom
deps/update-androidx-recyclerview-to-1.2.1

Conversation

@ParaskP7
Copy link
Copy Markdown
Contributor

@ParaskP7 ParaskP7 commented Feb 13, 2023

Parent #17566

This PR updateandroidxRecyclerviewVersion to 1.2.1.

Also, as part of this update the below transitive dependencies were added:

  • On the Image Editor module (4131c6d):
    • androidx.recyclerview:recyclerview

In addition to the dependency update commits, one more additional analysis related commit was added to resolve the Adapter Position deprecation on the androidx.recyclerview library itself (fd073d8).


PS: @AjeshRPai I added you as the main reviewer, that is, in addition to the @wordpress-mobile/apps-infrastructure team itself, but randomly, since I just wanted someone from the WordPress team to be aware of and sign-off on that change for WPAndroid.


To test:

  1. See the dependency tree diff result and verify correctness.
  2. Thoroughly smoke test any recycler view related functionality on both, the WordPress and Jetpack apps, and see if they both work as expected.
  3. In addition to the above smoke test, you can expand the below and check the list of classes where the getAdapterPosition() got explicitly replaced with getBindingAdapterPosition(), maybe focusing on those screens first might be better:
Adapter Position to Binding Adapter Position
  1. image-editor module:
    • PreviewImageViewHolder.kt
  2. WordPress module:
    • TrailingLabelViewHolder.kt
    • UsernameChangerRecyclerViewAdapter.java
    • SitePickerAdapter.java
    • MediaGridAdapter.java
    • PeopleListFragment.java
    • PluginBrowserActivity.java
    • PluginListFragment.java
    • MultiSelectRecyclerViewAdapter.java
    • SiteSettingsTagListActivity.java
    • PublicizeAccountChooserListAdapter.java
    • ReaderBlogAdapter.java
    • ReaderCommentAdapter.java
    • ReaderPostAdapter.java
    • ReaderSiteSearchAdapter.java
    • StockMediaPickerActivity.java

PS: During testing, if you notice any inconsistency you might want to replace getBindingAdapterPosition() with getAbsoluteAdapterPosition() and test again.


Regression Notes

  1. Potential unintended areas of impact

    • Potential breakage or misbehaviour on any or all list related app functionalities, like list of posts/pages, reader and reader details, media, site picker and creation, list of plugins, etc.
    • Some of the transitive dependencies added might be causing some kind of misbehaviour.
  2. What I did to test those areas of impact (or what existing automated tests I relied on)

    • See To test section.
  3. What automated tests I added (or what prevented me from doing so)

    • N/A

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.

It is generally recommended that transitively used dependencies should
be declared directly.
Release Notes: https://developer.android.com/jetpack/androidx/releases/
recyclerview#recyclerview-1.2.1

------------------------------------------------------------------------

Note that this update adds the following 'Adapter Position' specific
warnings that need to be resolved in order for this project to compile
again due to the 'allWarningsAsErrors' flag.

Per module, the number of warnings and their corresponding classes are:
- 'image-editor' module (1):
 - PreviewImageViewHolder.kt (1)
- 'WordPress' module (23):
 - TrailingLabelViewHolder.kt (1)
 - UsernameChangerRecyclerViewAdapter.java (1)
 - SitePickerAdapter.java (3)
 - MediaGridAdapter.java (6)
 - PeopleListFragment.java (1)
 - PluginBrowserActivity.java (1)
 - PluginListFragment.java (1)
 - MultiSelectRecyclerViewAdapter.java (1)
 - SiteSettingsTagListActivity.java (1)
 - PublicizeAccountChooserListAdapter.java (1)
 - ReaderBlogAdapter.java (1)
 - ReaderCommentAdapter.java (1)
 - ReaderPostAdapter.java (1)
 - ReaderSiteSearchAdapter.java (1)
 - StockMediaPickerActivity.java (2)

As such, all the above listed modules, classes and their warnings need
to be migrated to the new 'Adapter Position' APIs. All that is going to
be done in subsequent commits.

For more info see:
- Release Notes (1.2.0): https://developer.android.com/jetpack/androidx/
releases/recyclerview#recyclerview-1.2.0
- RecyclerView.ViewHolder#getAdapterPosition (Doc):
https://developer.android.com/reference/androidx/recyclerview/widget/
RecyclerView.ViewHolder#getAdapterPosition()

------------------------------------------------------------------------

Also, as part of the '1.2.0-alpha02' it seems that this and higher
versions of RecyclerView are not compatible with lower versions of
ViewPager2. The recommendation is to update to newer version of
'View Pager 2', the '1.1.0-alpha01' or above.

- Release Notes (1.2.0-alpha02): https://developer.android.com/jetpack/
androidx/releases/recyclerview#recyclerview-1.2.0-alpha02

This seems to means that updating 'Recycler View' to '1.2.1' might mean
that 'View Pager 2' needs to be update to '1.1.0' as well. However, it
seems that the newest version of 'View Pager 2' is the '1.1.0-beta01',
and that has been this way since August 3, 2021. This means that there
is no production ready version of 'View Pager 2' so far, and more so,
that this library might have been abandoned. Also, the fact that the
'1.2.1' release notes don't suggest this update might also mean that
this requirement is no longer applicable, that is, at least on newer,
post alpha releases of 'Recycler View'.

- View Pager 2: https://developer.android.com/jetpack/androidx/releases/
viewpager2
Warning Messages:
- "'getAdapterPosition()' is deprecated"

Explanation: "This method is confusing when adapters nest other
adapters. If you are calling this in the context of an Adapter, you
probably want to call 'getBindingAdapterPosition' or if you want the
position as 'RecyclerView' sees it, you should call
'getAbsoluteAdapterPosition'."

------------------------------------------------------------------------

If those deprecation warnings were left unresolved, the
'getAdapterPosition()' method will anyway redirect the call to
'getBindingAdapterPosition()'. As such, it is better to be explicit now
and call this newly added 'getBindingAdapterPosition()' API directly,
and only change that to 'getAbsoluteAdapterPosition()' if and whenever
necessary.

------------------------------------------------------------------------

For more info see:
- RecyclerView.ViewHolder#getAdapterPosition (Doc):
https://developer.android.com/reference/androidx/recyclerview/widget/
RecyclerView.ViewHolder#getAdapterPosition()
@ParaskP7 ParaskP7 added this to the Future milestone Feb 13, 2023
@ParaskP7 ParaskP7 self-assigned this Feb 13, 2023
@wpmobilebot
Copy link
Copy Markdown
Contributor

Found 1 violations:

The PR caused the following dependency changes:

 +--- project :libs:analytics
 |    \--- androidx.preference:preference:1.1.0
-|         \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0
-|              +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
-|              +--- androidx.core:core:1.1.0 -> 1.8.0 (*)
-|              +--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)
-|              \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
+|         \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1
+|              +--- androidx.annotation:annotation:1.1.0 -> 1.3.0
+|              +--- androidx.core:core:1.3.2 -> 1.8.0 (*)
+|              +--- androidx.customview:customview:1.0.0 -> 1.1.0 (*)
+|              \--- androidx.collection:collection:1.0.0 -> 1.1.0 (*)
 +--- project :libs:image-editor
+|    +--- androidx.recyclerview:recyclerview:1.2.1 (*)
 |    +--- androidx.viewpager2:viewpager2:1.0.0
-|    |    \--- androidx.recyclerview:recyclerview:1.1.0 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.1.0 -> 1.2.1 (*)
 |    +--- com.google.android.material:material:1.2.1 -> 1.6.0-alpha01
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
 +--- project :libs:editor
 |    \--- org.wordpress-mobile.gutenberg-mobile:react-native-gutenberg-bridge:v1.88.0
 |         +--- com.github.wordpress-mobile:react-native-video:5.2.0-wp-5
 |         |    \--- com.google.android.exoplayer:exoplayer:2.13.3
 |         |         \--- com.google.android.exoplayer:exoplayer-ui:2.13.3
-|         |              \--- androidx.recyclerview:recyclerview:1.1.0 (*)
+|         |              \--- androidx.recyclerview:recyclerview:1.1.0 -> 1.2.1 (*)
 |         \--- org.wordpress-mobile.gutenberg-mobile:react-native-aztec:v1.88.0
-|              \--- androidx.recyclerview:recyclerview:1.1.0 (*)
+|              \--- androidx.recyclerview:recyclerview:1.1.0 -> 1.2.1 (*)
 +--- org.wordpress:fluxc:{strictly 2657-77f6e8b4af256b762d0c1482a9347ccf9fb4820e} -> 2657-77f6e8b4af256b762d0c1482a9347ccf9fb4820e
 |    +--- androidx.paging:paging-runtime:2.1.2
-|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
+|    |    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
-|    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
+|    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
 +--- org.wordpress:utils:{strictly 3.2.0} -> 3.2.0
-|    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
+|    \--- androidx.recyclerview:recyclerview:1.0.0 -> 1.2.1 (*)
 +--- com.automattic:stories:2.0.0
-|    \--- androidx.recyclerview:recyclerview:1.1.0 (*)
+|    \--- androidx.recyclerview:recyclerview:1.1.0 -> 1.2.1 (*)
-+--- androidx.recyclerview:recyclerview:1.0.0 -> 1.1.0 (*)
++--- androidx.recyclerview:recyclerview:1.2.1 (*)
 \--- com.zendesk:support:5.0.2
      +--- com.zendesk:guide:1.0.1
-     |    \--- androidx.recyclerview:recyclerview -> 1.1.0 (*)
+     |    \--- androidx.recyclerview:recyclerview -> 1.2.1 (*)
-     \--- androidx.recyclerview:recyclerview -> 1.1.0 (*)
+     \--- androidx.recyclerview:recyclerview -> 1.2.1 (*)

Please review and act accordingly

@wpmobilebot
Copy link
Copy Markdown
Contributor

WordPress📲 You can test these changes on WordPress by downloading wordpress-installable-build-pr17952-fd073d8.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppWordPress
Build FlavorJalapeno
Build TypeDebug
Commitfd073d8
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@wpmobilebot
Copy link
Copy Markdown
Contributor

Jetpack📲 You can test these changes on Jetpack by downloading jetpack-installable-build-pr17952-fd073d8.apk
💡 Scan this QR code with your Android phone to download and install the APK directly on it.
AppJetpack
Build FlavorJalapeno
Build TypeDebug
Commitfd073d8
Note: This installable build uses the JalapenoDebug build flavor, and does not support Google Login.

@ParaskP7 ParaskP7 requested a review from AjeshRPai February 13, 2023 15:07
@ParaskP7 ParaskP7 marked this pull request as ready for review February 13, 2023 15:07
@ParaskP7 ParaskP7 requested a review from a team February 13, 2023 15:08
Copy link
Copy Markdown
Contributor

@AjeshRPai AjeshRPai left a comment

Choose a reason for hiding this comment

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

Hey @ParaskP7

Everything looks good to me.I have tested the app by keeping the adapters listed below in mind. 🟢

  • image-editor module
    • PreviewImageViewHolder.kt
  • WordPress module:
    • TrailingLabelViewHolder.kt
    • UsernameChangerRecyclerViewAdapter.java
    • SitePickerAdapter.java
    • MediaGridAdapter.java
    • PeopleListFragment.java
    • PluginBrowserActivity.java
    • PluginListFragment.java
    • MultiSelectRecyclerViewAdapter.java
    • SiteSettingsTagListActivity.java
    • PublicizeAccountChooserListAdapter.java
    • ReaderBlogAdapter.java\
    • ReaderCommentAdapter.java
    • ReaderPostAdapter.java
    • ReaderSiteSearchAdapter.java
    • StockMediaPickerActivity.java

I have tested the recycler view behaviours 🟢

  • Scroll state works as expected
  • Diff works as expected
  • Clicking on the items works as expected

I have also looked for any places where we want to replace getBindingAdapterPosition()
with getAbsoluteAdapterPosition() .I couldn't see any

I am approving but not merging this PR so that anyone from @wordpress-mobile/apps-infrastructure can have a look. Please go ahead and merge at your convenience

@ParaskP7
Copy link
Copy Markdown
Contributor Author

Woohoo, you are awesome @AjeshRPai , thank you so much for reviewing and testing this, choo choo the trains goes, the rocket launches, the PR merge triggers! 🚂 🚀 :pr-merge: 🙇 ❤️

@ParaskP7 ParaskP7 merged commit 45ae410 into trunk Feb 14, 2023
@ParaskP7 ParaskP7 deleted the deps/update-androidx-recyclerview-to-1.2.1 branch February 14, 2023 12:53
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.

3 participants