-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat(card-browser): Advanced Search [Dev only] #20071
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7a11de4 to
6d3e53a
Compare
6d3e53a to
ce11051
Compare
BrayanDSO
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well. General structure looks great, and the feature idea itself is awesome. Wonderful addition to the app.
| childFragmentManager.findFragmentByTag(tag) ?: factory().also { | ||
| childFragmentManager | ||
| .beginTransaction() | ||
| .add(R.id.search_view_content_container, it, tag) | ||
| .commit() | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hard to read
AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/browser/CardBrowserFragment.kt
Outdated
Show resolved
Hide resolved
| val options: List<OptionData> = listOf(), | ||
| ) | ||
|
|
||
| val tabData = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be private. Maybe static as well? I'm not used to have something big like this at the top of the class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll leave it for now (as private), it'll likely be reworked as the tabs get more specific functionality
AnkiDroid/src/main/java/com/ichi2/anki/browser/search/AdvancedSearchFragment.kt
Outdated
Show resolved
Hide resolved
AnkiDroid/src/main/java/com/ichi2/anki/browser/search/AdvancedSearchFragment.kt
Outdated
Show resolved
Hide resolved
| .commit() | ||
| } | ||
|
|
||
| fun onTemporaryTextChanged(text: String) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please add docs. I had to think before guessing what temporary text meant
|
Thanks, I'm going to rewrite this to use a |
This adds a wireframe for an advanced search mode in the Card Browser. Basic operations should can be performed using chips, but advanced operations such as `deck:a*` would not be feasible to display. The advanced mode provides discoverability of many operations which would otherwise only be available in the manual Ignored in the test due to use of `FragmentContainerView` Issue 18709
[Work in Progress]
This commit adds a basic implementation of Advanced Searches:
An advanced search is just a string
UI:
* A list of categorized options is added in tabs
* A category would be 'Tags'
* An option has a title, and an example
* example: Title: **Notes with no tags**; example: `tags:none`
* When the option is clicked, the example is appended to the
search text of the CardBrowserFragment
Strings are hardcoded, there will be a lot of nitpicks on functionality
Code reviews and future commits will replace some options with better
functionality, this should be done before ossifying the strings via translations
Issue 18709
ce11051 to
95b202a
Compare
It's unexpected to keep old state when closing the search view
95b202a to
2936f15
Compare
Purpose / Description
In this PR, I implement a draft of the 'Advanced Search' functionality for the Card Browser.
As this is development-only functionality, I would ideally like this merged without productionizing the draft functionality. That being said, please heavily review the intent and the existing code.
I plan to productionize this by adding dialog boxes to the provided options, enabling (for example): selection of valid fields in a drop-down list or autocompleting text view.
The main aim of this functionality is to expose Anki's search syntax to users, without them needing to read the manual.
Although we can use chips for a significant portion of common functionality, Anki's functionality is advanced:
fr*nt:text- search all fields matching the wildcarddeck:te*t- a deck search. Not easily representable in the 'deck' chipSo we will provide full text search functionality. Providing explanations, and builders for common functionality will improve discoverability of features, and gives us an opportunity to explain AnkiDroid's features
If this screen passes code reviews, it is intended for various 'small' dialogs to be produced. For example: one which will provide the full list of valid fields to select from.
Fixes
Approach
How Has This Been Tested?
screen-20260111-231015.mp4
Learning
https://docs.ankiweb.net/searching.html
Checklist