Merge pull request #2404 from Xwite/master

优化
pull/2405/head
Xwite 2 years ago committed by GitHub
commit 09ae4c9f7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 30
      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 nextPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.NEXT) } }
private val prevPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.PREV) } } private val prevPageRunnable by lazy { Runnable { mouseWheelPage(PageDirection.PREV) } }
//恢复跳转前进度对话框的交互结果
private var confirmRestoreProcess: Boolean? = null
@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
override fun onActivityCreated(savedInstanceState: Bundle?) { override fun onActivityCreated(savedInstanceState: Bundle?) {
super.onActivityCreated(savedInstanceState) super.onActivityCreated(savedInstanceState)
@ -497,7 +500,8 @@ class ReadBookActivity : BaseReadBookActivity(),
restoreLastBookProcess() restoreLastBookProcess()
return true return true
} }
if (ReadBook.lastBookPress != null) { //拦截返回供恢复阅读进度
if (ReadBook.lastBookPress != null && confirmRestoreProcess != false) {
restoreLastBookProcess() restoreLastBookProcess()
return true return true
} }
@ -997,13 +1001,23 @@ class ReadBookActivity : BaseReadBookActivity(),
/* 恢复到 全文搜索/进度条跳转前的位置 */ /* 恢复到 全文搜索/进度条跳转前的位置 */
private fun restoreLastBookProcess() { private fun restoreLastBookProcess() {
// 默认提示恢复 // 默认提示恢复
alert(R.string.draw) { if (confirmRestoreProcess == true) {
setMessage(R.string.restore_last_book_process) ReadBook.restoreLastBookProcess()
yesButton { } else {
ReadBook.restoreLastBookProcess() //恢复启动全文搜索前的进度 alert(R.string.draw) {
} setMessage(R.string.restore_last_book_process)
noButton { yesButton {
ReadBook.lastBookPress = null confirmRestoreProcess = true
ReadBook.restoreLastBookProcess() //恢复启动全文搜索前的进度
}
noButton {
ReadBook.lastBookPress = null
confirmRestoreProcess = false
}
onCancelled {
ReadBook.lastBookPress = null
confirmRestoreProcess = false
}
} }
} }
} }

Loading…
Cancel
Save