【光环助手V5.3.0】专题合集-排行榜功能优化(2、3)https://git.ghzs.com/pm/halo-app-issues/-/issues/1471

This commit is contained in:
lyr
2021-09-24 15:28:37 +08:00
parent 9709c6cbf0
commit b3a491e723
19 changed files with 578 additions and 17 deletions

View File

@ -34,10 +34,18 @@ import java.util.TimeZone;
public class GameViewUtils {
public static void setLabelList(Context context, LinearLayout labelLayout, List<TagStyleEntity> tagStyle) {
setLabelList(context, labelLayout, tagStyle, 8);
setLabelList(context, labelLayout, tagStyle, 8, false);
}
public static void setLabelList(Context context, LinearLayout labelLayout, List<TagStyleEntity> tagStyle, boolean isUseColumn) {
setLabelList(context, labelLayout, tagStyle, 8, isUseColumn);
}
public static void setLabelList(Context context, LinearLayout labelLayout, List<TagStyleEntity> tagStyle, int margin) {
setLabelList(context, labelLayout, tagStyle, margin, false);
}
public static void setLabelList(Context context, LinearLayout labelLayout, List<TagStyleEntity> tagStyle, int margin, boolean isUseColumn) {
labelLayout.removeAllViews();
if (tagStyle == null || tagStyle.isEmpty()) {
// 没有数据的话默认不显示
@ -46,7 +54,7 @@ public class GameViewUtils {
// labelLayout.addView(getNewGameTagView(context, tagEntity, 0));
} else {
for (int i = 0, size = tagStyle.size(); i < size; i++) {
View view = getNewGameTagView(context, tagStyle.get(i), i == size - 1 ? 0 : DisplayUtils.dip2px(context, margin));
View view = getNewGameTagView(context, tagStyle.get(i), i == size - 1 ? 0 : DisplayUtils.dip2px(context, margin), isUseColumn);
labelLayout.addView(view);
if (labelLayout.getChildCount() == 3) {
break;
@ -78,7 +86,7 @@ public class GameViewUtils {
}
// 新的游戏标签样式 version>=4.0.0
private static TextView getNewGameTagView(Context context, TagStyleEntity tagEntity, int rightMargin) {
private static TextView getNewGameTagView(Context context, TagStyleEntity tagEntity, int rightMargin, boolean isUseColumn) {
// 参数不全,用旧样式实现
if (TextUtils.isEmpty(tagEntity.getBackground())) {
return getGameTagView(context, tagEntity.getName(), rightMargin, "type", tagEntity);
@ -98,7 +106,11 @@ public class GameViewUtils {
DisplayUtils.dip2px(context, 4),
DisplayUtils.dip2px(context, 1));
tag.setTextColor(Color.parseColor("#" + tagEntity.getColor()));
if (isUseColumn && !TextUtils.isEmpty(tagEntity.getColumn())) {
tag.setTextColor(Color.parseColor("#" + tagEntity.getColumn()));
} else {
tag.setTextColor(Color.parseColor("#" + tagEntity.getColor()));
}
tag.setBackground(DrawableView.getServerDrawable(Color.parseColor("#" + tagEntity.getBackground())));
return tag;
}