I\'m trying to use Kotlin with Butterknife for my Android Application.
Here is my build.gradle
dependencies {
...
compile \'com.jakewharton:b
You can implement some extensions to improve your views behavior. Checkout this example for "onTextChange" in a regular editText:
fun EditText.onTextChange(callback: (text: CharSequence?, start: Int, before: Int, count: Int) -> Unit) {
addTextChangedListener(object : TextWatcher {
override fun afterTextChanged(s: Editable?) {}
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
callback(s, start, before, count)
}
})
}
Usage:
m_editText.onTextChange { text, _, _, _ ->
m_textView.text = text
}
I vote for kotlin-android-extensions