From 16b20edd4c43f59ac88f76b1d174c3e8e98a1080 Mon Sep 17 00:00:00 2001 From: Xwite <1797350009@qq.com> Date: Mon, 10 Oct 2022 14:49:11 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AA=E5=BC=B9=E4=B8=80=E6=AC=A1=E6=81=A2?= =?UTF-8?q?=E5=A4=8D=E8=BF=9B=E5=BA=A6=E5=AF=B9=E8=AF=9D=E6=A1=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/ui/book/read/ReadBookActivity.kt | 30 ++++++++++++++----- 1 file changed, 22 insertions(+), 8 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 e346568bf..aa53b8c87 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,9 @@ class ReadBookActivity : BaseReadBookActivity(), private val nextPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.NEXT) } } private val prevPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.PREV) } } + //恢复跳转前进度对话框的交互结果 + private var confirmRestoreProcess: Boolean? = null + @SuppressLint("ClickableViewAccessibility") override fun onActivityCreated(savedInstanceState: Bundle?) { super.onActivityCreated(savedInstanceState) @@ -497,7 +500,8 @@ class ReadBookActivity : BaseReadBookActivity(), restoreLastBookProcess() return true } - if (ReadBook.lastBookPress != null) { + //拦截返回供恢复阅读进度 + if (ReadBook.lastBookPress != null && confirmRestoreProcess != false) { restoreLastBookProcess() return true } @@ -997,13 +1001,23 @@ class ReadBookActivity : BaseReadBookActivity(), /* 恢复到 全文搜索/进度条跳转前的位置 */ private fun restoreLastBookProcess() { // 默认提示恢复 - alert(R.string.draw) { - setMessage(R.string.restore_last_book_process) - yesButton { - ReadBook.restoreLastBookProcess() //恢复启动全文搜索前的进度 - } - noButton { - ReadBook.lastBookPress = null + if (confirmRestoreProcess == true) { + ReadBook.restoreLastBookProcess() + } else { + alert(R.string.draw) { + setMessage(R.string.restore_last_book_process) + yesButton { + confirmRestoreProcess = true + ReadBook.restoreLastBookProcess() //恢复启动全文搜索前的进度 + } + noButton { + ReadBook.lastBookPress = null + confirmRestoreProcess = false + } + onCancelled { + ReadBook.lastBookPress = null + confirmRestoreProcess = false + } } } }