From 48b5320981b4dbb4b311f2253f1dfd78568a93db Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 26 Mar 2021 13:11:23 +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 --- .../app/model/localBook/{EPUBFile.kt => EpubFile.kt} | 8 ++++---- .../main/java/io/legado/app/model/localBook/LocalBook.kt | 6 +++--- .../app/ui/book/read/page/provider/ImageProvider.kt | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) rename app/src/main/java/io/legado/app/model/localBook/{EPUBFile.kt => EpubFile.kt} (98%) diff --git a/app/src/main/java/io/legado/app/model/localBook/EPUBFile.kt b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt similarity index 98% rename from app/src/main/java/io/legado/app/model/localBook/EPUBFile.kt rename to app/src/main/java/io/legado/app/model/localBook/EpubFile.kt index 680887e98..c8cb1e297 100644 --- a/app/src/main/java/io/legado/app/model/localBook/EPUBFile.kt +++ b/app/src/main/java/io/legado/app/model/localBook/EpubFile.kt @@ -26,15 +26,15 @@ import java.util.* import java.util.zip.ZipEntry import java.util.zip.ZipInputStream -class EPUBFile(var book: Book) { +class EpubFile(var book: Book) { companion object { - private var eFile: EPUBFile? = null + private var eFile: EpubFile? = null @Synchronized - private fun getEFile(book: Book): EPUBFile { + private fun getEFile(book: Book): EpubFile { if (eFile == null || eFile?.book?.bookUrl != book.bookUrl) { - eFile = EPUBFile(book) + eFile = EpubFile(book) return eFile!! } eFile?.book = book diff --git a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt index e65eaa7b1..19e293b2b 100644 --- a/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt +++ b/app/src/main/java/io/legado/app/model/localBook/LocalBook.kt @@ -22,7 +22,7 @@ object LocalBook { fun getChapterList(book: Book): ArrayList { return if (book.isEpub()) { - EPUBFile.getChapterList(book) + EpubFile.getChapterList(book) } else { AnalyzeTxtFile().analyze(book) } @@ -30,7 +30,7 @@ object LocalBook { fun getContext(book: Book, chapter: BookChapter): String? { return if (book.isEpub()) { - EPUBFile.getContent(book, chapter) + EpubFile.getContent(book, chapter) } else { AnalyzeTxtFile.getContent(book, chapter) } @@ -83,7 +83,7 @@ object LocalBook { "${MD5Utils.md5Encode16(path)}.jpg" ) ) - if (book.isEpub()) EPUBFile.upBookInfo(book) + if (book.isEpub()) EpubFile.upBookInfo(book) appDb.bookDao.insert(book) return book } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt index c124d48a6..88bea027c 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt @@ -3,7 +3,7 @@ package io.legado.app.ui.book.read.page.provider import android.graphics.Bitmap import io.legado.app.data.entities.Book import io.legado.app.help.BookHelp -import io.legado.app.model.localBook.EPUBFile +import io.legado.app.model.localBook.EpubFile import io.legado.app.utils.BitmapUtils import io.legado.app.utils.FileUtils import kotlinx.coroutines.runBlocking @@ -36,7 +36,7 @@ object ImageProvider { val vFile = BookHelp.getImage(book, src) if (!vFile.exists()) { if (book.isEpub()) { - EPUBFile.getImage(book, src)?.use { input -> + EpubFile.getImage(book, src)?.use { input -> val newFile = FileUtils.createFileIfNotExist(vFile.absolutePath) FileOutputStream(newFile).use { output -> input.copyTo(output)