pull/2622/head
kunfei 2 years ago
parent aa68694821
commit b5523f377e
  1. 11
      app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt
  2. 4
      app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt

@ -131,10 +131,13 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>(),
waitDialog.show() waitDialog.show()
viewModel.upBookTocRule(book) { viewModel.upBookTocRule(book) {
waitDialog.dismiss() waitDialog.dismiss()
} ReadBook.book?.let { readBook ->
ReadBook.book?.let { readBook -> if (readBook == book) {
if (readBook == book) { readBook.tocUrl = tocRegex
readBook.tocUrl = tocRegex ReadBook.chapterSize = book.totalChapterNum
ReadBook.upMsg(null)
ReadBook.loadContent(resetPageOffset = true)
}
} }
} }
} }

@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData
import io.legado.app.base.BaseViewModel import io.legado.app.base.BaseViewModel
import io.legado.app.data.appDb import io.legado.app.data.appDb
import io.legado.app.data.entities.Book import io.legado.app.data.entities.Book
import io.legado.app.model.ReadBook
import io.legado.app.model.localBook.LocalBook import io.legado.app.model.localBook.LocalBook
class TocViewModel(application: Application) : BaseViewModel(application) { class TocViewModel(application: Application) : BaseViewModel(application) {
@ -34,9 +33,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) {
appDb.bookChapterDao.delByBook(book.bookUrl) appDb.bookChapterDao.delByBook(book.bookUrl)
appDb.bookChapterDao.insert(*it.toTypedArray()) appDb.bookChapterDao.insert(*it.toTypedArray())
appDb.bookDao.update(book) appDb.bookDao.update(book)
ReadBook.chapterSize = it.size
ReadBook.upMsg(null)
ReadBook.loadContent(resetPageOffset = true)
} }
} }
}.onFinally { }.onFinally {

Loading…
Cancel
Save