Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a83901a7 authored by Moez Bhatti's avatar Moez Bhatti
Browse files

Allow manual blocking of non-numeric addresses

parent 6bd8480e
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -32,16 +32,21 @@ class BlockedNumberTextWatcher(
        editText.addTextChangedListener(this)
    }

    override fun afterTextChanged(s: Editable?) = Unit

    override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) = Unit
    override fun afterTextChanged(s: Editable?) {
        editText.removeTextChangedListener(this)

    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() {
+0 −1
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
        android:layout_height="wrap_content"
        android:background="@null"
        android:hint="@string/blocked_numbers_dialog_hint"
        android:inputType="phone"
        android:paddingStart="24dp"
        android:paddingTop="16dp"
        android:paddingEnd="24dp"