Merge "Fix tts span on Editable" into tm-qpr-dev am: 591a11a432
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/19221090 Change-Id: I5dafdd692fe1db5b22b6c942f4e3c997b68514d3 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user