Olauncher
Olauncher copied to clipboard
Race condition between filtering and refreshing apps
Long time user, I've noticed that sometimes, when quickly returning to the launcher, opening the drawer and starting to filter the apps, the app list resets to the full, unfiltered list ignoring the filter completely.
Steps to reproduce:
- (After using another app for a long time)
- Return to the launcher
- Immediately open the app drawer
- Start typing to filter the list
- After typing 3 letters, the list is filtered
- Then the list is re-populated with the original, full, app list.
After reading the code, my guess as to why this happens is that when using another app for a long time, the launcher needs to be re-created in Android, which, in turn, triggers a re-fetch of the system's App List. However, if the user already started filtering before the results of this fetch arrive, they will override the apps in the adapter and disregard the current filter.
Solution proposal - probably around this area: https://github.com/tanujnotes/Olauncher/blob/3411bc2028b3510faf183c81769190cefbfbaa97/app/src/main/java/app/olauncher/ui/AppDrawerFragment.kt#L177
After setting the apps list in the adapter, re-apply the filter so that the new filtered list remains in sync with the query string.