|
|
@ -103,11 +103,8 @@ object FileUtils { |
|
|
|
val id = DocumentsContract.getDocumentId(uri) |
|
|
|
val id = DocumentsContract.getDocumentId(uri) |
|
|
|
val split = id.split(":").dropLastWhile { it.isEmpty() }.toTypedArray() |
|
|
|
val split = id.split(":").dropLastWhile { it.isEmpty() }.toTypedArray() |
|
|
|
val type = split[0] |
|
|
|
val type = split[0] |
|
|
|
if ("raw".equals( |
|
|
|
if ("raw".equals(type, ignoreCase = true)) { |
|
|
|
type, |
|
|
|
//处理某些机型(比如Google Pixel )ID是raw:/storage/emulated/0/Download/c20f8664da05ab6b4644913048ea8c83.mp4 |
|
|
|
ignoreCase = true |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
) { //处理某些机型(比如Goole Pixel )ID是raw:/storage/emulated/0/Download/c20f8664da05ab6b4644913048ea8c83.mp4 |
|
|
|
|
|
|
|
return split[1] |
|
|
|
return split[1] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -135,14 +132,11 @@ object FileUtils { |
|
|
|
}// MediaProvider |
|
|
|
}// MediaProvider |
|
|
|
// DownloadsProvider |
|
|
|
// DownloadsProvider |
|
|
|
} else if ("content".equals(uri.scheme, ignoreCase = true)) { |
|
|
|
} else if ("content".equals(uri.scheme, ignoreCase = true)) { |
|
|
|
|
|
|
|
|
|
|
|
// Return the remote address |
|
|
|
// Return the remote address |
|
|
|
return if (isGooglePhotosUri(uri)) uri.lastPathSegment else getDataColumn( |
|
|
|
return if (isGooglePhotosUri(uri)) |
|
|
|
context, |
|
|
|
uri.lastPathSegment |
|
|
|
uri, |
|
|
|
else |
|
|
|
null, |
|
|
|
getDataColumn(context, uri, null, null) |
|
|
|
null |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else if ("file".equals(uri.scheme, ignoreCase = true)) { |
|
|
|
} else if ("file".equals(uri.scheme, ignoreCase = true)) { |
|
|
|
return uri.path |
|
|
|
return uri.path |
|
|
|