13 lines
513 B
Kotlin
13 lines
513 B
Kotlin
package com.simplemobiletools.contacts.extensions
|
|
|
|
import android.text.Editable
|
|
import android.text.TextWatcher
|
|
import android.widget.EditText
|
|
|
|
fun EditText.afterTextChanged(callback: (String) -> Unit) = addTextChangedListener(object : TextWatcher {
|
|
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}
|
|
|
|
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {}
|
|
|
|
override fun afterTextChanged(text: Editable) = callback(text.toString())
|
|
})
|