Replace global search context menu option with share target

(cherry picked from commit d11c72fd48150f792050fb6f689d0be3a0a672c7)

# Conflicts:
#	app/src/main/res/values/strings.xml
This commit is contained in:
arkon 2021-01-03 11:08:23 -05:00 committed by Jobobby04
parent 74dc7a645d
commit 68f209b91b
3 changed files with 4 additions and 7 deletions

View File

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

View File

@ -306,12 +306,12 @@ class MainActivity : BaseViewBindingActivity<MainActivityBinding>() {
setSelectedNavItem(R.id.nav_more)
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
// 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) ?: intent.getCharSequenceExtra(Intent.EXTRA_PROCESS_TEXT)?.toString()
val query = intent.getStringExtra(SearchManager.QUERY) ?: intent.getStringExtra(Intent.EXTRA_TEXT)
if (query != null && query.isNotEmpty()) {
if (router.backstackSize > 1) {
router.popToRoot()

View File

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