pull/2729/head
kunfei 2 years ago
parent f315265309
commit ece0c65612
  1. 7
      app/src/app/java/io/legado/app/help/IntentType.kt
  2. 28
      app/src/google/java/io/legado/app/help/IntentType.kt
  3. 2
      app/src/main/java/io/legado/app/service/DownloadService.kt
  4. 1
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt

@ -1,21 +1,20 @@
package io.legado.app.utils
package io.legado.app.help
import android.net.Uri
import androidx.annotation.Keep
import java.io.File
@Keep
object IntentType {
@JvmStatic
fun from(uri: Uri): String? {
return from(uri.toString())
}
@JvmStatic
fun from(file: File): String? {
return from(file.absolutePath)
}
@JvmStatic
fun from(path: String?): String? {
return when (path?.substringAfterLast(".")?.lowercase()) {
"apk" -> "application/vnd.android.package-archive"

@ -0,0 +1,28 @@
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
}
}
}

@ -12,7 +12,7 @@ import io.legado.app.R
import io.legado.app.base.BaseService
import io.legado.app.constant.AppConst
import io.legado.app.constant.IntentAction
import io.legado.app.utils.IntentType
import io.legado.app.help.IntentType
import io.legado.app.utils.openFileUri
import io.legado.app.utils.servicePendingIntent
import io.legado.app.utils.toastOnUi

@ -29,6 +29,7 @@ import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel
import io.legado.app.R
import io.legado.app.constant.AppConst
import io.legado.app.help.IntentHelp
import io.legado.app.help.IntentType
import splitties.systemservices.clipboardManager
import splitties.systemservices.connectivityManager
import java.io.File

Loading…
Cancel
Save