Search in sources :

Example 21 with SpannableString

use of android.text.SpannableString in project CircleDemo by Naoki2015.

the class PraiseListView method setClickableSpan.

@NonNull
private SpannableString setClickableSpan(String textStr, final int position) {
    SpannableString subjectSpanText = new SpannableString(textStr);
    subjectSpanText.setSpan(new SpannableClickable(itemColor) {

        @Override
        public void onClick(View widget) {
            if (onItemClickListener != null) {
                onItemClickListener.onClick(position);
            }
        }
    }, 0, subjectSpanText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return subjectSpanText;
}
Also used : SpannableString(android.text.SpannableString) TextView(android.widget.TextView) View(android.view.View) SpannableClickable(com.yiw.circledemo.spannable.SpannableClickable) NonNull(android.support.annotation.NonNull)

Example 22 with SpannableString

use of android.text.SpannableString in project Signal-Android by WhisperSystems.

the class RecipientsEditor method contactToToken.

/*public boolean containsEmail() {
        if (TextUtils.indexOf(getText(), '@') == -1)
            return false;

        List<String> numbers = mTokenizer.getNumbers();
        for (String number : numbers) {
            if (Mms.isEmailAddress(number))
                return true;
        }
        return false;
    }*/
public static CharSequence contactToToken(Recipient c) {
    String name = c.getName();
    String number = c.getNumber();
    SpannableString s = new SpannableString(RecipientsFormatter.formatNameAndNumber(name, number));
    int len = s.length();
    if (len == 0) {
        return s;
    }
    s.setSpan(new Annotation("number", c.getNumber()), 0, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return s;
}
Also used : SpannableString(android.text.SpannableString) SpannableString(android.text.SpannableString) Annotation(android.text.Annotation)

Example 23 with SpannableString

use of android.text.SpannableString in project Signal-Android by WhisperSystems.

the class SpanUtil method italic.

public static CharSequence italic(CharSequence sequence, int length) {
    SpannableString spannable = new SpannableString(sequence);
    spannable.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannable;
}
Also used : SpannableString(android.text.SpannableString) StyleSpan(android.text.style.StyleSpan)

Example 24 with SpannableString

use of android.text.SpannableString in project Signal-Android by WhisperSystems.

the class SpanUtil method bold.

public static CharSequence bold(CharSequence sequence) {
    SpannableString spannable = new SpannableString(sequence);
    spannable.setSpan(new StyleSpan(Typeface.BOLD), 0, sequence.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    return spannable;
}
Also used : SpannableString(android.text.SpannableString) StyleSpan(android.text.style.StyleSpan)

Example 25 with SpannableString

use of android.text.SpannableString in project remusic by aa112901.

the class TintProgressDialog method handleMessage.

@Override
public boolean handleMessage(Message msg) {
    /* Update the number and percent */
    int progress = mProgress.getProgress();
    int max = mProgress.getMax();
    if (mProgressNumberFormat != null) {
        String format = mProgressNumberFormat;
        mProgressNumber.setText(String.format(format, progress, max));
    } else {
        mProgressNumber.setText("");
    }
    if (mProgressPercentFormat != null) {
        double percent = (double) progress / (double) max;
        SpannableString tmp = new SpannableString(mProgressPercentFormat.format(percent));
        tmp.setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, tmp.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        mProgressPercent.setText(tmp);
    } else {
        mProgressPercent.setText("");
    }
    return true;
}
Also used : SpannableString(android.text.SpannableString) StyleSpan(android.text.style.StyleSpan) SpannableString(android.text.SpannableString)

Aggregations

SpannableString (android.text.SpannableString)319 Spannable (android.text.Spannable)60 TextView (android.widget.TextView)60 View (android.view.View)56 StyleSpan (android.text.style.StyleSpan)53 ForegroundColorSpan (android.text.style.ForegroundColorSpan)45 TextPaint (android.text.TextPaint)25 Spanned (android.text.Spanned)22 TextAppearanceSpan (android.text.style.TextAppearanceSpan)21 Paint (android.graphics.Paint)20 ImageView (android.widget.ImageView)19 RelativeSizeSpan (android.text.style.RelativeSizeSpan)18 Bundle (android.os.Bundle)17 TypedValue (android.util.TypedValue)17 SmallTest (android.test.suitebuilder.annotation.SmallTest)16 Intent (android.content.Intent)15 SpannableStringBuilder (android.text.SpannableStringBuilder)15 ClickableSpan (android.text.style.ClickableSpan)13 URLSpan (android.text.style.URLSpan)13 LayoutInflater (android.view.LayoutInflater)13