From b92f1b031449e9e0a3d4e1995f33942f0145b6f8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 11 Dec 2022 22:58:02 +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 --- .../main/java/io/legado/app/help/book/ContentProcessor.kt | 4 +--- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 6 +++++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/book/ContentProcessor.kt b/app/src/main/java/io/legado/app/help/book/ContentProcessor.kt index 02e7880bc..c03848d09 100644 --- a/app/src/main/java/io/legado/app/help/book/ContentProcessor.kt +++ b/app/src/main/java/io/legado/app/help/book/ContentProcessor.kt @@ -9,7 +9,6 @@ import io.legado.app.data.entities.ReplaceRule import io.legado.app.exception.RegexTimeoutException import io.legado.app.help.config.AppConfig import io.legado.app.help.config.ReadBookConfig -import io.legado.app.utils.MD5Utils import io.legado.app.utils.replace import io.legado.app.utils.stackTraceStr import io.legado.app.utils.toastOnUi @@ -85,8 +84,7 @@ class ContentProcessor private constructor( var sameTitleRemoved = false if (content != "null") { //去除重复标题 - val key = "NRT" + MD5Utils.md5Encode(chapter.bookUrl + chapter.url) - if (appDb.cacheDao.get(key) == null) try { + try { val name = Pattern.quote(book.name) val title = Pattern.quote(chapter.title) val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)*".toRegex() diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index a2c37ec7b..d242519bb 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -262,7 +262,7 @@ class ReadBookActivity : BaseReadBookActivity(), } override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { - menu.findItem(R.id.menu_same_title_removed).isChecked = + menu.findItem(R.id.menu_same_title_removed)?.isChecked = ReadBook.curTextChapter?.sameTitleRemoved == true return super.onMenuOpened(featureId, menu) } @@ -404,6 +404,10 @@ class ReadBookActivity : BaseReadBookActivity(), sureSyncProgress(progress) } } + R.id.menu_same_title_removed -> { + val chapterUrl = ReadBook.curTextChapter?.url + MD5Utils.md5Encode(chapterUrl) + } R.id.menu_help -> showReadMenuHelp() } return super.onCompatOptionsItemSelected(item)