优化
This commit is contained in:
@@ -173,6 +173,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
private var pageChanged = false
|
private var pageChanged = false
|
||||||
private var reloadContent = false
|
private var reloadContent = false
|
||||||
private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } }
|
private val autoPageRenderer by lazy { SyncedRenderer { doAutoPage(it) } }
|
||||||
|
private var autoPageScrollOffset = 0.0
|
||||||
|
|
||||||
//恢复跳转前进度对话框的交互结果
|
//恢复跳转前进度对话框的交互结果
|
||||||
private var confirmRestoreProcess: Boolean? = null
|
private var confirmRestoreProcess: Boolean? = null
|
||||||
@@ -969,6 +970,7 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun autoPagePlus() {
|
private fun autoPagePlus() {
|
||||||
|
autoPageScrollOffset = 0.0
|
||||||
autoPageRenderer.start()
|
autoPageRenderer.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -981,7 +983,12 @@ class ReadBookActivity : BaseReadBookActivity(),
|
|||||||
}
|
}
|
||||||
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
|
val readTime = ReadBookConfig.autoReadSpeed * 1000.0
|
||||||
val height = binding.readView.height
|
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) {
|
if (binding.readView.isScroll) {
|
||||||
binding.readView.curPage.scroll(-scrollOffset)
|
binding.readView.curPage.scroll(-scrollOffset)
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -324,7 +324,7 @@ class BackupConfigFragment : PreferenceFragment(),
|
|||||||
}.onError {
|
}.onError {
|
||||||
AppLog.put("备份出错\n${it.localizedMessage}", it)
|
AppLog.put("备份出错\n${it.localizedMessage}", it)
|
||||||
appCtx.toastOnUi(appCtx.getString(R.string.backup_fail, it.localizedMessage))
|
appCtx.toastOnUi(appCtx.getString(R.string.backup_fail, it.localizedMessage))
|
||||||
}.onFinally(Main) {
|
}.onFinally {
|
||||||
waitDialog.dismiss()
|
waitDialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -342,6 +342,9 @@ class BackupConfigFragment : PreferenceFragment(),
|
|||||||
showRestoreDialog(requireContext())
|
showRestoreDialog(requireContext())
|
||||||
}.onError {
|
}.onError {
|
||||||
AppLog.put("恢复备份出错WebDavError\n${it.localizedMessage}", it)
|
AppLog.put("恢复备份出错WebDavError\n${it.localizedMessage}", it)
|
||||||
|
if (context == null) {
|
||||||
|
return@onError
|
||||||
|
}
|
||||||
alert {
|
alert {
|
||||||
setTitle(R.string.restore)
|
setTitle(R.string.restore)
|
||||||
setMessage("WebDavError\n${it.localizedMessage}\n将从本地备份恢复。")
|
setMessage("WebDavError\n${it.localizedMessage}\n将从本地备份恢复。")
|
||||||
@@ -350,7 +353,7 @@ class BackupConfigFragment : PreferenceFragment(),
|
|||||||
}
|
}
|
||||||
cancelButton()
|
cancelButton()
|
||||||
}
|
}
|
||||||
}.onFinally(Main) {
|
}.onFinally {
|
||||||
waitDialog.dismiss()
|
waitDialog.dismiss()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -387,7 +390,7 @@ class BackupConfigFragment : PreferenceFragment(),
|
|||||||
}.onError {
|
}.onError {
|
||||||
AppLog.put("WebDav恢复出错\n${it.localizedMessage}", it)
|
AppLog.put("WebDav恢复出错\n${it.localizedMessage}", it)
|
||||||
appCtx.toastOnUi("WebDav恢复出错\n${it.localizedMessage}")
|
appCtx.toastOnUi("WebDav恢复出错\n${it.localizedMessage}")
|
||||||
}.onFinally(Main) {
|
}.onFinally {
|
||||||
waitDialog.dismiss()
|
waitDialog.dismiss()
|
||||||
}
|
}
|
||||||
waitDialog.setOnCancelListener {
|
waitDialog.setOnCancelListener {
|
||||||
|
|||||||
Reference in New Issue
Block a user