diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt index a68d3519c..60c0c7ae7 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt @@ -131,10 +131,13 @@ class TocActivity : VMBaseActivity(), waitDialog.show() viewModel.upBookTocRule(book) { waitDialog.dismiss() - } - ReadBook.book?.let { readBook -> - if (readBook == book) { - readBook.tocUrl = tocRegex + ReadBook.book?.let { readBook -> + if (readBook == book) { + readBook.tocUrl = tocRegex + ReadBook.chapterSize = book.totalChapterNum + ReadBook.upMsg(null) + ReadBook.loadContent(resetPageOffset = true) + } } } } diff --git a/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt index 0e7ef72dd..83530381e 100644 --- a/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/toc/TocViewModel.kt @@ -6,7 +6,6 @@ import androidx.lifecycle.MutableLiveData import io.legado.app.base.BaseViewModel import io.legado.app.data.appDb import io.legado.app.data.entities.Book -import io.legado.app.model.ReadBook import io.legado.app.model.localBook.LocalBook class TocViewModel(application: Application) : BaseViewModel(application) { @@ -34,9 +33,6 @@ class TocViewModel(application: Application) : BaseViewModel(application) { appDb.bookChapterDao.delByBook(book.bookUrl) appDb.bookChapterDao.insert(*it.toTypedArray()) appDb.bookDao.update(book) - ReadBook.chapterSize = it.size - ReadBook.upMsg(null) - ReadBook.loadContent(resetPageOffset = true) } } }.onFinally {