优化
This commit is contained in:
@@ -436,8 +436,8 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) {
|
|||||||
FileInputStream(image).use { input ->
|
FileInputStream(image).use { input ->
|
||||||
if (uri.isContentScheme()) {
|
if (uri.isContentScheme()) {
|
||||||
DocumentFile.fromTreeUri(context, uri)?.let { doc ->
|
DocumentFile.fromTreeUri(context, uri)?.let { doc ->
|
||||||
DocumentUtils.createFileIfNotExist(doc, image.name)
|
val imageDoc = DocumentUtils.createFileIfNotExist(doc, image.name)!!
|
||||||
context.contentResolver.openOutputStream(doc.uri)!!.use { output ->
|
context.contentResolver.openOutputStream(imageDoc.uri)!!.use { output ->
|
||||||
input.copyTo(output)
|
input.copyTo(output)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user