feat(card-browser): delegate Menu to SearchBar#20213
Merged
lukstbit merged 1 commit intoankidroid:mainfrom Mar 5, 2026
Merged
Conversation
6c9f482 to
4323f72
Compare
BrayanDSO
approved these changes
Jan 25, 2026
Member
BrayanDSO
left a comment
There was a problem hiding this comment.
Everything is okay, although it's hard to imagine how the integration is going to look like
4323f72 to
ed6f6c7
Compare
david-allison
commented
Jan 26, 2026
lukstbit
approved these changes
Feb 5, 2026
Member
lukstbit
left a comment
There was a problem hiding this comment.
LGTM
This is performed in the base class so CardBrowser appears 'lean' and free from low-level concerns
Ok, but do you see other activities using this(now or in the near future)? If not, moving code that is tied to CardBrowser into the super class doesn't feel right(and the implementation could have been simpler).
This comment was marked as outdated.
This comment was marked as outdated.
ed6f6c7 to
87b306c
Compare
Member
Author
|
@lukstbit moved to |
This is a no-op in PROD, and will work in dev once CardBrowser is updated to use MenuProvider The current implementation was designed to produce the intended effect with minimal modification to the activity and Fragment. An alternate would be to define `activity.menuHost` via an interface, but I deemed this to be unintuitive Part of issue 18709 - Material 3 CardBrowser SearchView
87b306c to
bddd270
Compare
lukstbit
approved these changes
Mar 5, 2026
Member
lukstbit
left a comment
There was a problem hiding this comment.
This is fine. The simplification I was referring to was not using the super class.
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.
This is a no-op in PROD, and will work in dev once CardBrowser is updated to use MenuProvider
The current implementation was designed to produce the intended effect with minimal modification to the activity and Fragment.
An alternate would be to define
activity.menuHostvia an interface, but I deemed this to be unintuitive:NoteEditorActivitywould need to implement it for no current reason.Fixes
Approach
MenuHostdelegation inCardBrowserMenuHostHelperto delegate to the Menu of the SearchBarCardBrowserFragmentstays leanHow Has This Been Tested?
Right now, this is effectively a no-op, I have a (messy) branch which has converted the Card Browser to use MenuProvider and this works as expected.
Tested briefly on a tablet emulator, in both legacy and
SearchViewimplementations of the Card BrowserLearning (optional, can help others)
super.onCreateon an activity addsMenuProviders, therefore delegation is more complicated than expectedonDestroyinvalidates aMenuHost, but a fragment may no longer be attached to a context at this pointUsing the incorrect
MenuInflatermeansshowIfRoomhas no effectMenuProvider/MenuHosthttps://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:core/core/src/main/java/androidx/core/view/MenuHost.java?q=MenuHost
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:core/core/src/main/java/androidx/core/view/MenuHostHelper.java?q=MenuHost
Checklist
Please, go through these checks before submitting the PR.