From 70e6b759adf0c303fc9501db39a0ec58a4ec1935 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 2 Sep 2019 11:52:51 +0800 Subject: [PATCH] up --- .../java/io/legado/app/help/ActivityHelp.kt | 28 ++++++++----------- 1 file changed, 11 insertions(+), 17 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 709bdd305..8c85fe618 100644 --- a/app/src/main/java/io/legado/app/help/ActivityHelp.kt +++ b/app/src/main/java/io/legado/app/help/ActivityHelp.kt @@ -9,10 +9,18 @@ import java.util.* */ object ActivityHelp { - private var activities: MutableList> = arrayListOf() + private val activities: MutableList> = arrayListOf() - fun getActivities(): List> { - return activities + /** + * 判断指定Activity是否存在 + */ + fun isExist(activityClass: Class<*>): Boolean { + for (item in activities) { + if (item.get()?.javaClass == activityClass) { + return true + } + } + return false } /** @@ -74,18 +82,4 @@ object ActivityHelp { } } - /** - * 判断指定Activity是否存在 - */ - fun isExist(activityClass: Class<*>): Boolean { - var result = false - for (item in activities) { - if (item.get()?.javaClass == activityClass) { - result = true - break - } - } - return result - } - } \ No newline at end of file