refactor(card-browser): convert to MenuProvider#20208
Open
david-allison wants to merge 7 commits intoankidroid:mainfrom
Open
refactor(card-browser): convert to MenuProvider#20208david-allison wants to merge 7 commits intoankidroid:mainfrom
MenuProvider#20208david-allison wants to merge 7 commits intoankidroid:mainfrom
Conversation
57aef0e to
7be0704
Compare
5 tasks
This comment was marked as resolved.
This comment was marked as resolved.
5 tasks
7be0704 to
c5a17d1
Compare
c5a17d1 to
efd8d44
Compare
5 tasks
efd8d44 to
f78d5ac
Compare
to `R.id.action_preview_many` This is technically a functional change as it fixes a bug: Sanjay intended that `preview_item` was disabled if the view was fragmented, in 48db476 but the code wasn't working as expected This ID was shared between two menus: `card_browser` and `note_editor` which will appear on the same screen This causes issues with menu APIs, as they expect distinct IDs: `menu.findItem(id)`; `menu.removeItem(id)` etc...
Handling fragments belongs in the Activity The rest of the logic should be pushed down
We previously had one provider for both single select and multiselect. This made logic difficult to reason about
f78d5ac to
7e63226
Compare
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.
Purpose / Description
The card browser still had a long way to go for refactors: the menu logic was extremely complex.
Although I want most of the menu logic to
CardBrowserFragment, the coordination logic of the fragments should remain in the activity.This performs the split out of 'fragment-based' logic, then simplifies the logic further, by splitting out the non-selected and multiselect case of the menu.
The eventual aim is that the
SearchBaris used as aMenuHost, thisSearchBarwill need to be lifted out of theCardBrowserFragmentin the final implementation in order to support "split Card Browser" functionalityFixes
Approach
See the commits, gradual refactorings
How Has This Been Tested?
API 33 Medium Tablet
Learning (optional, can help others)
https://developer.android.com/reference/androidx/core/view/MenuProvider
Checklist