From c873b72513d0c1af90c13cfbbb1ef3ccd2ea48f3 Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Mon, 12 Feb 2024 21:42:30 +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 --- .../legado/app/ui/book/read/ReadBookActivity.kt | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 68b9e481f..dd3295eb3 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -219,6 +219,7 @@ class ReadBookActivity : BaseReadBookActivity(), private val prevPageDebounce by lazy { Debounce { keyPage(PageDirection.PREV) } } private var bookChanged = false private var pageChanged = false + private var reloadContent = false private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } } private var autoPageScrollOffset = 0.0 private val handler by lazy { buildMainHandler() } @@ -267,14 +268,22 @@ class ReadBookActivity : BaseReadBookActivity(), override fun onPostCreate(savedInstanceState: Bundle?) { super.onPostCreate(savedInstanceState) viewModel.initData(intent) { - upMenu() + initDataSuccess() } } override fun onNewIntent(intent: Intent?) { super.onNewIntent(intent) viewModel.initData(intent ?: return) { - upMenu() + initDataSuccess() + } + } + + private fun initDataSuccess() { + upMenu() + if (reloadContent) { + reloadContent = false + ReadBook.loadContent(resetPageOffset = false) } } @@ -1526,6 +1535,8 @@ class ReadBookActivity : BaseReadBookActivity(), if (it) { // 更新内容排版布局 if (isInitFinish) { ReadBook.loadContent(resetPageOffset = false) + } else { + reloadContent = true } } else { readView.upContent(resetPageOffset = false)