Introduce icon tags for search - #249
Draft
moertel wants to merge 4 commits into
Draft
Conversation
This commit introduces a new XML file `icon_tags.xml` that contains a mapping from drawable to a list of tags. The tags are translatable, so users searching in their native language get a better chance of matching an icon rather than just searching by app title. The feature is behind a feature flag `enable_icons_tag_search` which is false by default, so users need to opt-in explicitly to make use of the feature. It would have been easier to store tags in `drawables.xml` directly but there is reason to believe that some launchers don't cope well with unknown xml tag names. So this feature is a plugin by design.
Contributor
Author
|
@sarsamurmu, @Donnnno, @Kaiserdragon2 open for feedback! :)
|
Contributor
|
Only seeing this now, but it sounds impressive! |
With the way that CandyBar defines icons and categories and how titles and tags have to be computed before they're populated, it was incredibly easy to miss a step and end up with the wrong result set. This commit adds a dedicated Content Provider to CandyBar that allows all apps on the system (not just CandyBar itself) to query icons from the app, get their drawable IDs or categories, or to search them by name or tag. Prefix-search is used by default and delivers snappy results in <10ms even for large icon packs. Be super careful with enabling substring search as this falls back to regular Java `contains` functionality on every single icon and can easily reach latencies of 100ms which can be visible in the UI.
This makes icon packs and other apps completely independent from the library interface. Instead, a list of categories (order is preserved) can be queried from the ContentProvider and then the list of icons can be retrieved for each. That allows for lazy-loading of categories. Just a few of them are visible at any point in time anyway.
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 commit introduces a new XML file
icon_tags.xmlthat contains a mapping from drawable to a list of tags. The tags are translatable, so users searching in their native language get a better chance of matching an icon rather than just searching by app title.The feature is behind a feature flag
enable_icons_tag_searchwhich isfalseby default, so devs need to opt-in explicitly to make use of the feature.It would have been easier to store tags in
drawables.xmldirectly but there is reason to believe that some launchers don't cope well with unknown xml tag names. So this feature is a plugin by design.Open Questions
ContentProvider? Probably out of scope for this PR but still potentially useful as we could index icons, names and tags viaAppSearch(https://developer.android.com/jetpack/androidx/releases/appsearch)Refs #224