From ec4c188063e5b702ae1d209e95af71467280b51e Mon Sep 17 00:00:00 2001 From: gedoor Date: Fri, 23 Jul 2021 17:21:16 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/model/analyzeRule/AnalyzeUrl.kt | 5 +++-- .../io/legado/app/ui/book/read/ReadBookActivity.kt | 12 ++++++------ 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt index a89d78ec8..d37fda70f 100644 --- a/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt +++ b/app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt @@ -117,8 +117,9 @@ class AnalyzeUrl( //替换所有内嵌{{js}} val url = analyze.innerRule("{{", "}}") { - when (val jsEval = SCRIPT_ENGINE.eval(it, bindings)) { - is String -> jsEval + val jsEval = SCRIPT_ENGINE.eval(it, bindings) ?: "" + when { + jsEval is String -> jsEval jsEval is Double && jsEval % 1.0 == 0.0 -> String.format("%.0f", jsEval) else -> jsEval.toString() } 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 354d665e9..9e4b37673 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 @@ -592,7 +592,7 @@ class ReadBookActivity : ReadBookBaseActivity(), resetPageOffset: Boolean, success: (() -> Unit)? ) { - lifecycleScope.launch { + runOnUI { autoPageProgress = 0 binding.readView.upContent(relativePosition, resetPageOffset) binding.readMenu.setSeekPage(ReadBook.durPageIndex()) @@ -605,13 +605,13 @@ class ReadBookActivity : ReadBookBaseActivity(), * 更新视图 */ override fun upView() { - lifecycleScope.launch { + runOnUI { binding.readMenu.upBookView() } } override fun upPageAnim() { - lifecycleScope.launch { + runOnUI { binding.readView.upPageAnim() } } @@ -620,11 +620,11 @@ class ReadBookActivity : ReadBookBaseActivity(), * 页面改变 */ override fun pageChanged() { - autoPageProgress = 0 - lifecycleScope.launch { + runOnUI { + autoPageProgress = 0 binding.readMenu.setSeekPage(ReadBook.durPageIndex()) + mHandler.postDelayed(backupRunnable, 600000) } - mHandler.postDelayed(backupRunnable, 600000) } /**