Replace global search context menu option with share target

This commit is contained in:
arkon 2021-01-03 11:08:23 -05:00
parent 0af505828e
commit d11c72fd48
3 changed files with 4 additions and 7 deletions

View File

@ -43,7 +43,7 @@
android:name=".ui.main.DeepLinkActivity" android:name=".ui.main.DeepLinkActivity"
android:launchMode="singleTask" android:launchMode="singleTask"
android:theme="@android:style/Theme.NoDisplay" android:theme="@android:style/Theme.NoDisplay"
android:label="@string/process_text_action_name"> android:label="@string/action_global_search">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />
<action android:name="com.google.android.gms.actions.SEARCH_ACTION" /> <action android:name="com.google.android.gms.actions.SEARCH_ACTION" />
@ -55,7 +55,7 @@
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
</intent-filter> </intent-filter>
<intent-filter> <intent-filter>
<action android:name="android.intent.action.PROCESS_TEXT" /> <action android:name="android.intent.action.SEND" />
<category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" /> <data android:mimeType="text/plain" />
</intent-filter> </intent-filter>

View File

@ -241,12 +241,12 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
setSelectedNavItem(R.id.nav_more) setSelectedNavItem(R.id.nav_more)
router.pushController(RouterTransaction.with(DownloadController())) router.pushController(RouterTransaction.with(DownloadController()))
} }
Intent.ACTION_SEARCH, Intent.ACTION_PROCESS_TEXT, "com.google.android.gms.actions.SEARCH_ACTION" -> { Intent.ACTION_SEARCH, Intent.ACTION_SEND, "com.google.android.gms.actions.SEARCH_ACTION" -> {
// If the intent match the "standard" Android search intent // 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) // 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. // Get the search query provided in extras, and if not null, perform a global search with it.
val query = intent.getStringExtra(SearchManager.QUERY) ?: intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT)?.toString() val query = intent.getStringExtra(SearchManager.QUERY) ?: intent.getStringExtra(Intent.EXTRA_TEXT)
if (query != null && query.isNotEmpty()) { if (query != null && query.isNotEmpty()) {
if (router.backstackSize > 1) { if (router.backstackSize > 1) {
router.popToRoot() router.popToRoot()

View File

@ -736,7 +736,4 @@
<string name="spen_previous_page">Previous page</string> <string name="spen_previous_page">Previous page</string>
<string name="spen_next_page">Next page</string> <string name="spen_next_page">Next page</string>
<!-- Android OS text selection menu action -->
<string name="process_text_action_name">Search in Tachiyomi</string>
</resources> </resources>