新版首页兼容专题/插件化以及相关部分数据补全
This commit is contained in:
@ -551,21 +551,24 @@ public class BindingAdapters {
|
||||
return;
|
||||
}
|
||||
|
||||
int showCount = tags.size() > 3 ? 3 : tags.size(); // 最多显示3个
|
||||
|
||||
StringBuilder content = new StringBuilder();
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
for (int i = 0; i < showCount; i++) {
|
||||
TagStyleEntity tag = tags.get(i);
|
||||
content.append(tag.getName());
|
||||
if (i != tags.size() - 1) content.append("/");
|
||||
if (i != showCount - 1) content.append("/");
|
||||
}
|
||||
|
||||
Spannable span = new SpannableString(content);
|
||||
int index = 0;
|
||||
for (int i = 0; i < tags.size(); i++) {
|
||||
for (int i = 0; i < showCount; i++) {
|
||||
TagStyleEntity tag = tags.get(i);
|
||||
int start = index;
|
||||
int end = start + tag.getName().length() + ((i != tags.size() - 1) ? 1 : 0);
|
||||
int end = start + tag.getName().length() + ((i != showCount - 1) ? 1 : 0);
|
||||
index = end;
|
||||
span.setSpan(new ForegroundColorSpan(Color.parseColor(tag.getColor())), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
span.setSpan(new ForegroundColorSpan(Color.parseColor("#" + tag.getColor())),
|
||||
start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
view.setText(span);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user