add a text change listener to the dialpad input value
This commit is contained in:
parent
47405d8775
commit
6159e55183
|
@ -9,6 +9,7 @@ import com.simplemobiletools.commons.extensions.applyColorFilter
|
|||
import com.simplemobiletools.commons.extensions.updateTextColors
|
||||
import com.simplemobiletools.commons.helpers.isLollipopPlus
|
||||
import com.simplemobiletools.contacts.R
|
||||
import com.simplemobiletools.contacts.extensions.afterTextChanged
|
||||
import com.simplemobiletools.contacts.extensions.config
|
||||
import kotlinx.android.synthetic.main.activity_dialpad.*
|
||||
|
||||
|
@ -31,6 +32,7 @@ class DialpadActivity : SimpleActivity() {
|
|||
dialpad_hashtag.setOnClickListener { dialpadPressed("#") }
|
||||
dialpad_clear_char.setOnClickListener { clearChar() }
|
||||
dialpad_clear_char.setOnLongClickListener { clearInput(); true }
|
||||
dialpad_input.afterTextChanged { dialpadValueChanged(it) }
|
||||
disableKeyboardPopping()
|
||||
}
|
||||
|
||||
|
@ -77,4 +79,8 @@ class DialpadActivity : SimpleActivity() {
|
|||
dialpad_input.inputType = InputType.TYPE_NULL
|
||||
}
|
||||
}
|
||||
|
||||
private fun dialpadValueChanged(text: String) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
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())
|
||||
})
|
Loading…
Reference in New Issue