This commit is contained in:
kunfei
2023-01-26 12:26:40 +08:00
parent bb09e180e8
commit 05738459ae
5 changed files with 31 additions and 33 deletions
@@ -1,28 +0,0 @@
package io.legado.app.help
import android.net.Uri
import androidx.annotation.Keep
import java.io.File
@Keep
object IntentType {
fun from(uri: Uri): String? {
return from(uri.toString())
}
fun from(file: File): String? {
return from(file.absolutePath)
}
fun from(path: String?): String? {
return when (path?.substringAfterLast(".")?.lowercase()) {
"m4a", "mp3", "mid", "xmf", "ogg", "wav" -> "video/*"
"3gp", "mp4" -> "audio/*"
"jpg", "gif", "png", "jpeg", "bmp" -> "image/*"
"txt", "json" -> "text/plain"
else -> null
}
}
}