From e9de5eb85788446e31a8aae09c43025a52b12385 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 18 Mar 2022 15:38:25 +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 --- .../io/legado/app/ui/book/read/ReadBookViewModel.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt index c77dc24b2..7a1a6adb8 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookViewModel.kt @@ -192,6 +192,18 @@ class ReadBookViewModel(application: Application) : BaseViewModel(application) { book.durChapterTitle = chapters[book.durChapterIndex].getDisplayTitle( ContentProcessor.get(book.name, book.origin).getTitleReplaceRules() ) + ensureActive() + val nextChapter = chapters.getOrElse(book.durChapterIndex) { + chapters.first() + } + WebBook.getContentAwait( + this, + bookSource = source, + book = book, + bookChapter = chapters[book.durChapterIndex], + nextChapterUrl = nextChapter.url + ) + ensureActive() oldBook.changeTo(book) appDb.bookChapterDao.insert(*chapters.toTypedArray()) ReadBook.resetData(book)