diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 65c6ad511..1779f9c25 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -57,7 +57,20 @@
android:windowSoftInputMode="adjustResize|stateHidden" />
-
+
+
+
+
+
+
+
+
+
+
+
+
@@ -66,11 +79,14 @@
-
-
-
+
-
+
+
+
+
@@ -79,7 +95,8 @@
-
+
+
diff --git a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
index f9124f9fb..0812b6706 100644
--- a/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
+++ b/app/src/main/java/io/legado/app/ui/book/search/SearchActivity.kt
@@ -1,5 +1,7 @@
package io.legado.app.ui.book.search
+import android.content.Intent
+import android.os.Build
import android.os.Bundle
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.LiveData
@@ -49,9 +51,8 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se
initSearchView()
initOtherView()
initData()
- intent.getStringExtra("key")?.let {
- search_view.setQuery(it, true)
- }
+ initIntent()
+ upHistory()
}
private fun initSearchView() {
@@ -125,7 +126,25 @@ class SearchActivity : VMBaseActivity(R.layout.activity_book_se
), 30
).build()
searchBookData?.observe(this, Observer { adapter.submitList(it) })
- upHistory()
+ }
+
+ private fun initIntent() {
+ if (Intent.ACTION_SEND == intent.action && intent.type == "text/plain") {
+ intent.getStringExtra(Intent.EXTRA_TEXT)?.let {
+ search_view.setQuery(it, true)
+ }
+ } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
+ && Intent.ACTION_PROCESS_TEXT == intent.action
+ && intent.type == "text/plain"
+ ) {
+ intent.getStringExtra(Intent.EXTRA_PROCESS_TEXT)?.let {
+ search_view.setQuery(it, true)
+ }
+ } else {
+ intent.getStringExtra("key")?.let {
+ search_view.setQuery(it, true)
+ }
+ }
}
private fun upHistory(key: String? = null) {