pull/2628/head
kunfei 2 years ago
parent 6ebcf0c354
commit b92f1b0314
  1. 4
      app/src/main/java/io/legado/app/help/book/ContentProcessor.kt
  2. 6
      app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt

@ -9,7 +9,6 @@ import io.legado.app.data.entities.ReplaceRule
import io.legado.app.exception.RegexTimeoutException import io.legado.app.exception.RegexTimeoutException
import io.legado.app.help.config.AppConfig import io.legado.app.help.config.AppConfig
import io.legado.app.help.config.ReadBookConfig import io.legado.app.help.config.ReadBookConfig
import io.legado.app.utils.MD5Utils
import io.legado.app.utils.replace import io.legado.app.utils.replace
import io.legado.app.utils.stackTraceStr import io.legado.app.utils.stackTraceStr
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
@ -85,8 +84,7 @@ class ContentProcessor private constructor(
var sameTitleRemoved = false var sameTitleRemoved = false
if (content != "null") { if (content != "null") {
//去除重复标题 //去除重复标题
val key = "NRT" + MD5Utils.md5Encode(chapter.bookUrl + chapter.url) try {
if (appDb.cacheDao.get(key) == null) try {
val name = Pattern.quote(book.name) val name = Pattern.quote(book.name)
val title = Pattern.quote(chapter.title) val title = Pattern.quote(chapter.title)
val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)*".toRegex() val titleRegex = "^(\\s|\\p{P}|${name})*${title}(\\s)*".toRegex()

@ -262,7 +262,7 @@ class ReadBookActivity : BaseReadBookActivity(),
} }
override fun onMenuOpened(featureId: Int, menu: Menu): Boolean { 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 ReadBook.curTextChapter?.sameTitleRemoved == true
return super.onMenuOpened(featureId, menu) return super.onMenuOpened(featureId, menu)
} }
@ -404,6 +404,10 @@ class ReadBookActivity : BaseReadBookActivity(),
sureSyncProgress(progress) sureSyncProgress(progress)
} }
} }
R.id.menu_same_title_removed -> {
val chapterUrl = ReadBook.curTextChapter?.url
MD5Utils.md5Encode(chapterUrl)
}
R.id.menu_help -> showReadMenuHelp() R.id.menu_help -> showReadMenuHelp()
} }
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)

Loading…
Cancel
Save