Closed qhy040404 closed 7 months ago
While using lambda to add listener in Kotlin, it seems that the listener cannot be removed in this case.
For example,
Shizuku.addRequestPermissionResultListener { _, _ -> doSomething() }
There is no way to remove this particular listener. Since I only added this one listener, it would be better to remove them all at once.
Maybe we can add a function named removeAllListeners in a easy case.
removeAllListeners
public static void removeAllListeners() { RECEIVED_LISTENERS.clear(); DEAD_LISTENERS.clear(); PERMISSION_LISTENERS.clear(); }
or divide this function into 3 cases
While using lambda to add listener in Kotlin, it seems that the listener cannot be removed in this case.
For example,
There is no way to remove this particular listener. Since I only added this one listener, it would be better to remove them all at once.
Maybe we can add a function named
removeAllListeners
in a easy case.or divide this function into 3 cases