parent
c343fb9d28
commit
0c48dcf06c
11 changed files with 209 additions and 58 deletions
|
@ -34,20 +34,20 @@ fun View.visible(visible: Boolean, or: Int = View.GONE) {
|
|||
}
|
||||
|
||||
open class DefaultTextWatcher : TextWatcher {
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
override fun afterTextChanged(s: Editable) {
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
override fun beforeTextChanged(s: CharSequence, start: Int, count: Int, after: Int) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
}
|
||||
}
|
||||
|
||||
inline fun EditText.onTextChanged(
|
||||
crossinline callback: (s: CharSequence?, start: Int, before: Int, count: Int) -> Unit) {
|
||||
crossinline callback: (s: CharSequence, start: Int, before: Int, count: Int) -> Unit) {
|
||||
addTextChangedListener(object : DefaultTextWatcher() {
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
override fun onTextChanged(s: CharSequence, start: Int, before: Int, count: Int) {
|
||||
callback(s, start, before, count)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue