Search in sources :

Example 1 with Spannable

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);
}
Also used : ForegroundColorSpan(android.text.style.ForegroundColorSpan) Spannable(android.text.Spannable)

Example 2 with Spannable

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;
}
Also used : SpannableString(android.text.SpannableString) ForegroundColorSpan(android.text.style.ForegroundColorSpan) Spannable(android.text.Spannable)

Example 3 with Spannable

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());
}
Also used : Spannable(android.text.Spannable) SpannableStringBuilder(android.text.SpannableStringBuilder)

Example 4 with Spannable

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);
}
Also used : PreprocessedTextData(im.actor.sdk.controllers.conversation.messages.content.preprocessor.PreprocessedTextData) Spannable(android.text.Spannable)

Example 5 with Spannable

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();
}
Also used : SpannableString(android.text.SpannableString) UserSpan(im.actor.sdk.controllers.compose.view.UserSpan) SpannableString(android.text.SpannableString) Spannable(android.text.Spannable)

Aggregations

Spannable (android.text.Spannable)484 SpannableString (android.text.SpannableString)143 Paint (android.graphics.Paint)133 TextPaint (android.text.TextPaint)118 TextView (android.widget.TextView)63 View (android.view.View)58 ForegroundColorSpan (android.text.style.ForegroundColorSpan)52 Editable (android.text.Editable)48 StyleSpan (android.text.style.StyleSpan)46 SpannableStringBuilder (android.text.SpannableStringBuilder)40 Spanned (android.text.Spanned)38 Intent (android.content.Intent)36 InputMethodManager (android.view.inputmethod.InputMethodManager)34 SuggestionSpan (android.text.style.SuggestionSpan)29 ClickableSpan (android.text.style.ClickableSpan)26 URLSpan (android.text.style.URLSpan)25 AlertDialog (android.app.AlertDialog)18 SuppressLint (android.annotation.SuppressLint)17 Date (java.util.Date)17 TextAppearanceSpan (android.text.style.TextAppearanceSpan)16