From 1fbcc92dafe621e497becc6d6bc6ae2d2521c90d Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 27 May 2022 20:26:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 4 ++++ .../main/java/io/legado/app/data/entities/BookSource.kt | 4 ++++ .../io/legado/app/data/entities/rule/BookInfoRule.kt | 3 ++- .../app/ui/book/source/edit/BookSourceEditActivity.kt | 9 +++++++-- app/src/main/java/io/legado/app/ui/main/MainViewModel.kt | 2 +- app/src/main/res/values-es-rES/strings.xml | 1 + app/src/main/res/values-ja-rJP/strings.xml | 1 + app/src/main/res/values-pt-rBR/strings.xml | 1 + app/src/main/res/values-zh-rHK/strings.xml | 1 + app/src/main/res/values-zh-rTW/strings.xml | 1 + app/src/main/res/values-zh/strings.xml | 1 + app/src/main/res/values/strings.xml | 1 + 12 files changed, 25 insertions(+), 4 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index ff37c1057..97bae3252 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,6 +11,10 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2022/05/27** + +* 书源添加刷新时重新获取目录页链接Url的配置 + **2022/05/26** * 修复部分txt章节结尾乱码bug diff --git a/app/src/main/java/io/legado/app/data/entities/BookSource.kt b/app/src/main/java/io/legado/app/data/entities/BookSource.kt index db51308a5..ea04ed64b 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookSource.kt @@ -143,6 +143,10 @@ data class BookSource( fun getContentRule() = ruleContent ?: ContentRule() + fun isReGetTocUrlOnRefresh(): Boolean { + return ruleBookInfo?.reGetTocUrlOnRefresh.isTrue() + } + fun getDisPlayNameGroup(): String { return if (bookSourceGroup.isNullOrBlank()) { bookSourceName diff --git a/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt index cddba2c4f..81e147a20 100644 --- a/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt +++ b/app/src/main/java/io/legado/app/data/entities/rule/BookInfoRule.kt @@ -17,5 +17,6 @@ data class BookInfoRule( var tocUrl: String? = null, var wordCount: String? = null, var canReName: String? = null, - var downloadUrls: String? = null + var downloadUrls: String? = null, + var reGetTocUrlOnRefresh: String? = null ) : Parcelable \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index ed991ff58..c0b44a17e 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -217,7 +217,9 @@ class BookSourceEditActivity : add(EditEntity("header", source?.header, R.string.source_http_header)) add( EditEntity( - "concurrentRate", source?.concurrentRate, R.string.source_concurrent_rate + "concurrentRate", + source?.concurrentRate, + R.string.source_concurrent_rate ) ) } @@ -267,6 +269,7 @@ class BookSourceEditActivity : add(EditEntity("tocUrl", ir?.tocUrl, R.string.rule_toc_url)) add(EditEntity("canReName", ir?.canReName, R.string.rule_can_re_name)) add(EditEntity("downloadUrls", ir?.downloadUrls, R.string.download_url_rule)) + add(EditEntity("reGetTocUrl", ir?.reGetTocUrlOnRefresh, R.string.rule_re_get_toc_url)) } //目录页 val tr = source?.getTocRule() @@ -397,7 +400,9 @@ class BookSourceEditActivity : "tocUrl" -> bookInfoRule.tocUrl = viewModel.ruleComplete(it.value, bookInfoRule.init, 2) "canReName" -> bookInfoRule.canReName = it.value - "downloadUrls" -> bookInfoRule.downloadUrls = viewModel.ruleComplete(it.value, bookInfoRule.init) + "downloadUrls" -> bookInfoRule.downloadUrls = + viewModel.ruleComplete(it.value, bookInfoRule.init) + "reGetTocUrl" -> bookInfoRule.reGetTocUrlOnRefresh = it.value } } tocEntities.forEach { diff --git a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt index 06022a617..0da137f7c 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainViewModel.kt @@ -116,7 +116,7 @@ class MainViewModel(application: Application) : BaseViewModel(application) { onUpTocBooks.add(book.bookUrl) postEvent(EventBus.UP_BOOKSHELF, book.bookUrl) execute(context = upTocPool) { - if (book.tocUrl.isBlank()) { + if (book.tocUrl.isBlank() || source.isReGetTocUrlOnRefresh()) { WebBook.getBookInfoAwait(this, source, book) } val toc = WebBook.getChapterListAwait(this, source, book).getOrThrow() diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index 310ecd7f4..f463d99ab 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -416,6 +416,7 @@ Volume mark(isVolume) VIP标识(isVip) 更新时间(ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文规则(content) 正文下一页URL规则(nextContentUrl) WebViewJs(webJs) diff --git a/app/src/main/res/values-ja-rJP/strings.xml b/app/src/main/res/values-ja-rJP/strings.xml index 68498160f..cfc19c003 100644 --- a/app/src/main/res/values-ja-rJP/strings.xml +++ b/app/src/main/res/values-ja-rJP/strings.xml @@ -420,6 +420,7 @@ Volume mark(isVolume) VIP标识(isVip) 更新时间(ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文规则(content) 正文下一页URL规则(nextContentUrl) WebViewJs(webJs) diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index 7551b7740..36bfb527d 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -418,6 +418,7 @@ 卷标识(isVolume) VIP标识(éVip) 更新时间(capítuloInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文规则(conteúdo) 正文下一页URL规则(proxConteúdoUrl) WebViewJs(webJs) diff --git a/app/src/main/res/values-zh-rHK/strings.xml b/app/src/main/res/values-zh-rHK/strings.xml index 6d8cc2c37..7d40929fb 100644 --- a/app/src/main/res/values-zh-rHK/strings.xml +++ b/app/src/main/res/values-zh-rHK/strings.xml @@ -415,6 +415,7 @@ Volume標識(isVolume) VIP 標識 (isVip) 更新時間 (ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文規則 (content) 正文下一頁 URL 規則 (nextContentUrl) WebViewJs (webJs) diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 3952f76b2..134e22b90 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -419,6 +419,7 @@ Volume標識(isVolume) VIP標識(isVip) 更新時間(ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文規則(content) 正文下一頁URL規則(nextContentUrl) WebViewJs(webJs) diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index ca9c6c14b..5a6c7beeb 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -419,6 +419,7 @@ Volume标识(isVolume) VIP标识(isVip) 更新时间(ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文规则(content) 正文下一页URL规则(nextContentUrl) WebViewJs(webJs) diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 93c683137..1a9f867cf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -420,6 +420,7 @@ 卷标识(isVolume) VIP标识(isVip) 更新时间(ChapterInfo) + 刷新时重新获取目录Url(reGetTocUrlOnRefresh) 正文规则(content) 正文下一页URL规则(nextContentUrl) WebViewJs(webJs)