hello , I was looking into `butterknife' and it seems like the view binding can be replace with
Kotlin Android Extensions
, but is there a way to replace also the annotation
@OnClick
for example ?
🚫 1
g
gildor
04/17/2018, 1:42 AM
Just do that manually:
Copy code
import kotlinx.android.synthetic.main.button
fun onViewCreated() {
button.setOnClickListener {
toast("Clicked!")
}
}
👍 2
l
ltm150895
04/17/2018, 1:43 AM
Thanks , suspected that just wanted to confirm
k
kenkyee
04/18/2018, 7:00 AM
Be aware that butterknife click handling debounces as well...
l
ltm150895
04/19/2018, 12:13 AM
does that mean that detects two clicks or something like that ?
ltm150895
04/19/2018, 12:13 AM
thanks for the tip in advance
g
gildor
04/19/2018, 12:21 AM
On android you can click twice if will be fast enough.
But you can do exactly the same denounce approach as Butter knife, just write extension function for that