From 2cd4ed61c7f70abf82e43927264572c733ea70bb Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 1 May 2022 00:41:08 +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 --- .../java/io/legado/app/api/controller/BookController.kt | 2 +- .../io/legado/app/ui/book/read/page/ContentTextView.kt | 3 +-- .../app/ui/book/read/page/provider/ImageProvider.kt | 8 ++------ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/app/src/main/java/io/legado/app/api/controller/BookController.kt b/app/src/main/java/io/legado/app/api/controller/BookController.kt index 634e06484..9254585f1 100644 --- a/app/src/main/java/io/legado/app/api/controller/BookController.kt +++ b/app/src/main/java/io/legado/app/api/controller/BookController.kt @@ -89,7 +89,7 @@ object BookController { this.bookUrl = bookUrl val bitmap = runBlocking { ImageProvider.cacheImage(book, src, bookSource) - ImageProvider.getImage(book, src, width, bookSource = bookSource) + ImageProvider.getImage(book, src, width) } return returnData.setData(bitmap) } diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt index f62a79380..d6e498e12 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt @@ -170,8 +170,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at book, textChar.charData, (textChar.end - textChar.start).toInt(), - (lineBottom - lineTop).toInt(), - ReadBook.bookSource + (lineBottom - lineTop).toInt() ) val rectF = if (textLine.isImage) { RectF(textChar.start, lineTop, textChar.end, lineBottom) 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 c686be995..ef9d9dc6d 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 @@ -16,7 +16,6 @@ import io.legado.app.utils.BitmapUtils import io.legado.app.utils.FileUtils import io.legado.app.utils.isXml import kotlinx.coroutines.Dispatchers.IO -import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import splitties.init.appCtx import java.io.File @@ -108,14 +107,11 @@ object ImageProvider { book: Book, src: String, width: Int, - height: Int? = null, - bookSource: BookSource? = null + height: Int? = null ): Bitmap { val cacheBitmap = bitmapLruCache.get(src) if (cacheBitmap != null) return cacheBitmap - val vFile = runBlocking { - cacheImage(book, src, bookSource) - } + val vFile = BookHelp.getImage(book, src) @Suppress("BlockingMethodInNonBlockingContext") return kotlin.runCatching { val bitmap = BitmapUtils.decodeBitmap(vFile.absolutePath, width, height)