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!!,
textPage.chapterIndex,
textChar.charData,
textChar.charData,
null,
true
)?.let {
canvas.drawBitmap(it, null, rectF, null)

@ -31,7 +31,7 @@ object ImageProvider {
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 {
return it
}
@ -48,8 +48,8 @@ object ImageProvider {
out.flush()
out.close()
}
} else if (!onUi) {
HttpHelper.getBytes(src, baseUrl)?.let {
} else if (!onUi && referrer != null) {
HttpHelper.getBytes(src, referrer)?.let {
FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it)
}
}

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

Loading…
Cancel
Save