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)