Merge branch 'fix-empty-app-list' into 'master'
Use initLoader instead of resetartLoader. Call onResume after setting category. While working on !311, I had some logging in place in the `AppProvider`. I ended up straying into an investigation of issue #606 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, but I haven't seen it reproduced since I've implemented this fix. See merge request !312
This commit is contained in:
commit
77376dfa42
@ -117,7 +117,7 @@ public abstract class AppListFragment extends ListFragment implements
|
||||
super.onResume();
|
||||
|
||||
//Starts a new or restarts an existing Loader in this manager
|
||||
getLoaderManager().restartLoader(0, null, this);
|
||||
getLoaderManager().initLoader(0, null, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -206,7 +206,6 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
/* restore the saved Category Spinner position */
|
||||
Activity activity = getActivity();
|
||||
SharedPreferences p = activity.getSharedPreferences(PREFERENCES_FILE, Context.MODE_PRIVATE);
|
||||
@ -222,6 +221,7 @@ public class AvailableAppsFragment extends AppListFragment implements
|
||||
}
|
||||
|
||||
setCurrentCategory(currentCategory);
|
||||
super.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user