|
|
@ -7,6 +7,7 @@ import androidx.appcompat.app.AppCompatActivity |
|
|
|
import io.legado.app.ui.book.search.SearchActivity |
|
|
|
import io.legado.app.ui.book.search.SearchActivity |
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
import io.legado.app.ui.main.MainActivity |
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
import io.legado.app.utils.startActivity |
|
|
|
|
|
|
|
import splitties.init.appCtx |
|
|
|
|
|
|
|
|
|
|
|
class SharedReceiverActivity : AppCompatActivity() { |
|
|
|
class SharedReceiverActivity : AppCompatActivity() { |
|
|
|
|
|
|
|
|
|
|
@ -19,7 +20,8 @@ class SharedReceiverActivity : AppCompatActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun initIntent() { |
|
|
|
private fun initIntent() { |
|
|
|
if (Intent.ACTION_SEND == intent.action && intent.type == receivingType) { |
|
|
|
when { |
|
|
|
|
|
|
|
Intent.ACTION_SEND == intent.action && intent.type == receivingType -> { |
|
|
|
intent.getStringExtra(Intent.EXTRA_TEXT)?.let { |
|
|
|
intent.getStringExtra(Intent.EXTRA_TEXT)?.let { |
|
|
|
if (openUrl(it)) { |
|
|
|
if (openUrl(it)) { |
|
|
|
startActivity<SearchActivity> { |
|
|
|
startActivity<SearchActivity> { |
|
|
@ -27,10 +29,10 @@ class SharedReceiverActivity : AppCompatActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M |
|
|
|
} |
|
|
|
|
|
|
|
Build.VERSION.SDK_INT >= Build.VERSION_CODES.M |
|
|
|
&& Intent.ACTION_PROCESS_TEXT == intent.action |
|
|
|
&& Intent.ACTION_PROCESS_TEXT == intent.action |
|
|
|
&& intent.type == receivingType |
|
|
|
&& intent.type == receivingType -> { |
|
|
|
) { |
|
|
|
|
|
|
|
intent.getStringExtra(Intent.EXTRA_PROCESS_TEXT)?.let { |
|
|
|
intent.getStringExtra(Intent.EXTRA_PROCESS_TEXT)?.let { |
|
|
|
if (openUrl(it)) { |
|
|
|
if (openUrl(it)) { |
|
|
|
startActivity<SearchActivity> { |
|
|
|
startActivity<SearchActivity> { |
|
|
@ -39,6 +41,10 @@ class SharedReceiverActivity : AppCompatActivity() { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
intent.getStringExtra("action") == "mediaButton" -> { |
|
|
|
|
|
|
|
MediaButtonReceiver.readAloud(appCtx) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private fun openUrl(text: String): Boolean { |
|
|
|
private fun openUrl(text: String): Boolean { |
|
|
|