Add text selection shortcut to invoke global search (closes #4058)

This commit is contained in:
arkon
2020-12-08 22:48:04 -05:00
parent 59859e124f
commit b6e246c6b2
3 changed files with 12 additions and 3 deletions

View File

@ -241,12 +241,12 @@ class MainActivity : BaseActivity<MainActivityBinding>() {
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()