pull/1666/head
kunfei 3 years ago
parent 1afd92427c
commit 85cf6bc8df
  1. 5
      app/src/main/java/io/legado/app/model/AudioPlay.kt
  2. 5
      app/src/main/java/io/legado/app/model/ReadBook.kt

@ -10,6 +10,7 @@ import io.legado.app.data.appDb
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.data.entities.BookChapter import io.legado.app.data.entities.BookChapter
import io.legado.app.data.entities.BookSource import io.legado.app.data.entities.BookSource
import io.legado.app.help.ContentProcessor
import io.legado.app.help.coroutine.Coroutine import io.legado.app.help.coroutine.Coroutine
import io.legado.app.service.AudioPlayService import io.legado.app.service.AudioPlayService
import io.legado.app.utils.postEvent import io.legado.app.utils.postEvent
@ -148,7 +149,9 @@ object AudioPlay {
book.durChapterTime = System.currentTimeMillis() book.durChapterTime = System.currentTimeMillis()
Coroutine.async { Coroutine.async {
appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex)?.let { appDb.bookChapterDao.getChapter(book.bookUrl, book.durChapterIndex)?.let {
book.durChapterTitle = it.title book.durChapterTitle = it.getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
} }
book.save() book.save()
} }

@ -25,7 +25,6 @@ import kotlinx.coroutines.delay
import splitties.init.appCtx import splitties.init.appCtx
@Suppress("MemberVisibilityCanBePrivate") @Suppress("MemberVisibilityCanBePrivate")
object ReadBook : CoroutineScope by MainScope() { object ReadBook : CoroutineScope by MainScope() {
var book: Book? = null var book: Book? = null
@ -422,7 +421,9 @@ object ReadBook : CoroutineScope by MainScope() {
book.durChapterIndex = durChapterIndex book.durChapterIndex = durChapterIndex
book.durChapterPos = durChapterPos book.durChapterPos = durChapterPos
appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let { appDb.bookChapterDao.getChapter(book.bookUrl, durChapterIndex)?.let {
book.durChapterTitle = it.title book.durChapterTitle = it.getDisplayTitle(
ContentProcessor.get(book.name, book.origin).getTitleReplaceRules()
)
} }
appDb.bookDao.update(book) appDb.bookDao.update(book)
} }

Loading…
Cancel
Save