mirror of
https://github.com/gedoor/legado.git
synced 2024-07-06 23:47:49 +08:00
优化
This commit is contained in:
parent
6113bc416d
commit
bd4aa95ff5
@ -39,7 +39,14 @@ data class FileDoc(
|
||||
fun asDocumentFile(): DocumentFile? {
|
||||
if (isContentScheme) {
|
||||
return if (isDir) {
|
||||
DocumentFile.fromTreeUri(appCtx, uri)
|
||||
Class.forName("androidx.documentfile.provider.TreeDocumentFile")
|
||||
.getDeclaredConstructor(
|
||||
DocumentFile::class.java,
|
||||
Context::class.java,
|
||||
Uri::class.java
|
||||
).apply {
|
||||
isAccessible = true
|
||||
}.newInstance(null, appCtx, uri) as DocumentFile
|
||||
} else {
|
||||
DocumentFile.fromSingleUri(appCtx, uri)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user