diff options
| author | 2022-07-08 19:05:19 +0000 | |
|---|---|---|
| committer | 2022-07-08 19:05:19 +0000 | |
| commit | 1a84c856d4633c5712f00a23518d4e6764bd10bb (patch) | |
| tree | 6d7af04ecd67907be8bd22fa5a29888dd5e494bb | |
| parent | bb2eb75354f69b92892b262eb955ea28778b178f (diff) | |
| parent | 6fba6e189cd4b6b09c1e64f3a59c3b1720f76757 (diff) | |
Merge "Fix tts span on Editable"
| -rw-r--r-- | telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java index 24dfbd028d03..a004cc3a1642 100644 --- a/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java +++ b/telephony/java/android/telephony/PhoneNumberFormattingTextWatcher.java @@ -21,6 +21,7 @@ import android.os.Build; import android.text.Editable; import android.text.Selection; import android.text.TextWatcher; +import android.text.style.TtsSpan; import com.android.i18n.phonenumbers.AsYouTypeFormatter; import com.android.i18n.phonenumbers.PhoneNumberUtil; @@ -119,6 +120,13 @@ public class PhoneNumberFormattingTextWatcher implements TextWatcher { } mSelfChange = false; } + + //remove previous TTS spans + TtsSpan[] ttsSpans = s.getSpans(0, s.length(), TtsSpan.class); + for (TtsSpan ttsSpan : ttsSpans) { + s.removeSpan(ttsSpan); + } + PhoneNumberUtils.ttsSpanAsPhoneNumber(s, 0, s.length()); } |