mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-07 19:27:25 +01:00
Fix for library tags not triggering search
This commit is contained in:
parent
42a97f8c40
commit
85e7b78b21
@ -327,15 +327,6 @@ class LibraryController(
|
|||||||
val searchItem = menu.findItem(R.id.action_search)
|
val searchItem = menu.findItem(R.id.action_search)
|
||||||
val searchView = searchItem.actionView as SearchView
|
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()
|
searchView.queryTextChanges()
|
||||||
// Ignore events if this controller isn't at the top
|
// Ignore events if this controller isn't at the top
|
||||||
.filter { router.backstack.lastOrNull()?.controller() == this }
|
.filter { router.backstack.lastOrNull()?.controller() == this }
|
||||||
@ -345,7 +336,19 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
.launchInUI()
|
.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() })
|
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) {
|
fun search(query: String) {
|
||||||
|
Loading…
Reference in New Issue
Block a user