From 85e7b78b21cf8b0f9a5b580a1ee2b5196ae2efa2 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Apr 2020 11:53:25 -0400 Subject: [PATCH] Fix for library tags not triggering search --- .../tachiyomi/ui/library/LibraryController.kt | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 8c13040d0..e8d46385c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -327,15 +327,6 @@ class LibraryController( val searchItem = menu.findItem(R.id.action_search) val searchView = searchItem.actionView as SearchView - if (query.isNotEmpty()) { - searchItem.expandActionView() - searchView.setQuery(query, true) - searchView.clearFocus() - } - - // Mutate the filter icon because it needs to be tinted and the resource is shared. - menu.findItem(R.id.action_filter).icon.mutate() - searchView.queryTextChanges() // Ignore events if this controller isn't at the top .filter { router.backstack.lastOrNull()?.controller() == this } @@ -345,7 +336,19 @@ class LibraryController( } .launchInUI() + if (query.isNotEmpty()) { + searchItem.expandActionView() + searchView.setQuery(query, true) + searchView.clearFocus() + + // Manually trigger the search since the binding doesn't trigger for some reason + searchRelay.call(query) + } + searchItem.fixExpand(onExpand = { invalidateMenuOnExpand() }) + + // Mutate the filter icon because it needs to be tinted and the resource is shared. + menu.findItem(R.id.action_filter).icon.mutate() } fun search(query: String) {