use of android.text.Spannable in project k-9 by k9mail.
the class MessageListAdapter method formatPreviewText.
private void formatPreviewText(TextView preview, CharSequence beforePreviewText, String sigil) {
Spannable previewText = (Spannable) preview.getText();
previewText.setSpan(buildSenderSpan(), 0, beforePreviewText.length() + sigil.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
int previewSpanColor = buildPreviewSpanColor();
// Set span (color) for preview message
previewText.setSpan(new ForegroundColorSpan(previewSpanColor), beforePreviewText.length() + sigil.length(), previewText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
use of android.text.Spannable in project ZhihuDailyPurify by izzyleung.
the class IzzySearchView method getDecoratedHint.
private CharSequence getDecoratedHint(CharSequence hintText) {
Spannable ssb = new SpannableString(hintText);
//noinspection deprecation
ssb.setSpan(new ForegroundColorSpan(getResources().getColor(R.color.search_view_hint_color)), 0, hintText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
return ssb;
}
use of android.text.Spannable in project actor-platform by actorapp.
the class MessageHolder method setTimeAndReactions.
protected void setTimeAndReactions(TextView time) {
Spannable timeWithReactions = null;
if (reactions != null) {
SpannableStringBuilder builder = new SpannableStringBuilder(reactions);
timeWithReactions = builder.append(DateFormatting.formatTime(currentMessage.getDate()));
}
time.setText(timeWithReactions != null ? timeWithReactions : DateFormatting.formatTime(currentMessage.getDate()));
time.setMovementMethod(LinkMovementMethod.getInstance());
}
use of android.text.Spannable in project actor-platform by actorapp.
the class TextHolder method bindData.
@Override
protected void bindData(final Message message, long readDate, long receiveDate, boolean isUpdated, PreprocessedData preprocessedData) {
PreprocessedTextData textData = (PreprocessedTextData) preprocessedData;
Spannable reactions = preprocessedData.getReactionsSpannable();
CharSequence text;
if (textData.getSpannableString() != null) {
text = textData.getSpannableString();
} else {
text = textData.getText();
}
bindRawText(text, readDate, receiveDate, reactions, message, false);
}
use of android.text.Spannable in project actor-platform by actorapp.
the class GroupUsersFragment method updateEditText.
private void updateEditText() {
Integer[] selected = getSelected();
String src = "";
for (int i = 0; i < selected.length; i++) {
src += "!";
}
Spannable spannable = new SpannableString(src);
for (int i = 0; i < selected.length; i++) {
spannable.setSpan(new UserSpan(users().get(selected[i]), Screen.dp(200)), i, i + 1, Spanned.SPAN_INCLUSIVE_EXCLUSIVE);
}
searchField.removeTextChangedListener(textWatcher);
searchField.setText(spannable);
searchField.setSelection(spannable.length());
searchField.addTextChangedListener(textWatcher);
filter("");
getAdapter().notifyDataSetChanged();
}
Aggregations