pull/32/head
kunfei 5 years ago
parent 14f9beec81
commit 70e6b759ad
  1. 28
      app/src/main/java/io/legado/app/help/ActivityHelp.kt

@ -9,10 +9,18 @@ import java.util.*
*/
object ActivityHelp {
private var activities: MutableList<WeakReference<Activity>> = arrayListOf()
private val activities: MutableList<WeakReference<Activity>> = arrayListOf()
fun getActivities(): List<WeakReference<Activity>> {
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
}
}
Loading…
Cancel
Save