|
|
@ -209,29 +209,29 @@ public class EntityAnswer implements Serializable {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
order++;
|
|
|
|
order++;
|
|
|
|
|
|
|
|
|
|
|
|
SpannableStringBuilder name = new SpannableStringBuilder(answer.name);
|
|
|
|
SpannableStringBuilder ssb = new SpannableStringBuilder(answer.name);
|
|
|
|
|
|
|
|
|
|
|
|
if (answer.name != null && answer.color != null) {
|
|
|
|
if (answer.name != null && answer.color != null) {
|
|
|
|
int first = answer.name.codePointAt(0);
|
|
|
|
int first = answer.name.codePointAt(0);
|
|
|
|
int count = Character.charCount(first);
|
|
|
|
int count = Character.charCount(first);
|
|
|
|
name.setSpan(new ForegroundColorSpan(answer.color), 0, count, 0);
|
|
|
|
ssb.setSpan(new ForegroundColorSpan(answer.color), 0, count, 0);
|
|
|
|
name.setSpan(new StyleSpan(Typeface.BOLD), 0, count, 0);
|
|
|
|
ssb.setSpan(new StyleSpan(Typeface.BOLD), 0, count, 0);
|
|
|
|
name.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_LARGE), 0, count, 0);
|
|
|
|
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_LARGE), 0, count, 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (grouped && answer.applied > 0) {
|
|
|
|
if (grouped && answer.applied > 0) {
|
|
|
|
name.append(" (").append(NF.format(answer.applied)).append(")");
|
|
|
|
ssb.append(" (").append(NF.format(answer.applied)).append(")");
|
|
|
|
name.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL),
|
|
|
|
ssb.setSpan(new RelativeSizeSpan(HtmlHelper.FONT_SMALL),
|
|
|
|
answer.name.length() + 1, name.length(), 0);
|
|
|
|
answer.name.length() + 1, ssb.length(), 0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
MenuItem item;
|
|
|
|
MenuItem item;
|
|
|
|
if (answer.group == null)
|
|
|
|
if (answer.group == null)
|
|
|
|
item = main.add(Menu.NONE, order, order++, name);
|
|
|
|
item = main.add(Menu.NONE, order, order++, ssb);
|
|
|
|
else {
|
|
|
|
else {
|
|
|
|
SubMenu smenu = map.get(answer.group);
|
|
|
|
SubMenu smenu = map.get(answer.group);
|
|
|
|
item = smenu.add(answer.applied > 0 ? Menu.FIRST : Menu.NONE,
|
|
|
|
item = smenu.add(answer.applied > 0 ? Menu.FIRST : Menu.NONE,
|
|
|
|
smenu.size(), smenu.size() + 1, name);
|
|
|
|
smenu.size(), smenu.size() + 1, ssb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
item.setIntent(new Intent().putExtra("id", answer.id));
|
|
|
|
item.setIntent(new Intent().putExtra("id", answer.id));
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -303,6 +303,12 @@ public class EntityAnswer implements Serializable {
|
|
|
|
for (EntityAnswer answer : favorites) {
|
|
|
|
for (EntityAnswer answer : favorites) {
|
|
|
|
SpannableStringBuilder ssb = new SpannableStringBuilder(answer.name);
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
|
|
ImageSpan imageSpan = new CenteredImageSpan(icon);
|
|
|
|
ImageSpan imageSpan = new CenteredImageSpan(icon);
|
|
|
|
ssb.insert(0, "\uFFFC\u2002"); // object replacement character, en space
|
|
|
|
ssb.insert(0, "\uFFFC\u2002"); // object replacement character, en space
|
|
|
|
ssb.setSpan(imageSpan, 0, 1, 0);
|
|
|
|
ssb.setSpan(imageSpan, 0, 1, 0);
|
|
|
|