詹子聪 преди 5 години
родител
ревизия
bca364299c

+ 21 - 179
app/src/main/java/com/itant/shibei/bean/GoodsBean.java

@@ -16,245 +16,87 @@ public class GoodsBean {
     /**
      * 商品id
      */
-    private String goodsId;
+    public String goodsId;
     /**
      * 封面图片地址
      */
-    private String coverImageUrl;
+    public String coverImageUrl;
     /**
      * 标题
      */
-    private String title;
+    public String title;
     /**
      * 商品描述
      */
-    private String description;
+    public String description;
     /**
      * 商品推荐理由(一句话推荐、推荐者心声)
      */
-    private String reason;
+    public String reason;
     /**
      * 原价
      */
-    private double oldPrice;
+    public double oldPrice;
     /**
      * 现价
      */
-    private double nowPrice;
+    public double nowPrice;
     /**
      * 返利
      */
-    private String rebate;
+    public String rebate;
     /**
      * 店名
      */
-    private String shopName;
+    public String shopName;
     /**
      * 商店所属省份
      */
-    private String province;
+    public String province;
     /**
      * 是否自营
      */
-    private boolean isSelfBusiness;
+    public boolean isSelfBusiness;
     /**
      * 是否有券
      */
-    private boolean hasCoupon;
+    public boolean hasCoupon;
     /**
      * 优惠券金额
      */
-    private String couponMoney;
+    public String couponMoney;
     /**
      * 所属类型
      */
-    private int goodsType;
+    public int goodsType;
     /**
      * 商品链接
      */
-    private String goodsUrl;
+    public String goodsUrl;
     /**
      * 月销量
      */
-    private int salesPerMonth;
+    public int salesPerMonth;
 
     /**
      * 评论条数
      */
-    private int commentNum;
+    public int commentNum;
 
     /**
      * 好评率
      */
-    private double goodCommentPercent;
+    public double goodCommentPercent;
 
     /**
      * 创建时间
      */
-    private long createTimeMillis;
+    public long createTimeMillis;
 
     /**
      * 更新时间
      */
-    private long updateTimeMillis;
+    public long updateTimeMillis;
 
-    public String getGoodsId() {
-        return goodsId;
-    }
-
-    public void setGoodsId(String goodsId) {
-        this.goodsId = goodsId;
-    }
-
-    public String getCoverImageUrl() {
-        return coverImageUrl;
-    }
-
-    public void setCoverImageUrl(String coverImageUrl) {
-        this.coverImageUrl = coverImageUrl;
-    }
-
-    public String getTitle() {
-        return title;
-    }
-
-    public void setTitle(String title) {
-        this.title = title;
-    }
-
-    public double getOldPrice() {
-        return oldPrice;
-    }
-
-    public void setOldPrice(double oldPrice) {
-        this.oldPrice = oldPrice;
-    }
-
-    public double getNowPrice() {
-        return nowPrice;
-    }
-
-    public void setNowPrice(double nowPrice) {
-        this.nowPrice = nowPrice;
-    }
-
-    public String getRebate() {
-        return rebate;
-    }
-
-    public void setRebate(String rebate) {
-        this.rebate = rebate;
-    }
-
-    public String getShopName() {
-        return shopName;
-    }
-
-    public void setShopName(String shopName) {
-        this.shopName = shopName;
-    }
-
-    public String getProvince() {
-        return province;
-    }
-
-    public void setProvince(String province) {
-        this.province = province;
-    }
-
-    public boolean isSelfBusiness() {
-        return isSelfBusiness;
-    }
-
-    public void setSelfBusiness(boolean selfBusiness) {
-        isSelfBusiness = selfBusiness;
-    }
-
-    public boolean isHasCoupon() {
-        return hasCoupon;
-    }
-
-    public void setHasCoupon(boolean hasCoupon) {
-        this.hasCoupon = hasCoupon;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getReason() {
-        return reason;
-    }
-
-    public void setReason(String reason) {
-        this.reason = reason;
-    }
-
-    public int getGoodsType() {
-        return goodsType;
-    }
-
-    public void setGoodsType(int goodsType) {
-        this.goodsType = goodsType;
-    }
-
-    public String getCouponMoney() {
-        return couponMoney;
-    }
-
-    public void setCouponMoney(String couponMoney) {
-        this.couponMoney = couponMoney;
-    }
-
-    public String getGoodsUrl() {
-        return goodsUrl;
-    }
-
-    public void setGoodsUrl(String goodsUrl) {
-        this.goodsUrl = goodsUrl;
-    }
-
-    public int getSalesPerMonth() {
-        return salesPerMonth;
-    }
-
-    public void setSalesPerMonth(int salesPerMonth) {
-        this.salesPerMonth = salesPerMonth;
-    }
-
-    public int getCommentNum() {
-        return commentNum;
-    }
-
-    public void setCommentNum(int commentNum) {
-        this.commentNum = commentNum;
-    }
-
-    public double getGoodCommentPercent() {
-        return goodCommentPercent;
-    }
-
-    public void setGoodCommentPercent(double goodCommentPercent) {
-        this.goodCommentPercent = goodCommentPercent;
-    }
-
-    public long getCreateTimeMillis() {
-        return createTimeMillis;
-    }
-
-    public void setCreateTimeMillis(long createTimeMillis) {
-        this.createTimeMillis = createTimeMillis;
-    }
-
-    public long getUpdateTimeMillis() {
-        return updateTimeMillis;
-    }
-
-    public void setUpdateTimeMillis(long updateTimeMillis) {
-        this.updateTimeMillis = updateTimeMillis;
-    }
+    
 }

+ 16 - 16
app/src/main/java/com/itant/shibei/tool/DataTool.java

@@ -63,22 +63,22 @@ public class DataTool {
     public static List<GoodsBean> getGoodsList() {
         List<GoodsBean> goodsList = new ArrayList<>();
         GoodsBean goodsBean = new GoodsBean();
-        goodsBean.setCoverImageUrl("https://img14.360buyimg.com/n0/jfs/t1/97822/29/10664/255856/5e1ebf26Eea1a28ec/ac2c298127bae9a4.jpg");
-        goodsBean.setTitle("华硕(ASUS) PN60 商用办公家用教育 台式机电脑主机 (i7-8550U 256G SSD 8G 正版Win10 三年上门)迷你台式");
-        goodsBean.setDescription("远程教育,在家办公,顺畅不卡顿!酷睿i7-8550U处理器、256GSSD,8G内存,便携电脑移动办公更强性能购买PN61-i7,高效稳定");
-        goodsBean.setReason("小巧便携且高效稳定");
-        goodsBean.setOldPrice(3899);
-        goodsBean.setNowPrice(3849);
-        goodsBean.setRebate("50");
-        goodsBean.setShopName("华硕京东自营旗舰店");
-        goodsBean.setProvince("广东");
-        goodsBean.setSelfBusiness(true);
-        goodsBean.setHasCoupon(true);
-        goodsBean.setCouponMoney("30");
-        goodsBean.setGoodsType(GoodsBean.TYPE_TECHNOLOGY);
-        goodsBean.setGoodsUrl("https://union-click.jd.com/jdc?e=&p=AyIGZRtcEgAXA1QfWhIyEgZUGlocChIFVBJeJUZNXwtEa0xHV0YXEEULWldTCQQHCllHGAdFBwtEQkQBBRxNVlQYBUkeTVxNCRNLGEF6RwtVGloUAxsPVRlaHAciVR1hWBNYZl42cCVPUVF6V1skdFxJZ1kXaxQyEgZUGFMcBREAUitrFQUiVDtADnsGQQBWH1JHCxMCUksOJQMiB1ETXhYKGwFdHVsQByIAVRJrU1dTWhNNBEtnbFMSRQYlMiIEZStrFTIRNxd1WBYLFVcAEg8dUkcFUE9THAsbBl0aWRBSFwIFTl8VChI3VxpaEQs%3D");
-        goodsBean.setSalesPerMonth(1022);
-        goodsBean.setGoodCommentPercent(0.98d);
+        goodsBean.coverImageUrl="https://img14.360buyimg.com/n0/jfs/t1/97822/29/10664/255856/5e1ebf26Eea1a28ec/ac2c298127bae9a4.jpg";
+        goodsBean.title="华硕(ASUS) PN60 商用办公家用教育 台式机电脑主机 (i7-8550U 256G SSD 8G 正版Win10 三年上门)迷你台式";
+        goodsBean.description="远程教育,在家办公,顺畅不卡顿!酷睿i7-8550U处理器、256GSSD,8G内存,便携电脑移动办公更强性能购买PN61-i7,高效稳定";
+        goodsBean.reason="小巧便携且高效稳定";
+        goodsBean.oldPrice=3899;
+        goodsBean.nowPrice=3849;
+        goodsBean.rebate="50";
+        goodsBean.shopName="华硕京东自营旗舰店";
+        goodsBean.province="广东";
+        goodsBean.isSelfBusiness=true;
+        goodsBean.hasCoupon=true;
+        goodsBean.couponMoney="30";
+        goodsBean.goodsType=GoodsBean.TYPE_TECHNOLOGY;
+        goodsBean.goodsUrl="https://union-click.jd.com/jdc?e=&p=AyIGZRtcEgAXA1QfWhIyEgZUGlocChIFVBJeJUZNXwtEa0xHV0YXEEULWldTCQQHCllHGAdFBwtEQkQBBRxNVlQYBUkeTVxNCRNLGEF6RwtVGloUAxsPVRlaHAciVR1hWBNYZl42cCVPUVF6V1skdFxJZ1kXaxQyEgZUGFMcBREAUitrFQUiVDtADnsGQQBWH1JHCxMCUksOJQMiB1ETXhYKGwFdHVsQByIAVRJrU1dTWhNNBEtnbFMSRQYlMiIEZStrFTIRNxd1WBYLFVcAEg8dUkcFUE9THAsbBl0aWRBSFwIFTl8VChI3VxpaEQs%3D";
+        goodsBean.salesPerMonth=1022;
+        goodsBean.goodCommentPercent=0.98d;
         goodsList.add(goodsBean);
         goodsList.add(goodsBean);
         goodsList.add(goodsBean);

+ 11 - 11
app/src/main/java/com/itant/shibei/ui/home/GoodsAdapter.java

@@ -46,27 +46,27 @@ public class GoodsAdapter extends CommonAdapter<GoodsBean> {
 
     @Override
     protected void convert(ViewHolder holder, GoodsBean goodsBean, int position) {
-        holder.setText(R.id.tv_title, goodsBean.getTitle());
-        holder.setText(R.id.tv_shop_name, goodsBean.getShopName());
+        holder.setText(R.id.tv_title, goodsBean.title);
+        holder.setText(R.id.tv_shop_name, goodsBean.shopName);
 
         // 好评
         holder.setText(R.id.tv_good_comment,
-                String.format(ConstantString.GOOD_COMMENT, Math.round(goodsBean.getGoodCommentPercent()*100)));
+                String.format(ConstantString.GOOD_COMMENT, Math.round(goodsBean.goodCommentPercent*100)));
 
         // 月销
         holder.setText(R.id.tv_sales_per_month,
-                String.format(ConstantString.SALES_PER_MONTH, String.valueOf(goodsBean.getSalesPerMonth())));
+                String.format(ConstantString.SALES_PER_MONTH, String.valueOf(goodsBean.salesPerMonth)));
 
         // 返现
         TextView tv_rebate = holder.getView(R.id.tv_rebate);
         tv_rebate.setText(String.format(ConstantString.MONEY_GAME,
-                StringTool.getShowMoney(goodsBean.getOldPrice()-goodsBean.getNowPrice())));
+                StringTool.getShowMoney(goodsBean.oldPrice-goodsBean.nowPrice)));
         // 走马灯
         tv_rebate.setSelected(true);
 
         // 自营
         TextView tv_self = holder.getView(R.id.tv_self);
-        if (goodsBean.isSelfBusiness()) {
+        if (goodsBean.isSelfBusiness) {
             tv_self.setVisibility(View.VISIBLE);
         } else {
             tv_self.setVisibility(View.GONE);
@@ -74,27 +74,27 @@ public class GoodsAdapter extends CommonAdapter<GoodsBean> {
 
         // 原价
         TextView tv_old_price = holder.getView(R.id.tv_old_price);
-        tv_old_price.setText(String.format(ConstantString.MONEY_RMB, StringTool.getShowMoney(goodsBean.getOldPrice())));
+        tv_old_price.setText(String.format(ConstantString.MONEY_RMB, StringTool.getShowMoney(goodsBean.oldPrice)));
         // 增加删除线
         tv_old_price.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG);
 
         // 现价
-        holder.setText(R.id.tv_now_price, String.format(ConstantString.MONEY_RMB, StringTool.getShowMoney(goodsBean.getNowPrice())));
+        holder.setText(R.id.tv_now_price, String.format(ConstantString.MONEY_RMB, StringTool.getShowMoney(goodsBean.nowPrice)));
 
         // 一句话推荐
         TextView tv_reason = holder.getView(R.id.tv_reason);
-        tv_reason.setText(goodsBean.getReason());
+        tv_reason.setText(goodsBean.reason);
 
         holder.setOnClickListener(R.id.cv_goods, new View.OnClickListener() {
             @Override
             public void onClick(View v) {
-                String goodsUrl = goodsBean.getGoodsUrl();
+                String goodsUrl = goodsBean.goodsUrl;
                 ActivityTool.openUrl((Activity) mContext, goodsUrl);
             }
         });
 
         AppCompatImageView aciv_goods = holder.getView(R.id.aciv_goods);
-        Glide.with(mContext).load(goodsBean.getCoverImageUrl())
+        Glide.with(mContext).load(goodsBean.coverImageUrl)
                 .apply(RequestOptions.bitmapTransform(new RoundedCorners(mRadius)))
                 .apply(new RequestOptions()
                         .skipMemoryCache(true)