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

Commit 591a11a4 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix tts span on Editable" into tm-qpr-dev

parents 573c5278 8d716354
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -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());
    }