pull/2477/head
Horis 2 years ago
parent 94761e753d
commit efe8a1b6df
  1. 23
      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 menuLayoutIsVisible get() = bottomDialog > 0 || binding.readMenu.isVisible
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 isFirstResume = true
//恢复跳转前进度对话框的交互结果 //恢复跳转前进度对话框的交互结果
private var confirmRestoreProcess: Boolean? = null private var confirmRestoreProcess: Boolean? = null
@ -180,7 +181,6 @@ class ReadBookActivity : BaseReadBookActivity(),
binding.cursorRight.setOnTouchListener(this) binding.cursorRight.setOnTouchListener(this)
window.setBackgroundDrawable(null) window.setBackgroundDrawable(null)
upScreenTimeOut() upScreenTimeOut()
ReadBook.exit()
ReadBook.callBack = this ReadBook.callBack = this
} }
@ -204,14 +204,23 @@ class ReadBookActivity : BaseReadBookActivity(),
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
ReadBook.readStartTime = System.currentTimeMillis() ReadBook.readStartTime = System.currentTimeMillis()
//web端阅读时,app处于阅读界面,本地记录会覆盖web保存的进度,在此处恢复 val bookUrl = intent.getStringExtra("bookUrl")
ReadBook.webBookProgress?.let { if (!isFirstResume && ReadBook.book?.bookUrl != bookUrl) {
ReadBook.setProgress(it) ReadBook.callBack = this
ReadBook.webBookProgress = null viewModel.initData(intent)
} else {
//web端阅读时,app处于阅读界面,本地记录会覆盖web保存的进度,在此处恢复
ReadBook.webBookProgress?.let {
ReadBook.setProgress(it)
ReadBook.webBookProgress = null
}
} }
upSystemUiVisibility() upSystemUiVisibility()
registerReceiver(timeBatteryReceiver, timeBatteryReceiver.filter) registerReceiver(timeBatteryReceiver, timeBatteryReceiver.filter)
binding.readView.upTime() binding.readView.upTime()
if (isFirstResume) {
isFirstResume = false
}
} }
override fun onPause() { override fun onPause() {
@ -1031,8 +1040,8 @@ class ReadBookActivity : BaseReadBookActivity(),
confirmRestoreProcess = false confirmRestoreProcess = false
} }
onCancelled { onCancelled {
ReadBook.lastBookPress = null ReadBook.lastBookPress = null
confirmRestoreProcess = false confirmRestoreProcess = false
} }
} }
} }

Loading…
Cancel
Save