Fix recents search not working when switching to the tab

this only happens in debug builds but doesn't hurt in prod
This commit is contained in:
Jays2Kings 2021-09-11 12:47:51 -04:00
parent f6feb9f078
commit ac6f7de1b3

View file

@ -453,6 +453,19 @@ class RecentsController(bundle: Bundle? = null) :
}
setBottomPadding()
binding.downloadBottomSheet.dlBottomSheet.update()
val searchItem =
(activity as? MainActivity)?.binding?.cardToolbar?.menu?.findItem(R.id.action_search)
val searchView = searchItem?.actionView as? SearchView ?: return
if (router.backstack.lastOrNull()?.controller != this) return
setOnQueryTextChangeListener(searchView) {
if (query != it) {
query = it ?: return@setOnQueryTextChangeListener false
resetProgressItem()
refresh()
}
true
}
}
override fun onDestroy() {