Explorar el Código

主页任务列表数据排序:任务已领光任务排在最后;
主页任务列表底线优化内容;
修复福利中的几个bug

zengjiebin hace 7 años
padre
commit
79dd1f72aa

+ 1 - 0
app/src/main/java/com/kfzs/duanduan/event/EventTypes.java

@@ -42,6 +42,7 @@ public enum EventTypes {
 
     REFRESH_XIAOMI_GAME_LIST,//刷新界面
     FGT_SHEEP_REFRESH_H , //刷新fgtSmallSheep高度
+    FGT_SHEEP_SET_BOTTOM_LINE , //设置底线内容
     FGT_SHEEP_SHOW_NEW_USER_HONG_BAO , //显示红包
     REFRESH_AUDITACTIVITY_DATA,//审核数据刷新
     FGT_PLAYGAME_REFRESH_H , //刷新玩转游戏高度

+ 15 - 3
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -218,11 +218,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
     public static final int WHAT_LOAD_USER_INFO = 0;//加载用户信息
     public static final int WHAT_LOAD_RUN_TASK = 1;//加载正在进行的任务列表
     public static final int WHAT_UPDATE_VP_HEIGHT = 2;//刷新viewpager高度
+    public static final int WHAT_UPDATE_BOTTOM_LINE = 3;//刷新底线(双击我回到顶部)
     public static final int WHAT_TRY_SHOW_HB = 7;//尝试显示红包
     public Handler mHandler = new Handler(Looper.getMainLooper()) {
         @Override
         public void handleMessage(Message msg) {
             super.handleMessage(msg);
+            FgtTryMakeMoney item;
             switch (msg.what) {
                 case WHAT_LOAD_USER_INFO:
                     loadUserInfo();
@@ -245,8 +247,8 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
                     tryMakeMoneyAdp.notifyDataSetChanged();
                     checkAndInitView();
                     break;
-                case WHAT_UPDATE_VP_HEIGHT:
-                    FgtTryMakeMoney item = (FgtTryMakeMoney) adpViewPagerDetail.getItem(curPosition);
+                case WHAT_UPDATE_VP_HEIGHT://刷新ViewPager高度
+                    item = (FgtTryMakeMoney) adpViewPagerDetail.getItem(curPosition);
                     if (mViewPager == null || item == null) {
                         return;
                     }
@@ -255,6 +257,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
                     params.height = count == 0 ? G.HEIGHT / 2 : (count * getResources().getDimensionPixelSize(R.dimen.content_padding_96) + getResources().getDimensionPixelSize(R.dimen.content_padding));
                     mViewPager.setLayoutParams(params);
                     break;
+                case WHAT_UPDATE_BOTTOM_LINE://刷新底线
+                    item = (FgtTryMakeMoney) adpViewPagerDetail.getItem(curPosition);
+                    if (mViewPager == null || item == null) {
+                        return;
+                    }
+                    bottom_line_text.setText(item.isNoMore() ?"我是有底线的,双击我回到顶部" : "双击我回到顶部");
+                    break;
                 case WHAT_TRY_SHOW_HB:
                     isShowRedPackages(activity);
                     break;
@@ -512,7 +521,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         //每次进入主页都刷新一下url配置信息
         CommonUtil.getInstance().initUrlConfigByNet(null, null);
         isShowRedPackage();
-        bottom_line_text.setText("我是有底线的,双击我回到顶部");
+        bottom_line_text.setText("双击我回到顶部");
     }
 
 
@@ -1185,6 +1194,9 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
             case FGT_SHEEP_REFRESH_H:
                 mHandler.sendEmptyMessage(WHAT_UPDATE_VP_HEIGHT);
                 break;
+            case FGT_SHEEP_SET_BOTTOM_LINE:
+                mHandler.sendEmptyMessage(WHAT_UPDATE_BOTTOM_LINE);
+                break;
             case FGT_SHEEP_SHOW_NEW_USER_HONG_BAO:
                 mHandler.sendEmptyMessage(WHAT_TRY_SHOW_HB);
                 break;

+ 3 - 2
app/src/main/java/com/sheep/gamegroup/model/entity/DownloadWelfare.java

@@ -138,7 +138,7 @@ public class DownloadWelfare {
      * @return
      */
     public String getGiftRatioText() {
-        return String.format(Locale.CHINA, "每充500抵%d", gift_ratio * 5);
+        return String.format(Locale.CHINA, "最低充%d,每充%d送%d", consume_amount, consume_amount, gift_ratio * consume_amount / 100);
     }
 
     /**
@@ -163,6 +163,7 @@ public class DownloadWelfare {
      * @return
      */
     public String getUseBalanceText() {
-        return String.format(Locale.CHINA, "已使用%d", this.Log != null ? this.Log.getTotalAssets() - this.Log.getBalance() : 0);
+        int use = this.Log != null ? this.Log.getTotalAssets() - this.Log.getBalance() : 0;
+        return use == 0 ? "未使用" : String.format(Locale.CHINA, "已使用%d", use);
     }
 }

+ 14 - 2
app/src/main/java/com/sheep/gamegroup/model/entity/TaskReleaseEty.java

@@ -43,6 +43,7 @@ public class TaskReleaseEty implements Serializable{
     private boolean is_running;
     private String child_task_name;//
     private int demo_time;//试玩时长
+    private int consume_amount;//最低消费
     private int gift_ratio;//赠送比例,取值0-100
     private int user_task_status;//备注:和任务记录状态一样
     public int getDemo_time() {
@@ -272,6 +273,14 @@ public class TaskReleaseEty implements Serializable{
         this.user_task_status = user_task_status;
     }
 
+    public int getConsume_amount() {
+        return consume_amount;
+    }
+
+    public void setConsume_amount(int consume_amount) {
+        this.consume_amount = consume_amount;
+    }
+
     @Override
     public boolean equals(Object obj) {
         return obj instanceof TaskReleaseEty && ((TaskReleaseEty) obj).getId() == id;
@@ -316,7 +325,7 @@ public class TaskReleaseEty implements Serializable{
      * @return
      */
     public String getGiftRatioText() {
-        return String.format(Locale.CHINA, "每充500送%d", gift_ratio * 5);
+        return String.format(Locale.CHINA, "最低充%d,每充%d送%d", consume_amount, consume_amount, gift_ratio * consume_amount / 100);
     }
     /**
      * 剩余份数
@@ -325,7 +334,10 @@ public class TaskReleaseEty implements Serializable{
     public String getLastNumText() {
         return String.format(Locale.CHINA, "剩余%s份", last_num);
     }
-
+    public int getLastNum1Or0(){
+        int lastNum = NumberFormatUtils.parseInteger(last_num, 0);
+        return lastNum > 0 ? 1 : 0;
+    }
     public String getDateText() {
         long endTime = NumberFormatUtils.parseLong(deadline);
         if(endTime < 1000_000){

+ 21 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/VoucherRecord.java

@@ -3,6 +3,27 @@ package com.sheep.gamegroup.model.entity;
 /**
  * Created by realicing on 2018/9/4.
  * realicing@sina.com
+ * Amount	number($double)
+ * 金额
+ * <p>
+ * ConsumptionAmount	number($double)
+ * 消费金额
+ * <p>
+ * CreateTime	integer($int64)
+ * 记录时间
+ * <p>
+ * GameId	string
+ * 游戏id
+ * <p>
+ * Id	integer($int64)
+ * SurplusAmount	number($double)
+ * 消费金额
+ * <p>
+ * Type	integer($int32)
+ * 1:增加 2:扣除
+ * <p>
+ * UserId	integer($int64)
+ * 用户id
  */
 public class VoucherRecord {
 

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/model/entity/VoucherUseLog.java

@@ -109,7 +109,7 @@ public class VoucherUseLog {
      * @return
      */
     public String getGiftRatioText() {
-        return String.format(Locale.CHINA, "每充500抵%d", gift_ratio * 5);
+        return String.format(Locale.CHINA, "充值%s元", this.Log != null ? NumberFormatUtils.retainMost2(this.Log.getConsumptionAmount()): "");
     }
 
     /**
@@ -131,6 +131,6 @@ public class VoucherUseLog {
      * @return
      */
     public String getConsumptionAmountText() {
-        return String.format(Locale.CHINA, "-%s", NumberFormatUtils.retainMost2(this.Log != null ? this.Log.getConsumptionAmount() : 0));
+        return String.format(Locale.CHINA, "-%s", this.Log != null ? NumberFormatUtils.retainMost2(this.Log.getAmount()) : "0");
     }
 }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/GiftCenterAdapter.java

@@ -82,7 +82,7 @@ public class GiftCenterAdapter extends AdbCommonRecycler<GiftBagApp> {
                 return;
             }
             GlideImageLoader.setGameImage(item_download_welfare_iv, itemApp.getIcon());
-            ViewUtil.setText(item_download_welfare_name_tv, itemApp.getName());
+            ViewUtil.setText(item_download_welfare_name_tv, itemGiftBag.getGiftName());
             ViewUtil.setText(item_download_welfare_date_tv, itemGiftBag.getDateText());
             if(TextUtils.isEmpty(item.getCode())){//没有code,就视为没有领取礼包
                 item_download_welfare_tip_iv.setVisibility(View.GONE);

+ 0 - 1
app/src/main/java/com/sheep/gamegroup/view/adapter/WelfareAdapter.java

@@ -177,7 +177,6 @@ public class WelfareAdapter extends AdbCommonRecycler<TaskReleaseEty>{
 
                     @Override
                     public void onNext(BaseMessage baseMessage) {//领取任务成功
-                        G.showToast(baseMessage);
                         if(action1 != null)
                             action1.call(TO_REFRESH);
                     }

+ 27 - 3
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtTryMakeMoney.java

@@ -14,6 +14,7 @@ import android.widget.TextView;
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
 import com.kfzs.duanduan.event.BigEvent;
 import com.kfzs.duanduan.event.EventTypes;
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.di.components.DaggerFgtTryMakeMoneyComponent;
 import com.sheep.gamegroup.di.modules.TryMakeMoneyModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
@@ -40,6 +41,8 @@ import org.afinal.simplecache.ApiKey;
 import org.greenrobot.eventbus.EventBus;
 
 import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 
 import javax.inject.Inject;
@@ -79,14 +82,21 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
 
     private static final int LIST_COUNT = 3;//tryMakeMoneyAdp 总共有3条数据
     private static final RecyleObj NULL = RecyleObj.make(RecyleType.NONE, null);//空数据
-
+    private Comparator<TaskReleaseEty> comparator = new Comparator<TaskReleaseEty>() {
+        @Override
+        public int compare(TaskReleaseEty item1, TaskReleaseEty item2) {
+            return item2.getLastNum1Or0() - item1.getLastNum1Or0();
+        }
+    };
     private void notifyDataSetChanged() {
         checkAndInitView();
         tryMakeMoneyAdp.clear();
         if (!ListUtil.isEmpty(acceptedEtyList))
             tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RUN_TASK, acceptedEtyList));
-        if (!ListUtil.isEmpty(releaseEtyLists))
+        if (!ListUtil.isEmpty(releaseEtyLists)) {
+            Collections.sort(releaseEtyLists, comparator);
             tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.RELEASE_TASK, releaseEtyLists));
+        }
         if (!ListUtil.isEmpty(releaseEtyListsBegin))
             tryMakeMoneyAdp.add(RecyleObj.make(RecyleType.BEGIN_TASK, releaseEtyListsBegin));
         tryMakeMoneyAdp.refreshAdapter();
@@ -101,7 +111,7 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
 
     private void notifyBottomLine(boolean noMore) {
         if(bottomLine != null) {
-            if (!TextUtils.isEmpty(show_type)){
+            if (!TextUtils.isEmpty(show_type)){//主页不展示底线,用主页自带的底线
                 bottomLine.setVisibility(View.GONE);
                 return;
             }
@@ -250,7 +260,10 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
                 }
                 if(noMoreRelease && noMoreReleaseBegin){
                     recyclerview.setNoMore(true);
+                    noMore = true;
                     notifyBottomLine(true);
+                    if (!TextUtils.isEmpty(show_type))
+                        EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.FGT_SHEEP_SET_BOTTOM_LINE));
                 }
             }
         });
@@ -267,8 +280,14 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
     //强制刷新数据
     public void refreshData() {
         isFirstCache = false;
+        noMore = false;
+        if (!TextUtils.isEmpty(show_type))
+            EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.FGT_SHEEP_SET_BOTTOM_LINE));
         releasePage = 1;
         releaseBeginPage = 1;
+        acceptedEtyList.clear();
+        releaseEtyLists.clear();
+        releaseEtyListsBegin.clear();
         mInitData();
     }
 
@@ -497,4 +516,9 @@ public class FgtTryMakeMoney extends BaseFragment implements TryMakeMoneyContrac
     public int getDataCount() {
         return acceptedEtyList.size() + releaseEtyLists.size() + releaseEtyListsBegin.size();
     }
+
+    private boolean noMore = false;
+    public boolean isNoMore() {
+        return noMore;
+    }
 }

+ 1 - 1
app/src/main/res/layout/item_download_welfare.xml

@@ -124,7 +124,7 @@
             android:gravity="center"
             android:text="+10元"
             android:textColor="@color/txt_red"
-            android:textSize="15sp"
+            android:textSize="12sp"
             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintTop_toTopOf="parent" />