/** * Compat method for addTtsSpan, see {@link PhoneNumberUtils#addTtsSpan} */ public static void addTtsSpan(Spannable s, int start, int endExclusive) { if (CompatUtils.isMarshmallowCompatible()) { PhoneNumberUtils.addTtsSpan(s, start, endExclusive); } else { addTtsSpanInternal(s, start, endExclusive); } }
/** * Copied from {@link PhoneNumberUtils#createTtsSpannable} */ private static CharSequence createTtsSpannableInternal(CharSequence phoneNumber) { if (phoneNumber == null) { return null; } Spannable spannable = Spannable.Factory.getInstance().newSpannable(phoneNumber); addTtsSpanInternal(spannable, 0, spannable.length()); return spannable; }