From 4620bb8b28abeff359ff8627afbb076a8f8b4f18 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sun, 9 Feb 2020 14:00:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/java/io/legado/app/help/ActivityHelp.kt | 8 ++++---- .../java/io/legado/app/ui/book/read/ReadBookActivity.kt | 3 +++ .../main/java/io/legado/app/ui/welcome/WelcomeActivity.kt | 3 +-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/help/ActivityHelp.kt b/app/src/main/java/io/legado/app/help/ActivityHelp.kt index ca7c20f5f..6138c0c7e 100644 --- a/app/src/main/java/io/legado/app/help/ActivityHelp.kt +++ b/app/src/main/java/io/legado/app/help/ActivityHelp.kt @@ -19,7 +19,7 @@ object ActivityHelp { * 判断指定Activity是否存在 */ fun isExist(activityClass: Class<*>): Boolean { - for (item in activities) { + activities.forEach { item -> if (item.get()?.javaClass == activityClass) { return true } @@ -63,7 +63,7 @@ object ActivityHelp { * 关闭指定 activity */ fun finishActivity(vararg activities: Activity) { - for (activity in activities) { + activities.forEach { activity -> activity.finish() } } @@ -81,8 +81,8 @@ object ActivityHelp { } } } - for (activityWeakReference in waitFinish) { - activityWeakReference.get()?.finish() + waitFinish.forEach { + it.get()?.finish() } } 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 430aea351..7d7ef8c67 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 @@ -496,6 +496,9 @@ class ReadBookActivity : VMBaseActivity(R.layout.activity_boo } } + /** + * colorSelectDialog + */ override fun onColorSelected(dialogId: Int, color: Int) = with(ReadBookConfig.getConfig()) { when (dialogId) { TEXT_COLOR -> { diff --git a/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt b/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt index 721257bf5..4a1e12f82 100644 --- a/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/welcome/WelcomeActivity.kt @@ -30,10 +30,9 @@ class WelcomeActivity : BaseActivity(R.layout.activity_welcome) { } welAnimator.addListener(object : Animator.AnimatorListener { override fun onAnimationStart(animation: Animator) { + startActivity() if (getPrefBoolean(getString(R.string.pk_default_read))) { startActivity() - } else { - startActivity() } finish() }