Commit 155d644c by wjg

add release apk

parent 50bee6e4
...@@ -28,14 +28,14 @@ public class Goods implements Serializable { ...@@ -28,14 +28,14 @@ public class Goods implements Serializable {
/** 是否是特惠商品 */ /** 是否是特惠商品 */
private Integer isRecommend; private Integer isRecommend;
/** 特惠标签 */ /** 特惠标签 */
private String recommendTag; private List<String> recommendTagList;
public String getRecommendTag() { public List<String> getRecommendTagList() {
return recommendTag; return recommendTagList;
} }
public void setRecommendTag(String recommendTag) { public void setRecommendTagList(List<String> recommendTagList) {
this.recommendTag = recommendTag; this.recommendTagList = recommendTagList;
} }
public Integer getIsRecommend() { public Integer getIsRecommend() {
......
...@@ -52,25 +52,31 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo ...@@ -52,25 +52,31 @@ public class GoodsAdapter extends BaseSectionQuickAdapter<ScrollBean, BaseViewHo
LinearLayout layoutTag = helper.getView(R.id.layout_tags); LinearLayout layoutTag = helper.getView(R.id.layout_tags);
layoutTag.removeAllViews(); layoutTag.removeAllViews();
if (!StringUtils.isEmpty(goods.getRecommendTag())) { // 特惠标签
int recommendTagSize = 0;
if (!CollectionUtils.isEmpty(goods.getRecommendTagList())) {
recommendTagSize = goods.getRecommendTagList().size();
helper.setVisible(R.id.layout_tags, true); helper.setVisible(R.id.layout_tags, true);
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag_recommend, null); for (int i = 0; i < goods.getRecommendTagList().size(); i++) {
((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getRecommendTag()); View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag_recommend, null);
layoutTag.addView(tagView); ((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getRecommendTagList().get(i));
layoutTag.addView(tagView);
}
} }
// 普通标签
if (CollectionUtils.isEmpty(goods.getTags()) && StringUtils.isEmpty(goods.getRecommendTag())) { if (!CollectionUtils.isEmpty(goods.getTags())) {
helper.setVisible(R.id.layout_tags, false);
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
layoutTag.addView(tagView);
} else {
helper.setVisible(R.id.layout_tags, true); helper.setVisible(R.id.layout_tags, true);
for (int i = 0; i < goods.getTags().size() && i < 2; i++) { for (int i = 0; i < goods.getTags().size() && i < (3 - recommendTagSize); i++) {
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null); View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getTags().get(i)); ((TextView) tagView.findViewById(R.id.txt_tag)).setText(goods.getTags().get(i));
layoutTag.addView(tagView); layoutTag.addView(tagView);
} }
} }
if (CollectionUtils.isEmpty(goods.getTags()) && CollectionUtils.isEmpty(goods.getRecommendTagList())) {
helper.setVisible(R.id.layout_tags, false);
View tagView = LayoutInflater.from(mContext).inflate(R.layout.item_tag, null);
layoutTag.addView(tagView);
}
ImageView imgThumbnail = helper.getView(R.id.img_thumbnail); ImageView imgThumbnail = helper.getView(R.id.img_thumbnail);
// RoundedCorners roundedCorners = new RoundedCorners(5); // RoundedCorners roundedCorners = new RoundedCorners(5);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment