bj0
01/22/2018, 11:51 PMactor
elizarov
01/23/2018, 7:59 AMbj0
01/23/2018, 4:48 PMonCreateView
in a Fragment
calls this extension:
inline fun <T : View> T.onClick(disableDuring: Boolean = false, noinline action: suspend T.() -> Unit) {
val actor = actor<Unit>(UI) {
for (event in channel) {
try {
if (disableDuring) isEnabled = false
action()
} finally {
if (disableDuring) isEnabled = true
}
}
}
setOnClickListener { actor.offer(Unit) }
}
bj0
01/23/2018, 4:49 PMactor
throws, and sometimes it's the arity error, sometimes it's a 'calling method on null object' error. I had copied several of them but deleted them. Whenever it happens I just gradle clean and rebuild (sometimes have to do it twice) and it works againelizarov
01/23/2018, 5:12 PMbj0
01/23/2018, 5:26 PM