|
@@ -1,10 +1,8 @@
|
|
|
package io.legado.app.utils
|
|
package io.legado.app.utils
|
|
|
|
|
|
|
|
import android.net.Uri
|
|
import android.net.Uri
|
|
|
-import androidx.annotation.Keep
|
|
|
|
|
import java.io.File
|
|
import java.io.File
|
|
|
|
|
|
|
|
-@Keep
|
|
|
|
|
object IntentType {
|
|
object IntentType {
|
|
|
|
|
|
|
|
fun from(uri: Uri): String {
|
|
fun from(uri: Uri): String {
|
|
@@ -26,21 +24,8 @@ object IntentType {
|
|
|
"jpg", "gif", "png", "jpeg", "bmp" -> "image/*"
|
|
"jpg", "gif", "png", "jpeg", "bmp" -> "image/*"
|
|
|
"", "txt", "json", "log" -> "text/plain"
|
|
"", "txt", "json", "log" -> "text/plain"
|
|
|
"apk" -> "application/vnd.android.package-archive"
|
|
"apk" -> "application/vnd.android.package-archive"
|
|
|
- else -> appIntentType?.from(path) ?: "*/*"
|
|
|
|
|
|
|
+ else -> "*/*"
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private val appIntentType: TypeInterface? by lazy {
|
|
|
|
|
- kotlin.runCatching {
|
|
|
|
|
- Class.forName("io.legado.app.help.AppIntentType")
|
|
|
|
|
- .kotlin.objectInstance as? TypeInterface
|
|
|
|
|
- }.getOrNull()
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- interface TypeInterface {
|
|
|
|
|
-
|
|
|
|
|
- fun from(path: String?): String?
|
|
|
|
|
-
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|