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

Commit 2d52f464 authored by Daisuke Miyakawa's avatar Daisuke Miyakawa
Browse files

Suppress tts on every digits change

Bug: 5276023
Change-Id: Ieceff291bd7dc55e20a4c76992451745acdcb09b
parent e3f470be
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.graphics.Rect;
import android.text.InputType;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.accessibility.AccessibilityEvent;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;

@@ -54,4 +55,14 @@ public class DigitsEditText extends EditText {
        }
        return ret;
    }

    @Override
    public void sendAccessibilityEventUnchecked(AccessibilityEvent event) {
        if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED) {
            // AsYouTypeFormatter frequently replaces digits with formatted ones, which makes
            // tts too verbose. Let's ignore the whole event.
            return;
        }
        super.sendAccessibilityEventUnchecked(event);
    }
}
 No newline at end of file