Просмотр исходного кода

task in search show wrong number

billyyoyo лет назад: 6
Родитель
Сommit
00af11c75c

+ 49 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/TaskSimple.java

@@ -1,5 +1,6 @@
 package com.sheep.gamegroup.model.entity;
 package com.sheep.gamegroup.model.entity;
 
 
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.absBase.IHomePageSearch;
 import com.sheep.gamegroup.absBase.IHomePageSearch;
 
 
 public class TaskSimple {
 public class TaskSimple {
@@ -8,10 +9,13 @@ public class TaskSimple {
     private String title;
     private String title;
     private String name;
     private String name;
     private String icon;
     private String icon;
-    private float bonus;
     private int is_succession;
     private int is_succession;
     private int is_shop;
     private int is_shop;
     private float shop_amount;
     private float shop_amount;
+    private float vip_shop_amount;
+    private float bonus;
+    private float vip_bonus;
+    private float video_amount;
 
 
     public int getId() {
     public int getId() {
         return id;
         return id;
@@ -29,10 +33,54 @@ public class TaskSimple {
         this.is_shop = is_shop;
         this.is_shop = is_shop;
     }
     }
 
 
+    public float getVip_shop_amount() {
+        return vip_shop_amount;
+    }
+
+    public void setVip_shop_amount(float vip_shop_amount) {
+        this.vip_shop_amount = vip_shop_amount;
+    }
+
+    public float getVip_bonus() {
+        return vip_bonus;
+    }
+
+    public void setVip_bonus(float vip_bonus) {
+        this.vip_bonus = vip_bonus;
+    }
+
+    public float getVideo_amount() {
+        return video_amount;
+    }
+
+    public void setVideo_amount(float video_amount) {
+        this.video_amount = video_amount;
+    }
+
     public float getShop_amount() {
     public float getShop_amount() {
         return shop_amount;
         return shop_amount;
     }
     }
 
 
+    public boolean isShop() {
+        return is_shop == 1;
+    }
+
+    public String getShowValue(boolean isVip) {
+        if (isShop()) {
+            if (isVip) {
+                return "+" + NumberFormatUtils.retainMost2W((shop_amount + video_amount) * 10000) + "经验值";
+            } else {
+                return "+" + NumberFormatUtils.retainMost2W((vip_shop_amount + video_amount) * 10000) + "经验值";
+            }
+        } else {
+            if (isVip) {
+                return "+" + NumberFormatUtils.retainMost2W(vip_bonus + video_amount) + "元";
+            } else {
+                return "+" + NumberFormatUtils.retainMost2W(bonus + video_amount) + "元";
+            }
+        }
+    }
+
     public void setShop_amount(float shop_amount) {
     public void setShop_amount(float shop_amount) {
         this.shop_amount = shop_amount;
         this.shop_amount = shop_amount;
     }
     }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/module/search/TaskHolder.java

@@ -13,6 +13,7 @@ import com.sheep.gamegroup.model.entity.Release_task;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskSimple;
 import com.sheep.gamegroup.model.entity.TaskSimple;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.R;
@@ -50,12 +51,11 @@ public class TaskHolder extends SearchResultHolder<TaskSimple> {
     @Override
     @Override
     public void configView() {
     public void configView() {
         if (item.getIs_shop() == 1) {
         if (item.getIs_shop() == 1) {
-            ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s经验值", NumberFormatUtils.retainMost2(item.getShop_amount() * 10000)));
             ViewUtil.setText(item_home_page_search_tag_tv, "遇见预约任务");
             ViewUtil.setText(item_home_page_search_tag_tv, "遇见预约任务");
         } else {
         } else {
-            ViewUtil.setText(item_home_page_search_bonus_tv, String.format(Locale.CHINA, "+%s元", NumberFormatUtils.retainMost2(item.getBonus())));
             ViewUtil.setText(item_home_page_search_tag_tv, "现金任务");
             ViewUtil.setText(item_home_page_search_tag_tv, "现金任务");
         }
         }
+        ViewUtil.setText(item_home_page_search_bonus_tv, item.getShowValue(DataUtil.getInstance().getUserEntity().isVIP()));
         ViewUtil.setText(item_home_page_search_content_tv, item.getName());
         ViewUtil.setText(item_home_page_search_content_tv, item.getName());
         ViewUtil.setGameImage(item_home_page_search_iv, item.getIcon());
         ViewUtil.setGameImage(item_home_page_search_iv, item.getIcon());
     }
     }