From deda8c40a5fc1508c64a367f7e847bf9f114f57d Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 18 Aug 2020 09:22:51 +0800 Subject: [PATCH 1/4] Update ImageProvider.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 加入baseUrl变量申明 --- .../io/legado/app/ui/book/read/page/provider/ImageProvider.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 c5407cb1b..0084bfc5f 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, onUi: Boolean = false): Bitmap? { + fun getImage(book: Book, chapterIndex: Int, src: String, baseUrl: String, onUi: Boolean = false): Bitmap? { getCache(chapterIndex, src)?.let { return it } @@ -49,7 +49,7 @@ object ImageProvider { out.close() } } else if (!onUi) { - HttpHelper.getBytes(src, src)?.let { + HttpHelper.getBytes(src, baseUrl)?.let { FileUtils.createFileIfNotExist(vFile.absolutePath).writeBytes(it) } } From f9b566cdaf0065c167140ebd612981204e13963e Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 18 Aug 2020 09:27:50 +0800 Subject: [PATCH 2/4] Update ChapterProvider.kt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 图片链接的referer为当前章节的链接chapter.url --- .../legado/app/ui/book/read/page/provider/ChapterProvider.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index ccfe10564..c1e4bdf1e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -122,7 +122,7 @@ object ChapterProvider { imageStyle: String? ): Float { var durY = y - ImageProvider.getImage(book, chapter.index, src)?.let { + ImageProvider.getImage(book, chapter.index, src, chapter.url)?.let { if (durY > visibleHeight) { textPages.last().height = durY textPages.add(TextPage()) @@ -453,4 +453,4 @@ object ChapterProvider { val TextPaint.textHeight: Float get() = fontMetrics.descent - fontMetrics.ascent + fontMetrics.leading -} \ No newline at end of file +} From 996bf4d5589c205eb6546f256999ade54ebd78af Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 18 Aug 2020 09:32:19 +0800 Subject: [PATCH 3/4] Update ContentTextView.kt --- .../main/java/io/legado/app/ui/book/read/page/ContentTextView.kt | 1 + 1 file changed, 1 insertion(+) 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 d21988163..0c5c63aa8 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,6 +163,7 @@ class ContentTextView(context: Context, attrs: AttributeSet?) : View(context, at ReadBook.book!!, textPage.chapterIndex, textChar.charData, + textChar.charData, true )?.let { canvas.drawBitmap(it, null, rectF, null) From 9a987726eb27a3df968ed4aded98b3f7ec962562 Mon Sep 17 00:00:00 2001 From: AndyBernie Date: Tue, 18 Aug 2020 09:33:55 +0800 Subject: [PATCH 4/4] Update PhotoDialog.kt --- app/src/main/java/io/legado/app/ui/widget/dialog/PhotoDialog.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 74dfe23cd..c00064222 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)?.let { bitmap -> + ImageProvider.getImage(book, chapterIndex, src, src)?.let { bitmap -> photo_view.setImageBitmap(bitmap) } }