From f0ee3e41ba5aa97dd1e36491b114c91405ef4246 Mon Sep 17 00:00:00 2001 From: gedoor Date: Sun, 9 Jan 2022 22:49:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../legado/app/ui/association/FileAssociationActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt index bf28c0ea2..fafe2b2a9 100644 --- a/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt +++ b/app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt @@ -107,6 +107,14 @@ class FileAssociationActivity : val name = bookDoc?.name!! val doc = treeDoc!!.findFile(name) if (doc != null) { + if (bookDoc.lastModified() > doc.lastModified()) { + contentResolver.openOutputStream(doc.uri)!!.use { oStream -> + contentResolver.openInputStream(bookDoc.uri)!!.use { iStream -> + iStream.copyTo(oStream) + oStream.flush() + } + } + } viewModel.importBook(doc.uri) } else { val nDoc = treeDoc.createFile(FileUtils.getMimeType(name), name)!!