mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 19:38:52 +01:00
Allow manual blocking of non-numeric addresses
This commit is contained in:
+9
-4
@@ -32,16 +32,21 @@ class BlockedNumberTextWatcher(
|
||||
editText.addTextChangedListener(this)
|
||||
}
|
||||
|
||||
override fun afterTextChanged(s: Editable?) = Unit
|
||||
override fun afterTextChanged(s: Editable?) {
|
||||
editText.removeTextChangedListener(this)
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
val formatted = s?.let(phoneNumberUtils::formatNumber)
|
||||
if (s?.toString() != formatted && formatted != null) {
|
||||
editText.setText(formatted)
|
||||
editText.setSelection(formatted.length)
|
||||
}
|
||||
|
||||
editText.addTextChangedListener(this)
|
||||
}
|
||||
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
}
|
||||
|
||||
fun dispose() {
|
||||
|
||||
Reference in New Issue
Block a user