From 11b1e694a4ad45854d5aa2e304325516a1b3f950 Mon Sep 17 00:00:00 2001 From: ag2s20150909 Date: Sat, 10 Apr 2021 11:41:49 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BAepub?= =?UTF-8?q?=E7=BC=BA=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/cache/CacheViewModel.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index 4554c094a..1f2d37e57 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -130,7 +130,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { val matches = AppPattern.imgPattern.toRegex().findAll(input = text) matches.forEach { matchResult -> matchResult.groupValues[1].let { - val src=NetworkUtils.getAbsoluteURL(chapter.url, it) + val src = NetworkUtils.getAbsoluteURL(chapter.url, it) srcList.add(Triple(chapter.title, index, src)) } } @@ -245,7 +245,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { content1 = contentProcessor .getContent(book, chapter.title, content1, false, useReplace) .joinToString("\n") - .replace(chapter.title, "") + .replaceFirst(chapter.title, "") epubBook.addSection( chapter.title, @@ -275,7 +275,7 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { val matches = AppPattern.imgPattern.toRegex().findAll(input = text) matches.forEach { matchResult -> matchResult.groupValues[1].let { - val src=NetworkUtils.getAbsoluteURL(chapter.url, it) + val src = NetworkUtils.getAbsoluteURL(chapter.url, it) setPic(src, book, epubBook) text1 = text1.replace(src, MD5Utils.md5Encode16(src) + ".jpg") From fc8e528e636b3845e83a79a865427f3912d29d68 Mon Sep 17 00:00:00 2001 From: ag2s20150909 Date: Sat, 10 Apr 2021 11:52:20 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=87=BAepub?= =?UTF-8?q?=E7=BC=BA=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/book/cache/CacheViewModel.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt index 1f2d37e57..55ecb17eb 100644 --- a/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/cache/CacheViewModel.kt @@ -243,10 +243,8 @@ class CacheViewModel(application: Application) : BaseViewModel(application) { BookHelp.getContent(book, chapter).let { content -> var content1 = fixPic(epubBook, book, content ?: "null", chapter) content1 = contentProcessor - .getContent(book, chapter.title, content1, false, useReplace) + .getContent(book, "", content1, false, useReplace) .joinToString("\n") - .replaceFirst(chapter.title, "") - epubBook.addSection( chapter.title, ResourceUtil.createHTMLResource(chapter.title, content1)