From b6e246c6b22845d685de8fd786ba32e8306e2328 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 8 Dec 2020 22:48:04 -0500 Subject: [PATCH] Add text selection shortcut to invoke global search (closes #4058) --- app/src/main/AndroidManifest.xml | 8 +++++++- .../main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 4 ++-- app/src/main/res/values/strings.xml | 3 +++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 2c31ccb459..860bedd4ea 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -42,7 +42,8 @@ + android:theme="@android:style/Theme.NoDisplay" + android:label="@string/process_text_action_name"> @@ -53,6 +54,11 @@ + + + + + () { setSelectedNavItem(R.id.nav_more) router.pushController(RouterTransaction.with(DownloadController())) } - Intent.ACTION_SEARCH, "com.google.android.gms.actions.SEARCH_ACTION" -> { + Intent.ACTION_SEARCH, Intent.ACTION_PROCESS_TEXT, "com.google.android.gms.actions.SEARCH_ACTION" -> { // If the intent match the "standard" Android search intent // or the Google-specific search intent (triggered by saying or typing "search *query* on *Tachiyomi*" in Google Search/Google Assistant) // Get the search query provided in extras, and if not null, perform a global search with it. - val query = intent.getStringExtra(SearchManager.QUERY) + val query = intent.getStringExtra(SearchManager.QUERY) ?: intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT)?.toString() if (query != null && query.isNotEmpty()) { if (router.backstackSize > 1) { router.popToRoot() diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 6247ddc8db..ca2072a1eb 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -731,4 +731,7 @@ Previous page Next page + + Search in Tachiyomi +