mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-23 19:11:49 +01:00
Perform a global search via share menu
Co-Authored-By: arkon <4098258+arkon@users.noreply.github.com>
This commit is contained in:
parent
a756b40b47
commit
fe09262a66
@ -45,7 +45,8 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ui.main.SearchActivity"
|
||||
android:theme="@style/Theme.Splash">
|
||||
android:theme="@style/Theme.Splash"
|
||||
android:label="@string/label_global_search">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEARCH" />
|
||||
<action android:name="com.google.android.gms.actions.SEARCH_ACTION"/>
|
||||
@ -56,6 +57,11 @@
|
||||
<action android:name="eu.kanade.tachiyomi.SEARCH" />
|
||||
<category android:name="android.intent.category.DEFAULT"/>
|
||||
</intent-filter>
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<data android:mimeType="text/plain" />
|
||||
</intent-filter>
|
||||
<meta-data android:name="android.app.searchable" android:resource="@xml/searchable"/>
|
||||
</activity>
|
||||
<activity android:name=".ui.reader.ReaderActivity"
|
||||
|
@ -80,14 +80,16 @@ class SearchActivity : MainActivity() {
|
||||
intent.getIntExtra("groupId", 0)
|
||||
)
|
||||
when (intent.action) {
|
||||
Intent.ACTION_SEARCH, "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)
|
||||
val query = intent.getStringExtra(SearchManager.QUERY) ?: intent.getStringExtra(Intent.EXTRA_TEXT)
|
||||
if (query != null && query.isNotEmpty()) {
|
||||
router.replaceTopController(GlobalSearchController(query).withFadeTransaction())
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
}
|
||||
INTENT_SEARCH -> {
|
||||
|
@ -255,6 +255,7 @@
|
||||
<string name="local_source">Local source</string>
|
||||
<string name="other">Other</string>
|
||||
<string name="global_search">Global search…</string>
|
||||
<string name="label_global_search">Global search</string>
|
||||
<string name="latest">Latest</string>
|
||||
<string name="browse">Browse</string>
|
||||
<string name="in_library">In Library</string>
|
||||
|
Loading…
Reference in New Issue
Block a user