pull/317/head
AndyBernie 4 years ago
parent 7c1b91cfb0
commit db97240467
  1. 2
      app/src/main/java/io/legado/app/ui/book/read/page/ContentTextView.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ImageProvider.kt
  3. 2
      app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt

@ -163,7 +163,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at
ReadBook.book!!, ReadBook.book!!,
textPage.chapterIndex, textPage.chapterIndex,
textChar.charData, textChar.charData,
textChar.charData, null,
true 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, baseUrl: String, onUi: Boolean = false): Bitmap? { fun getImage(book: Book, chapterIndex: Int, src: String, referrer: String?, onUi: Boolean = false): Bitmap? {
getCache(chapterIndex, src)?.let { getCache(chapterIndex, src)?.let {
return it return it
} }
@ -48,8 +48,8 @@ object ImageProvider {
out.flush() out.flush()
out.close() out.close()
} }
} else if (!onUi) { } else if (!onUi && referrer != null) {
HttpHelper.getBytes(src, baseUrl)?.let { HttpHelper.getBytes(src, referrer)?.let {
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it)
} }
} }

@ -56,7 +56,7 @@ class PhotoDialog : BaseDialogFragment() {
val src = it.getString("src") val src = it.getString("src")
ReadBook.book?.let { book -> ReadBook.book?.let { book ->
src?.let { src?.let {
ImageProvider.getImage(book, chapterIndex, src, src)?.let { bitmap -> ImageProvider.getImage(book, chapterIndex, src, null)?.let { bitmap ->
photo_view.setImageBitmap(bitmap) photo_view.setImageBitmap(bitmap)
} }
} }

Loading…
Cancel
Save