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 af6cbed8d..4cc9ad64c 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 @@ -96,7 +96,7 @@ object ImageProvider { book: Book, src: String, width: Int, - height: Int + height: Int? = null ): Bitmap { val cacheBitmap = bitmapLruCache.get(src) if (cacheBitmap != null) return cacheBitmap @@ -118,32 +118,4 @@ object ImageProvider { } } - /** - *获取bitmap 使用LruCache缓存 - */ - fun getImage( - book: Book, - src: String, - width: Int - ): Bitmap { - val cacheBitmap = bitmapLruCache.get(src) - if (cacheBitmap != null) return cacheBitmap - val vFile = BookHelp.getImage(book, src) - @Suppress("BlockingMethodInNonBlockingContext") - return try { - val bitmap = BitmapUtils.decodeBitmap(vFile.absolutePath, width) - bitmapLruCache.put(src, bitmap) - bitmap - } catch (e: Exception) { - Coroutine.async { - putDebug("${vFile.absolutePath} 解码失败\n$e", e) - if (FileUtils.readText(vFile.absolutePath).isXml()) { - putDebug("${vFile.absolutePath}为xml,自动删除") - vFile.delete() - } - } - errorBitmap - } - } - }