From b5523f377eac180b83f4b6f0c489b11ddaeaa8b0 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 7 Dec 2022 19:59:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/legado/app/ui/book/toc/TocActivity.kt | 11 +++++++---- .../java/io/legado/app/ui/book/toc/TocViewModel.kt | 4 ---- 2 files changed, 7 insertions(+), 8 deletions(-) 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 {