Skip to content

Use initLoader instead of resetartLoader. Call onResume after setting category.

Peter Serwylo requested to merge pserwylo/fdroidclient:fix-empty-app-list into master

While working on !311 (closed), I had some logging in place in the AppProvider. I ended up straying into an investigation of issue #606 (closed) and noticed with my logging that we have been doing more queries than required for some time, because the loader was being forceably recreated when it could instead be reused in onResume.

Perhaps more importantly, we were querying twice for list of apps to display. The first time is "Give me all the apps" because we haven't set the category yet. Then we set the category, which causes us to ask for "Apps matching this category". The fix for this is for the onResume method (which results in a cursor being created) to be called after setting the selected category is set. This ensures that the query is run has the correct category the first time, and needn't be run again.

I am not confident that this fixes the issue in #606 (closed), but I haven't seen it reproduced since I've implemented this fix.

Merge request reports