This commit is contained in:
Horis
2024-01-20 19:21:14 +08:00
parent a252f91fde
commit b962e4d049
5 changed files with 11 additions and 14 deletions
@@ -309,7 +309,8 @@ data class Book(
newBook.durChapterIndex = BookHelp
.getDurChapter(durChapterIndex, durChapterTitle, toc, totalChapterNum)
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.durChapterTime = durChapterTime
@@ -167,7 +167,8 @@ object AudioPlay {
Coroutine.async {
appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex)?.let {
book.durChapterTitle = it.getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
book.getUseReplaceRule()
)
}
book.save()
@@ -530,7 +530,8 @@ object ReadBook : CoroutineScope by MainScope() {
if (chapterChanged) {
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
book.durChapterTitle = it.getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules(),
book.getUseReplaceRule()
)
}
}
@@ -142,9 +142,9 @@ object BookChapterList {
}
}
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() }
.getDisplayTitle(replaceRules)
.getDisplayTitle(replaceRules, book.getUseReplaceRule())
if (book.totalChapterNum < list.size) {
book.lastCheckCount = list.size - book.totalChapterNum
book.latestChapterTime = System.currentTimeMillis()
@@ -327,15 +327,9 @@ class BookInfoActivity :
}
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)
}
}
}