From db97240467fbc8f11bf23c7c9949efcad4842cfc Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 18 Aug 2020 21:27:54 +0800 Subject: [PATCH] update --- .../java/io/legado/app/ui/book/read/page/ContentTextView.kt | 2 +- .../legado/app/ui/book/read/page/provider/ImageProvider.kt | 6 +++--- .../main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) 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 0c5c63aa8..bc7e8c5b6 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 @@ -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) 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 0084bfc5f..b6109e9d3 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 @@ -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) } } diff --git a/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt b/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt index c00064222..69c062295 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt @@ -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) } }