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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations