use of android.text.SpannableString in project Signal-Android by WhisperSystems.
the class ComposeText method setHint.
public void setHint(@NonNull String hint, @Nullable CharSequence subHint) {
this.hint = new SpannableString(hint);
this.hint.setSpan(new RelativeSizeSpan(0.8f), 0, hint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
if (subHint != null) {
this.subHint = new SpannableString(subHint);
this.subHint.setSpan(new RelativeSizeSpan(0.8f), 0, subHint.length(), Spannable.SPAN_INCLUSIVE_INCLUSIVE);
} else {
this.subHint = null;
}
if (this.subHint != null) {
super.setHint(new SpannableStringBuilder().append(ellipsizeToWidth(this.hint)).append("\n").append(ellipsizeToWidth(this.subHint)));
} else {
super.setHint(ellipsizeToWidth(this.hint));
}
}
use of android.text.SpannableString in project Signal-Android by WhisperSystems.
the class RegistrationProgressActivity method initializeLinks.
private void initializeLinks() {
TextView failureText = (TextView) findViewById(R.id.sms_failed_text);
String pretext = getString(R.string.registration_progress_activity__signal_timed_out_while_waiting_for_a_verification_sms_message);
String link = getString(R.string.RegistrationProblemsActivity_possible_problems);
SpannableString spannableString = new SpannableString(pretext + " " + link);
spannableString.setSpan(new ClickableSpan() {
@Override
public void onClick(View widget) {
new AlertDialog.Builder(RegistrationProgressActivity.this).setTitle(R.string.RegistrationProblemsActivity_possible_problems).setView(R.layout.registration_problems).setNeutralButton(android.R.string.ok, null).show();
}
}, pretext.length() + 1, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
failureText.setText(spannableString);
failureText.setMovementMethod(LinkMovementMethod.getInstance());
}
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 9GAG by Mixiaoxiao.
the class MxxBrowserActivity method setActionBarTitle.
private void setActionBarTitle(String title) {
SpannableString spannableString = new SpannableString(title);
String font = "LockScreen_Clock.ttf";
spannableString.setSpan(new TypefaceSpan(font, Typeface.createFromAsset(getAssets(), font)), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
getActionBar().setTitle(spannableString);
}
use of android.text.SpannableString in project 9GAG by Mixiaoxiao.
the class MxxTextUtil method getTypefaceSpannableString.
public static SpannableString getTypefaceSpannableString(Context context, String string, String fontName) {
SpannableString spannableString = new SpannableString(string);
spannableString.setSpan(new TypefaceSpan(fontName, Typeface.createFromAsset(context.getAssets(), fontName), false), 0, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
return spannableString;
}
Aggregations