Skip to content

Remove uses of bundleOf()#6632

Open
Isira-Seneviratne wants to merge 6 commits into
wikimedia:mainfrom
Isira-Seneviratne:Clean-bundleOf
Open

Remove uses of bundleOf()#6632
Isira-Seneviratne wants to merge 6 commits into
wikimedia:mainfrom
Isira-Seneviratne:Clean-bundleOf

Conversation

@Isira-Seneviratne

Copy link
Copy Markdown
Contributor

What does this do?

Cleans up uses of the bundleOf method.

Why is this needed?

The bundleOf method has been deprecated in AndroidX Core 1.18.0 due to its lack of compile-time safety.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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 with Bundle().apply { putParcelable/putString/putInt/... } in many fragment/dialog newInstance() methods.
  • Removed androidx.core.os.bundleOf imports and adjusted imports where necessary (e.g., explicit android.view.* imports).
  • Updated a few non-fragment Bundle return 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.
cooltey and others added 5 commits May 26, 2026 12:08
# Conflicts:
#	app/src/main/java/org/wikipedia/feed/suggestededits/SuggestedEditsCardItemFragment.kt
#	app/src/main/java/org/wikipedia/random/RandomFragment.kt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants