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
This PR improves the initialization time of the Tags Dialog. In small and medium sized collections, there won't be a significant difference because they load fast anyway. But in large ones, with many tags and notes as Anking, there is a big difference when editting the notes of a lot of cards.
This only fixes most of the initialization slowdown caused by ankidroid#16356. While investigating the tags loading process, I found that several improvements could be done in
TagsListandTagsArrayAdapter. There's also the new backendtags.tree()method that may be useful. But, those are fairly complex classes (which solve the fairly complex issue of building a tags tree) and dealing with them would take a lot of time.Fixes
Approach
How Has This Been Tested?
Tested in two scenarios in an API 35 emulator. Both used the Anking V11 deck.
The "default" scenario is using "filter by tag", without fetching any note tags
The "worst" scenario is fetching all the 43.000+ notes in Anking
Default scenario
default_before.mp4
default_after.mp4
Worst scenario
worst_before.mp4
worst_after.mp4
Checklist
Please, go through these checks before submitting the PR.