Color for favorite templates

This commit is contained in:
M66B
2022-01-23 16:26:53 +01:00
parent 9bfd5c8053
commit b7f2999af8
2 changed files with 26 additions and 9 deletions

View File

@@ -2910,8 +2910,16 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
if (data.answers != null) {
int order = 100;
for (EntityAnswer answer : data.answers) {
SpannableStringBuilder ssb = new SpannableStringBuilder(answer.name);
int first = answer.name.codePointAt(0);
int count = Character.charCount(first);
ssb.setSpan(new ForegroundColorSpan(answer.color), 0, count, 0);
ssb.setSpan(new StyleSpan(Typeface.BOLD), 0, count, 0);
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_LARGE), 0, count, 0);
order++;
popupMenu.getMenu().add(Menu.FIRST, order, order, answer.name)
popupMenu.getMenu().add(Menu.FIRST, order, order, ssb)
.setIcon(R.drawable.twotone_star_24)
.setIntent(new Intent().putExtra("id", answer.id));
}