use of org.telegram.ui.Components.TextStyleSpan in project Telegram-FOSS by Telegram-FOSS-Team.
the class ChatActivity method fillActionModeMenu.
public void fillActionModeMenu(Menu menu) {
if (menu.findItem(R.id.menu_bold) != null) {
return;
}
if (Build.VERSION.SDK_INT >= 23) {
menu.removeItem(android.R.id.shareText);
}
int order = 6;
menu.add(R.id.menu_groupbolditalic, R.id.menu_spoiler, order++, LocaleController.getString("Spoiler", R.string.Spoiler));
SpannableStringBuilder stringBuilder = new SpannableStringBuilder(LocaleController.getString("Bold", R.string.Bold));
stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/rmedium.ttf")), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
menu.add(R.id.menu_groupbolditalic, R.id.menu_bold, order++, stringBuilder);
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Italic", R.string.Italic));
stringBuilder.setSpan(new TypefaceSpan(AndroidUtilities.getTypeface("fonts/ritalic.ttf")), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
menu.add(R.id.menu_groupbolditalic, R.id.menu_italic, order++, stringBuilder);
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Mono", R.string.Mono));
stringBuilder.setSpan(new TypefaceSpan(Typeface.MONOSPACE), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
menu.add(R.id.menu_groupbolditalic, R.id.menu_mono, order++, stringBuilder);
if (currentEncryptedChat == null || AndroidUtilities.getPeerLayerVersion(currentEncryptedChat.layer) >= 101) {
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Strike", R.string.Strike));
TextStyleSpan.TextStyleRun run = new TextStyleSpan.TextStyleRun();
run.flags |= TextStyleSpan.FLAG_STYLE_STRIKE;
stringBuilder.setSpan(new TextStyleSpan(run), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
menu.add(R.id.menu_groupbolditalic, R.id.menu_strike, order++, stringBuilder);
stringBuilder = new SpannableStringBuilder(LocaleController.getString("Underline", R.string.Underline));
run = new TextStyleSpan.TextStyleRun();
run.flags |= TextStyleSpan.FLAG_STYLE_UNDERLINE;
stringBuilder.setSpan(new TextStyleSpan(run), 0, stringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
menu.add(R.id.menu_groupbolditalic, R.id.menu_underline, order++, stringBuilder);
}
menu.add(R.id.menu_groupbolditalic, R.id.menu_link, order++, LocaleController.getString("CreateLink", R.string.CreateLink));
menu.add(R.id.menu_groupbolditalic, R.id.menu_regular, order++, LocaleController.getString("Regular", R.string.Regular));
}
Aggregations