Remove uses of bundleOf()#6632
Open
Isira-Seneviratne wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR removes usages of androidx.core.os.bundleOf() across the app and replaces them with explicit Bundle construction + typed put*() calls, aligning with the AndroidX Core deprecation of bundleOf and improving compile-time safety for argument types.
Changes:
- Replaced
bundleOf(...)calls withBundle().apply { putParcelable/putString/putInt/... }in many fragment/dialognewInstance()methods. - Removed
androidx.core.os.bundleOfimports and adjusted imports where necessary (e.g., explicitandroid.view.*imports). - Updated a few non-fragment
Bundlereturn sites (e.g.,WikimediaAuthenticator,AccountUtil) to construct bundles explicitly.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| app/src/main/java/org/wikipedia/wiktionary/WiktionaryDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/watchlist/WatchlistExpiryDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/usercontrib/UserInformationDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/theme/ThemeChooserDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/talk/template/TalkTemplatesFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsRecentEditsOnboardingFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsImageTagDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsImageRecsFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsImageRecsDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/suggestededits/SuggestedEditsCardsFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/settings/languages/WikipediaLanguagesFragment.kt | Replace bundleOf and clean up wildcard imports. |
| app/src/main/java/org/wikipedia/search/SearchFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/sync/ReadingListSyncAdapter.kt | Replace bundleOf extras with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/SortReadingListsDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/ReadingListItemActionsDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/ReadingListFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/MoveToReadingListDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/readinglist/AddToReadingListDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/random/RandomItemFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/random/RandomFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/places/PlacesFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/page/linkpreview/LinkPreviewDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/games/onthisday/OnThisDayGameResultFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/games/onthisday/OnThisDayGameMainMenuFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/games/onthisday/OnThisDayGameArticleBottomSheet.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/gallery/GalleryItemFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/feed/topread/TopReadFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/feed/suggestededits/SuggestedEditsCardItemFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/feed/onthisday/OnThisDayFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/feed/news/NewsFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/donate/DonateDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/diff/ArticleEditDetailsFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/descriptions/DescriptionEditTutorialFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/commons/ImagePreviewDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/commons/FilePageFragment.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/categories/CategoryDialog.kt | Replace bundleOf arguments with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/auth/WikimediaAuthenticator.kt | Replace bundleOf returns with explicit Bundle puts. |
| app/src/main/java/org/wikipedia/auth/AccountUtil.kt | Replace bundleOf with explicit Bundle in authenticator result. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
214
to
+218
| return AddToReadingListDialog().apply { | ||
| arguments = bundleOf(PAGE_TITLE_LIST to ArrayList<Parcelable>(titles), | ||
| Constants.INTENT_EXTRA_INVOKE_SOURCE to source, | ||
| SHOW_DEFAULT_LIST to true) | ||
| arguments = Bundle().apply { | ||
| putParcelableArrayList(PAGE_TITLE_LIST, ArrayList<Parcelable>(titles)) | ||
| putSerializable(Constants.INTENT_EXTRA_INVOKE_SOURCE, source) | ||
| putBoolean(SHOW_DEFAULT_LIST, true) |
Comment on lines
79
to
+85
| return MoveToReadingListDialog().apply { | ||
| arguments = bundleOf(PAGE_TITLE_LIST to ArrayList<Parcelable>(titles), | ||
| Constants.INTENT_EXTRA_INVOKE_SOURCE to source, | ||
| SOURCE_READING_LIST_ID to sourceReadingListId, | ||
| SHOW_DEFAULT_LIST to showDefaultList) | ||
| arguments = Bundle().apply { | ||
| putParcelableArrayList(PAGE_TITLE_LIST, ArrayList<Parcelable>(titles)) | ||
| putSerializable(Constants.INTENT_EXTRA_INVOKE_SOURCE, source) | ||
| putLong(SOURCE_READING_LIST_ID, sourceReadingListId) | ||
| putBoolean(SHOW_DEFAULT_LIST, showDefaultList) | ||
| } |
| return Bundle().apply { | ||
| putInt(AccountManager.KEY_ERROR_CODE, AccountManager.ERROR_CODE_UNSUPPORTED_OPERATION) | ||
|
|
||
| // HACK: the docs indicate that this is a required key bit it's not displayed to the user. |
# Conflicts: # app/src/main/java/org/wikipedia/feed/suggestededits/SuggestedEditsCardItemFragment.kt # app/src/main/java/org/wikipedia/random/RandomFragment.kt
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.
What does this do?
Cleans up uses of the
bundleOfmethod.Why is this needed?
The
bundleOfmethod has been deprecated in AndroidX Core 1.18.0 due to its lack of compile-time safety.