From 2c3a5de679682630f5c9691ad8ea4bd836daa440 Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Tue, 20 Jul 2021 15:22:48 -0400 Subject: [PATCH] Fixed browse source search not working the first time no idea how it broke but this should fix it all the same --- .../ui/source/browse/BrowseSourceController.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt index b6a94347a1..aa081c4c26 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/source/browse/BrowseSourceController.kt @@ -1,5 +1,6 @@ package eu.kanade.tachiyomi.ui.source.browse +import android.app.Activity import android.os.Build import android.os.Bundle import android.view.LayoutInflater @@ -392,6 +393,17 @@ open class BrowseSourceController(bundle: Bundle) : adapter.onLoadMoreComplete(mangas) } + override fun onActivityResumed(activity: Activity) { + super.onActivityResumed(activity) + + val searchItem = (activity as? MainActivity)?.binding?.cardToolbar?.menu?.findItem(R.id.action_search) + val searchView = searchItem?.actionView as? SearchView ?: return + setOnQueryTextChangeListener(searchView, onlyOnSubmit = true, hideKbOnSubmit = false) { + searchWithQuery(it ?: "") + true + } + } + /** * Called from the presenter when the network request fails. *