@Override public CharSequence getTransformation(CharSequence source, View view) { if (source == null) return null; if (source instanceof Spanned) { SpannableString string = new SpannableString(source.toString().toUpperCase(locale)); TextUtils.copySpansFrom((Spanned) source, 0, source.length(), null, string, 0); return string; } return source.toString().toUpperCase(locale); }
public CharSequence terminateToken(CharSequence text) { int i = text.length(); while (i > 0 && text.charAt(i - 1) == ' ') { i--; } if (i > 0 && text.charAt(i - 1) == ' ') { return text; } else { if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + " "); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + " "; } } } }
public CharSequence terminateToken(CharSequence text) { int i = text.length(); while (i > 0 && text.charAt(i - 1) == ' ') { i--; } if (i > 0 && text.charAt(i - 1) == ' ') { return text; } else { if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + " "); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + " "; } } } }
@Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); while (i > 0 && Character.isWhitespace(text.charAt(i - 1)) ) { i--; } if (i > 0 && Character.isWhitespace(text.charAt(i - 1)) ) { return text; } else { if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + " "); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } else { return text + " "; } } } }
@Override public CharSequence terminateToken(CharSequence text) { int i = text.length(); while (i > 0 && !isWebfingerIdChar(text, i)) { i--; } if (i > 0 && !isWebfingerIdChar(text, i)) { return text; } else if (text instanceof Spanned) { SpannableString sp = new SpannableString(text + " "); TextUtils.copySpansFrom((Spanned) text, 0, text.length(), Object.class, sp, 0); return sp; } return text + " "; }
new SpannableString(activity.getString(R.string.usb_chooser_dialog_prompt, origin)); int start = title.toString().indexOf(origin); TextUtils.copySpansFrom(originSpannableString, 0, originSpannableString.length(), Object.class, title, start);
new SpannableString(mActivity.getString(R.string.bluetooth_dialog_title, mOrigin)); int start = title.toString().indexOf(mOrigin); TextUtils.copySpansFrom(origin, 0, origin.length(), Object.class, title, start);