Skip to content

Commit

Permalink
Call listeners when installing RootViewsSpy
Browse files Browse the repository at this point in the history
  • Loading branch information
romtsn committed Mar 25, 2024
1 parent 545712c commit bee240b
Showing 1 changed file with 9 additions and 0 deletions.
Expand Up @@ -139,6 +139,15 @@ internal class RootViewsSpy private constructor() {
val listeners = CopyOnWriteArrayList<OnRootViewsChangedListener>()

private val delegatingViewList = object : ArrayList<View>() {
override fun addAll(elements: Collection<View>): Boolean {
listeners.forEach { listener ->
elements.forEach { element ->
listener.onRootViewsChanged(element, true)
}
}
return super.addAll(elements)
}

override fun add(element: View): Boolean {
listeners.forEach { it.onRootViewsChanged(element, true) }
return super.add(element)
Expand Down

0 comments on commit bee240b

Please sign in to comment.