This commit is contained in:
Horis 2023-11-05 16:07:02 +08:00
parent 912c56c33c
commit 3424ed1457
2 changed files with 14 additions and 4 deletions

View File

@ -173,6 +173,7 @@ class ReadBookActivity : BaseReadBookActivity(),
private var pageChanged = false
private var reloadContent = false
private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } }
private var autoPageScrollOffset = 0.0
//恢复跳转前进度对话框的交互结果
private var confirmRestoreProcess: Boolean? = null
@ -969,6 +970,7 @@ class ReadBookActivity : BaseReadBookActivity(),
}
private fun autoPagePlus() {
autoPageScrollOffset = 0.0
autoPageRenderer.start()
}
@ -981,7 +983,12 @@ class ReadBookActivity : BaseReadBookActivity(),
}
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
val height = binding.readView.height
val scrollOffset = (height / readTime * frameTime).toInt().coerceAtLeast(1)
autoPageScrollOffset += height / readTime * frameTime
if (autoPageScrollOffset < 1) {
return
}
val scrollOffset = autoPageScrollOffset.toInt()
autoPageScrollOffset -= scrollOffset
if (binding.readView.isScroll) {
binding.readView.curPage.scroll(-scrollOffset)
} else {

View File

@ -324,7 +324,7 @@ class BackupConfigFragment : PreferenceFragment(),
}.onError {
AppLog.put("备份出错\n${it.localizedMessage}", it)
appCtx.toastOnUi(appCtx.getString(R.string.backup_fail, it.localizedMessage))
}.onFinally(Main) {
}.onFinally {
waitDialog.dismiss()
}
}
@ -342,6 +342,9 @@ class BackupConfigFragment : PreferenceFragment(),
showRestoreDialog(requireContext())
}.onError {
AppLog.put("恢复备份出错WebDavError\n${it.localizedMessage}", it)
if (context == null) {
return@onError
}
alert {
setTitle(R.string.restore)
setMessage("WebDavError\n${it.localizedMessage}\n将从本地备份恢复。")
@ -350,7 +353,7 @@ class BackupConfigFragment : PreferenceFragment(),
}
cancelButton()
}
}.onFinally(Main) {
}.onFinally {
waitDialog.dismiss()
}
}
@ -387,7 +390,7 @@ class BackupConfigFragment : PreferenceFragment(),
}.onError {
AppLog.put("WebDav恢复出错\n${it.localizedMessage}", it)
appCtx.toastOnUi("WebDav恢复出错\n${it.localizedMessage}")
}.onFinally(Main) {
}.onFinally {
waitDialog.dismiss()
}
waitDialog.setOnCancelListener {