mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-23 06:08: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)
|
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)
|
val formatted = s?.let(phoneNumberUtils::formatNumber)
|
||||||
if (s?.toString() != formatted && formatted != null) {
|
if (s?.toString() != formatted && formatted != null) {
|
||||||
editText.setText(formatted)
|
editText.setText(formatted)
|
||||||
editText.setSelection(formatted.length)
|
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() {
|
fun dispose() {
|
||||||
|
|||||||
@@ -39,7 +39,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:hint="@string/blocked_numbers_dialog_hint"
|
android:hint="@string/blocked_numbers_dialog_hint"
|
||||||
android:inputType="phone"
|
|
||||||
android:paddingStart="24dp"
|
android:paddingStart="24dp"
|
||||||
android:paddingTop="16dp"
|
android:paddingTop="16dp"
|
||||||
android:paddingEnd="24dp"
|
android:paddingEnd="24dp"
|
||||||
|
|||||||
Reference in New Issue
Block a user