Horis 2 лет назад
Родитель
Сommit
b962e4d049

+ 2 - 1
app/src/main/java/io/legado/app/data/entities/Book.kt

@@ -309,7 +309,8 @@ data class Book(
         newBook.durChapterIndex = BookHelp
         newBook.durChapterIndex = BookHelp
             .getDurChapter(durChapterIndex, durChapterTitle, toc, totalChapterNum)
             .getDurChapter(durChapterIndex, durChapterTitle, toc, totalChapterNum)
         newBook.durChapterTitle = toc[newBook.durChapterIndex].getDisplayTitle(
         newBook.durChapterTitle = toc[newBook.durChapterIndex].getDisplayTitle(
-            ContentProcessor.get(newBook.name, newBook.origin).getTitleReplaceRules()
+            ContentProcessor.get(newBook.name, newBook.origin).getTitleReplaceRules(),
+            getUseReplaceRule()
         )
         )
         newBook.durChapterPos = durChapterPos
         newBook.durChapterPos = durChapterPos
         newBook.durChapterTime = durChapterTime
         newBook.durChapterTime = durChapterTime

+ 2 - 1
app/src/main/java/io/legado/app/model/AudioPlay.kt

@@ -167,7 +167,8 @@ object AudioPlay {
             Coroutine.async {
             Coroutine.async {
                 appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex)?.let {
                 appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex)?.let {
                     book.durChapterTitle = it.getDisplayTitle(
                     book.durChapterTitle = it.getDisplayTitle(
-                        ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
+                        ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
+                        book.getUseReplaceRule()
                     )
                     )
                 }
                 }
                 book.save()
                 book.save()

+ 2 - 1
app/src/main/java/io/legado/app/model/ReadBook.kt

@@ -530,7 +530,8 @@ object ReadBook : CoroutineScope by MainScope() {
             if (chapterChanged) {
             if (chapterChanged) {
                 appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
                 appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
                     book.durChapterTitle = it.getDisplayTitle(
                     book.durChapterTitle = it.getDisplayTitle(
-                        ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
+                        ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
+                        book.getUseReplaceRule()
                     )
                     )
                 }
                 }
             }
             }

+ 2 - 2
app/src/main/java/io/legado/app/model/webBook/BookChapterList.kt

@@ -142,9 +142,9 @@ object BookChapterList {
             }
             }
         }
         }
         val replaceRules = ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
         val replaceRules = ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
-        book.latestChapterTitle = list.last().getDisplayTitle(replaceRules)
+        book.latestChapterTitle = list.last().getDisplayTitle(replaceRules, book.getUseReplaceRule())
         book.durChapterTitle = list.getOrElse(book.durChapterIndex) { list.last() }
         book.durChapterTitle = list.getOrElse(book.durChapterIndex) { list.last() }
-            .getDisplayTitle(replaceRules)
+            .getDisplayTitle(replaceRules, book.getUseReplaceRule())
         if (book.totalChapterNum < list.size) {
         if (book.totalChapterNum < list.size) {
             book.lastCheckCount = list.size - book.totalChapterNum
             book.lastCheckCount = list.size - book.totalChapterNum
             book.latestChapterTime = System.currentTimeMillis()
             book.latestChapterTime = System.currentTimeMillis()

+ 3 - 9
app/src/main/java/io/legado/app/ui/book/info/BookInfoActivity.kt

@@ -327,15 +327,9 @@ class BookInfoActivity :
             }
             }
 
 
             else -> {
             else -> {
-                viewModel.bookData.value?.let {
-                    if (it.durChapterIndex < chapterList.size) {
-                        binding.tvToc.text =
-                            getString(R.string.toc_s, chapterList[it.durChapterIndex].title)
-                    } else {
-                        binding.tvToc.text = getString(R.string.toc_s, chapterList.last().title)
-                    }
-                    binding.tvLasted.text =
-                        getString(R.string.lasted_show, chapterList.last().title)
+                book?.let {
+                    binding.tvToc.text = getString(R.string.toc_s, it.durChapterTitle)
+                    binding.tvLasted.text = getString(R.string.lasted_show, it.latestChapterTitle)
                 }
                 }
             }
             }
         }
         }