pull/306/head
gedoor 4 years ago
parent 32f552f2e6
commit 098d2723b6
  1. 3
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt

@ -162,7 +162,8 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
ImageProvider.getImage( ImageProvider.getImage(
ReadBook.book!!, ReadBook.book!!,
textPage.chapterIndex, textPage.chapterIndex,
textChar.charData textChar.charData,
true
)?.let { )?.let {
canvas.drawBitmap(it, null, rectF, null) canvas.drawBitmap(it, null, rectF, null)
} }

@ -31,7 +31,7 @@ object ImageProvider {
indexCache[src] = bitmap indexCache[src] = bitmap
} }
fun getImage(book: Book, chapterIndex: Int, src: String): Bitmap? { fun getImage(book: Book, chapterIndex: Int, src: String, onUi: Boolean = false): Bitmap? {
getCache(chapterIndex, src)?.let { getCache(chapterIndex, src)?.let {
return it return it
} }
@ -48,7 +48,7 @@ object ImageProvider {
out.flush() out.flush()
out.close() out.close()
} }
} else { } else if (!onUi) {
HttpHelper.getBytes(src, src)?.let { HttpHelper.getBytes(src, src)?.let {
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it)
} }

Loading…
Cancel
Save