Rename
This commit is contained in:
1 parent
b86d90021c
commit
6c0757c91b
972 files changed
+6885
-7321
No files matched your search
@@ -0,0 +1,50 @@
|
||||
package io.legato.kazusa.help
|
||||
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import io.legato.kazusa.R
|
||||
import io.legato.kazusa.utils.toastOnUi
|
||||
import splitties.init.appCtx
|
||||
|
||||
@Suppress("unused")
|
||||
object IntentHelp {
|
||||
|
||||
fun getBrowserIntent(url: String): Intent {
|
||||
return getBrowserIntent(Uri.parse(url))
|
||||
}
|
||||
|
||||
fun getBrowserIntent(uri: Uri): Intent {
|
||||
val intent = Intent(Intent.ACTION_VIEW)
|
||||
intent.data = uri
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
if (intent.resolveActivity(appCtx.packageManager) == null) {
|
||||
return Intent.createChooser(intent, "请选择浏览器")
|
||||
}
|
||||
return intent
|
||||
}
|
||||
|
||||
fun openTTSSetting() {
|
||||
//跳转到文字转语音设置界面
|
||||
kotlin.runCatching {
|
||||
val intent = Intent()
|
||||
intent.action = "com.android.settings.TTS_SETTINGS"
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
appCtx.startActivity(intent)
|
||||
}.onFailure {
|
||||
appCtx.toastOnUi(R.string.tip_cannot_jump_setting_page)
|
||||
}
|
||||
}
|
||||
|
||||
fun toInstallUnknown(context: Context) {
|
||||
kotlin.runCatching {
|
||||
val intent = Intent()
|
||||
intent.action = "android.settings.MANAGE_UNKNOWN_APP_SOURCES"
|
||||
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
context.startActivity(intent)
|
||||
}.onFailure {
|
||||
context.toastOnUi("无法打开设置")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user