use of android.text.SpannableString in project weiciyuan by qii.
the class TimeLineUtility method buildOriWeiboSpannalString.
private static SpannableString buildOriWeiboSpannalString(MessageBean oriMsg) {
String name = "";
UserBean oriUser = oriMsg.getUser();
if (oriUser != null) {
name = oriUser.getScreen_name();
if (TextUtils.isEmpty(name)) {
name = oriUser.getId();
}
}
SpannableString value;
if (!TextUtils.isEmpty(name)) {
value = TimeLineUtility.convertNormalStringToSpannableString("@" + name + ":" + oriMsg.getText());
} else {
value = TimeLineUtility.convertNormalStringToSpannableString(oriMsg.getText());
}
return value;
}
use of android.text.SpannableString in project weiciyuan by qii.
the class UpdateMessageTask method setTextViewDeleted.
private void setTextViewDeleted() {
SpannableString ss = SpannableString.valueOf(content.getText());
ss.setSpan(new StrikethroughSpan(), 0, ss.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
content.setText(ss);
}
use of android.text.SpannableString in project Libraries-for-Android-Developers by eoecn.
the class SuggestionsAdapter method formatUrl.
private CharSequence formatUrl(CharSequence url) {
if (mUrlColor == null) {
// Lazily get the URL color from the current theme.
TypedValue colorValue = new TypedValue();
mContext.getTheme().resolveAttribute(R.attr.textColorSearchUrl, colorValue, true);
mUrlColor = mContext.getResources().getColorStateList(colorValue.resourceId);
}
SpannableString text = new SpannableString(url);
text.setSpan(new TextAppearanceSpan(null, 0, 0, mUrlColor, null), 0, url.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return text;
}
use of android.text.SpannableString in project materialistic by hidroh.
the class HelpListView method makeAsteriskSpan.
private Spannable makeAsteriskSpan() {
SpannableString sb = new SpannableString("*");
sb.setSpan(new AsteriskSpan(getContext()), sb.length() - 1, sb.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return sb;
}
use of android.text.SpannableString in project zxingfragmentlib by mitoyarzun.
the class SearchBookContentsListItem method set.
public void set(SearchBookContentsResult result) {
pageNumberView.setText(result.getPageNumber());
String snippet = result.getSnippet();
if (snippet.isEmpty()) {
snippetView.setText("");
} else {
if (result.getValidSnippet()) {
String lowerQuery = SearchBookContentsResult.getQuery().toLowerCase(Locale.getDefault());
String lowerSnippet = snippet.toLowerCase(Locale.getDefault());
Spannable styledSnippet = new SpannableString(snippet);
StyleSpan boldSpan = new StyleSpan(Typeface.BOLD);
int queryLength = lowerQuery.length();
int offset = 0;
while (true) {
int pos = lowerSnippet.indexOf(lowerQuery, offset);
if (pos < 0) {
break;
}
styledSnippet.setSpan(boldSpan, pos, pos + queryLength, 0);
offset = pos + queryLength;
}
snippetView.setText(styledSnippet);
} else {
// This may be an error message, so don't try to bold the query terms within it
snippetView.setText(snippet);
}
}
}
Aggregations