From efe8a1b6dfe107672bd14a7bea0862d9a6dc3a7b Mon Sep 17 00:00:00 2001 From: Horis <821938089@qq.com> Date: Sun, 23 Oct 2022 23:16: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 --- .../app/ui/book/read/ReadBookActivity.kt | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 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 92c6f3422..11fe4bb7e 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 @@ -167,6 +167,7 @@ class ReadBookActivity : BaseReadBookActivity(), private val menuLayoutIsVisible get() = bottomDialog > 0 || binding.readMenu.isVisible private val nextPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.NEXT) } } private val prevPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.PREV) } } + private var isFirstResume = true //恢复跳转前进度对话框的交互结果 private var confirmRestoreProcess: Boolean? = null @@ -180,7 +181,6 @@ class ReadBookActivity : BaseReadBookActivity(), binding.cursorRight.setOnTouchListener(this) window.setBackgroundDrawable(null) upScreenTimeOut() - ReadBook.exit() ReadBook.callBack = this } @@ -204,14 +204,23 @@ class ReadBookActivity : BaseReadBookActivity(), override fun onResume() { super.onResume() ReadBook.readStartTime = System.currentTimeMillis() - //web端阅读时,app处于阅读界面,本地记录会覆盖web保存的进度,在此处恢复 - ReadBook.webBookProgress?.let { - ReadBook.setProgress(it) - ReadBook.webBookProgress = null + val bookUrl = intent.getStringExtra("bookUrl") + if (!isFirstResume && ReadBook.book?.bookUrl != bookUrl) { + ReadBook.callBack = this + viewModel.initData(intent) + } else { + //web端阅读时,app处于阅读界面,本地记录会覆盖web保存的进度,在此处恢复 + ReadBook.webBookProgress?.let { + ReadBook.setProgress(it) + ReadBook.webBookProgress = null + } } upSystemUiVisibility() registerReceiver(timeBatteryReceiver, timeBatteryReceiver.filter) binding.readView.upTime() + if (isFirstResume) { + isFirstResume = false + } } override fun onPause() { @@ -1031,8 +1040,8 @@ class ReadBookActivity : BaseReadBookActivity(), confirmRestoreProcess = false } onCancelled { - ReadBook.lastBookPress = null - confirmRestoreProcess = false + ReadBook.lastBookPress = null + confirmRestoreProcess = false } } }