Explorar o código

2.8代码提交

liujiangyao %!s(int64=7) %!d(string=hai) anos
pai
achega
23a206efe7
Modificáronse 23 ficheiros con 377 adicións e 75 borrados
  1. 1 0
      app/src/main/java/com/kfzs/duanduan/event/EventTypes.java
  2. 1 1
      app/src/main/java/com/kfzs/duanduan/utils/ApkUtils.java
  3. 22 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameAccountEntity.java
  4. 21 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GamePayList.java
  5. 12 2
      app/src/main/java/com/sheep/gamegroup/model/entity/PayEntity.java
  6. 7 7
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java
  7. 1 1
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskReleaseEty.java
  8. 49 3
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  9. 23 1
      app/src/main/java/com/sheep/gamegroup/view/activity/ActGameAgencyRecharge.java
  10. 41 0
      app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchGame.java
  11. 7 1
      app/src/main/java/com/sheep/gamegroup/view/activity/SignCardAct.java
  12. 2 2
      app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java
  13. 1 1
      app/src/main/java/com/sheep/gamegroup/view/adapter/AdpGameAccount.java
  14. 17 8
      app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java
  15. 12 3
      app/src/main/java/com/sheep/gamegroup/view/dialog/DialogAddAccount.java
  16. 2 2
      app/src/main/java/com/sheep/gamegroup/view/dialog/DialogModifyAccount.java
  17. 64 15
      app/src/main/java/com/sheep/gamegroup/view/dialog/DialogPayAccount.java
  18. 22 13
      app/src/main/java/com/sheep/gamegroup/view/dialog/DialogPayGame.java
  19. 5 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/service/DownloadService.java
  20. 33 1
      app/src/main/res/layout/dialog_pay_account.xml
  21. 31 12
      app/src/main/res/layout/try_makemoney_item_recommend.xml
  22. 1 0
      app/src/main/res/values/strings.xml
  23. 2 2
      gradle.properties

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

@@ -32,4 +32,5 @@ public enum EventTypes {
     GUIDE_NEXT,//引导页面下一步操作
     DELETE_GAME_ACCOUNT_REFRESH,//游戏删除账号,刷新界面
     GENERATION_ACCOUNT_REFRESH,//游戏代充,刷新界面
+    GENERATION_ACCOUNT_REFRESH_ADAPTER,//游戏代充,刷新界面(下载)
 }

+ 1 - 1
app/src/main/java/com/kfzs/duanduan/utils/ApkUtils.java

@@ -83,7 +83,7 @@ public class ApkUtils {
      */
     public static final void installApk(Context context, String apkPath) {
         if(TextUtils.isEmpty(apkPath)){
-            G.showToast(R.string.unknown_error);
+//            G.showToast(R.string.unknown_error);
             return;
         }
 

+ 22 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameAccountEntity.java

@@ -99,4 +99,26 @@ public class GameAccountEntity implements Serializable {
                 return "小米游戏" + "--" + getTypeName();
         }
     }
+    public String getDetailShowForGameType(){
+        switch (game_type){
+            case 1002:
+            default:
+                return "平台游戏" + "--" + getTypeName();
+            case 1003:
+                return "腾讯游戏" + "--" + getTypeName();
+            case 1004:
+                return "小米游戏" + "--" + getTypeName();
+        }
+    }
+    public String getDetailShowName(){
+        switch (task_type){
+            case 1002:
+            default:
+                return "平台游戏";
+            case 1003:
+                return "腾讯游戏";
+            case 1004:
+                return "小米游戏";
+        }
+    }
 }

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

@@ -12,6 +12,24 @@ public class GamePayList implements Serializable {
 
     private int gift_ratio;
     private double voucher;
+    private double agent_balance;
+    private double user_balance;
+
+    public double getAgent_balance() {
+        return agent_balance;
+    }
+
+    public void setAgent_balance(double agent_balance) {
+        this.agent_balance = agent_balance;
+    }
+
+    public double getUser_balance() {
+        return user_balance;
+    }
+
+    public void setUser_balance(double user_balance) {
+        this.user_balance = user_balance;
+    }
 
     public int getGift_ratio() {
         return gift_ratio;
@@ -29,6 +47,9 @@ public class GamePayList implements Serializable {
         this.voucher = voucher;
     }
 
+    public GamePayList() {
+    }
+
     public GamePayList(String name, String game_id) {
         this.name = name;
         this.game_id = game_id;

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

@@ -26,6 +26,16 @@ public class PayEntity implements Serializable {
 
     private String game_name;
 
+    private int tencent_platform;//腾讯充值标识平台: 1是QQ 2是微信
+
+    public int getTencent_platform() {
+        return tencent_platform;
+    }
+
+    public void setTencent_platform(int tencent_platform) {
+        this.tencent_platform = tencent_platform;
+    }
+
     public String getGame_name() {
         return TextUtils.isEmpty(game_name)?"游戏":game_name;
     }
@@ -91,7 +101,7 @@ public class PayEntity implements Serializable {
     }
 
     public String getTask_type() {
-        return task_type;
+        return TextUtils.isEmpty(task_type)?"1002":task_type;
     }
 
     public void setTask_type(String task_type) {
@@ -130,7 +140,7 @@ public class PayEntity implements Serializable {
      * 游戏详情,title显示
      */
     public String getDetailShow(){
-        switch (task_type){
+        switch (getTask_type()){
             case "1002":
             default:
                 return (TextUtils.isEmpty(game_id) || game_id.equals("0"))?"平台游戏代充" :getGame_name()+"游戏";

+ 7 - 7
app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java

@@ -52,20 +52,20 @@ public class TaskEty implements Serializable, IDownload {
     private List<ScreenshotsEntity> screenshotsList;
 
     /**
-     * 是否领取了账号 true领取了
+     * 能否领取了账号 true能领取了
      */
-    private boolean is_receive_account;
+    private boolean can_receive_account;
     /**
      * 是否预约任务 0不是 1是
      */
     private int is_reservation;
 
-    public boolean isIs_receive_account() {
-        return is_receive_account;
+    public boolean isCan_receive_account() {
+        return can_receive_account;
     }
 
-    public void setIs_receive_account(boolean is_receive_account) {
-        this.is_receive_account = is_receive_account;
+    public void setCan_receive_account(boolean can_receive_account) {
+        this.can_receive_account = can_receive_account;
     }
 
     public String getScreenshots() {
@@ -127,7 +127,7 @@ public class TaskEty implements Serializable, IDownload {
     }
 
     public String getBonus() {
-        return bonus;
+        return TextUtils.isEmpty(bonus)?"0":bonus;
     }
 
     public void setBonus(String bonus) {

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

@@ -107,7 +107,7 @@ public class TaskReleaseEty implements Serializable{
     }
 
     public String getBonus() {
-        return bonus;
+        return TextUtils.isEmpty(bonus)?"0":bonus;
     }
 
     public void setBonus(String bonus) {

+ 49 - 3
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1,5 +1,6 @@
 package com.sheep.gamegroup.util;
 
+import android.annotation.SuppressLint;
 import android.app.Activity;
 import android.content.Context;
 import android.graphics.Color;
@@ -29,6 +30,7 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.alipay.PayResult;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.model.entity.GameAccountEntity;
 import com.sheep.gamegroup.model.entity.GamePayList;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.RecyleObj;
@@ -1070,7 +1072,7 @@ public class CommonUtil {
                     public void onNext(BaseMessage baseMessage) {
                         if(baseMessage.getCode() == 200) {
                             ViewUtil.showMsgDialog(context, new DialogConfig().setTitle("预约成功")
-                                    .setMsg(String.format(Locale.CHINA, "恭喜您获得%s元绵羊币\n注意%s准时开放下载", taskReleaseEty.getTask().getBonus(),
+                                    .setMsg(String.format(Locale.CHINA, "恭喜您获得%s元绵羊币\n注意%s准时开放下载", taskReleaseEty.getBonus(),
                                             TimeUtil.TimeStamp2Date(taskReleaseEty.getTask().getAppointment_time(), "yyyy-MM-dd\u0020HH:mm")))
                                     .setBtnLeftText("收入钱包").setBtnLeftOnClickListener(new View.OnClickListener() {
                                         @Override
@@ -1181,7 +1183,7 @@ public class CommonUtil {
                 });
     }
     /**
-     * 修改游戏账号密码
+     * 获取计算可用定向消费券的数据
      */
     public void getVoucherAndRatio(final Context context, final String gameId, final Action1<BaseMessage> action1) {
         ViewUtil.newInstance().showProgress((Activity) context);
@@ -1264,15 +1266,27 @@ public class CommonUtil {
 
                     @Override
                     public void onNext(BaseMessage baseMessage) {
+
                         ViewUtil.newInstance().hideProgress((Activity) context);
+                        try {
+                            GameAccountEntity gameAccountEntity = baseMessage.getData(GameAccountEntity.class);
+                            if(gameAccountEntity != null){
+                                String text = String.format(context.getResources().getString(R.string.get_game_task_success_dialog),gameAccountEntity.getDetailShowName(),gameAccountEntity.getAccount());
+                                ViewUtil.showMsgDialog(context,
+                                        text,
+                                        "恭喜你获得"+gameAccountEntity.getDetailShowName()+"福利号");
+                            }
 
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
                         if(action1 != null)
                             action1.call(baseMessage);
                     }
                 });
     }
     /**
-     * 领取游戏账号
+     * 游戏任务
      */
     public void gameTask(final Context context, final String task_type,final String name, final Action1<BaseMessage> action1) {
         ViewUtil.newInstance().showProgress((Activity) context);
@@ -1291,6 +1305,38 @@ public class CommonUtil {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
                     @Override
                     public void onError(BaseMessage baseMessage) {
+                        ViewUtil.newInstance().hideProgress((Activity) context);
+                        G.showToast(baseMessage.getMsg());
+                        if (action1 != null)
+                            action1.call(null);
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        ViewUtil.newInstance().hideProgress((Activity) context);
+
+                        if (action1 != null)
+                            action1.call(baseMessage);
+
+                    }
+                });
+    }
+    /**
+     * 充值游戏游戏任务
+     */
+    public void gameTaskList(final Context context, final int task_type,final String name, final Action1<BaseMessage> action1) {
+
+        SheepApp.getInstance()
+                .getNetComponent()
+                .getApiService()
+                .rechargeGameList(
+                        task_type,
+                        name)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
                         G.showToast(baseMessage.getMsg());
                         if (action1 != null)
                             action1.call(null);

+ 23 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/ActGameAgencyRecharge.java

@@ -10,8 +10,10 @@ import android.util.Log;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.LinearLayout;
+import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONArray;
+import com.arialyy.aria.core.download.DownloadTask;
 import com.bumptech.glide.Glide;
 import com.kfzs.duanduan.event.BigEvent;
 import com.sheep.gamegroup.absBase.BaseActivity;
@@ -44,6 +46,7 @@ import org.greenrobot.eventbus.Subscribe;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import butterknife.BindView;
 import butterknife.ButterKnife;
@@ -240,7 +243,7 @@ public class ActGameAgencyRecharge extends BaseActivity {
                         R.mipmap.game_platform_sheep_icon,
                         "腾讯游戏代充",
                         "充值有福利",
-                        1004));
+                        1003));
                 break;
 
         }
@@ -339,6 +342,25 @@ public class ActGameAgencyRecharge extends BaseActivity {
             case GENERATION_ACCOUNT_REFRESH:
                 initData();
                 break;
+            case GENERATION_ACCOUNT_REFRESH_ADAPTER:
+                if(event.getData() instanceof DownloadTask){
+                    DownloadTask task = (DownloadTask) event.getData();
+                    try {
+                        int p = task.getPercent();    //任务进度百分比
+                        String speed = task.getConvertSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
+                        System.out.println("Aria "+task.getKey()+",p " + p + ", speed = " + speed);
+                        String url = task.getKey();
+                        TextView tvProgress = recyclerview.findViewWithTag(TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
+                        if (tvProgress == null) {
+                            return;
+                        }
+                        tvProgress.setText(String.format(Locale.CHINA, "%d%%",Math.abs(p)));
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                break;
         }
     }
 }

+ 41 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActSearchGame.java

@@ -17,6 +17,8 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONArray;
+import com.arialyy.aria.core.download.DownloadTask;
+import com.kfzs.duanduan.event.BigEvent;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.RecyleObj;
@@ -34,13 +36,18 @@ import com.sheep.gamegroup.util.ViewHolder;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.adapter.AdbCommonRecycler;
 import com.sheep.gamegroup.view.adapter.ArrayAdapter;
+import com.sheep.gamegroup.view.adapter.TryMakeMoneyAdp;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
 
 import butterknife.BindView;
 import butterknife.OnClick;
@@ -78,6 +85,7 @@ public class ActSearchGame extends BaseActivity {
 
     @Override
     public void initView() {
+        EventBus.getDefault().register(this);
         activity = this;
         TitleBarUtils.getInstance()
                 .setTitle(this, "搜索游戏")
@@ -145,6 +153,7 @@ public class ActSearchGame extends BaseActivity {
                     }
                 });
                 item.getDownloadHelper().updateDownloadTaskView(activity, taskEty, find_information_game_task);
+                find_information_game_task.setTag("PUBLIC_TAG_PREFIX_TEXTVIEW_LIST" + taskEty.getDownload_link());
             }
         };
         search_game_list.setAdapter(adapter);
@@ -319,4 +328,36 @@ public class ActSearchGame extends BaseActivity {
         }
     }
 
+    @Subscribe
+    public void onEventMainThread(BigEvent event){
+        switch (event.getEventTypes()){
+
+            case GENERATION_ACCOUNT_REFRESH_ADAPTER:
+                if(event.getData() instanceof DownloadTask){
+                    DownloadTask task = (DownloadTask) event.getData();
+                    try {
+                        int p = task.getPercent();    //任务进度百分比
+                        String speed = task.getConvertSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
+                        System.out.println("Aria "+task.getKey()+",p " + p + ", speed = " + speed);
+                        String url = task.getKey();
+                        TextView tvProgress = search_game_list.findViewWithTag(TryMakeMoneyAdp.PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
+                        if (tvProgress == null) {
+                            return;
+                        }
+                        tvProgress.setText(String.format(Locale.CHINA, "%d%%",Math.abs(p)));
+
+                    } catch (Exception e) {
+                        e.printStackTrace();
+                    }
+                }
+                break;
+        }
+    }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+
+        EventBus.getDefault().unregister(this);
+    }
 }

+ 7 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/SignCardAct.java

@@ -227,7 +227,13 @@ public class SignCardAct extends BaseActivity implements SignCardContract.View {
     public void succPunchAndSignCount(BaseMessage o) {
         PunchAndSign punchAndSign = o.getData(PunchAndSign.class);
         signTvJrcyrs.setText(String.format(getString(R.string.sign_number), punchAndSign.getPunch_count()));
-        signTvJrbmrs.setText(String.format(getString(R.string.sign_number1), punchAndSign.getSign_up_count()));
+        signTvJrbmrs.setText(
+                String.format(
+                        getString(R.string.sign_number1
+                        ),
+                        punchAndSign.getSign_up_count()
+                )
+        );
 
         signTvKpf.setText(getSpannableString(punchAndSign.getTotal_award()));//今日可分
         signTvMrcyrs.setText(getSpannableString(punchAndSign.getSign_up_count()));//明日可分

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAct.java

@@ -349,7 +349,7 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
         /**
          * detail_task_tv 游戏任务,显示
          */
-        if(taskEty.isGameTask() &&taskEty.isIs_receive_account()){
+        if(taskEty.isGameTask() &&taskEty.isCan_receive_account()){
             detailTaskTv.setVisibility(View.VISIBLE);
             detailTaskTv.setText("领取福利号");
             detailTaskTv.setBackground(activity.getResources().getDrawable(R.drawable.selector_button_full_main));
@@ -515,7 +515,7 @@ public class TaskDetailAct extends AbsChooseImageActivity implements TaskDetailC
         try {
             switch (view.getId()) {
                 case R.id.detail_task_tv://查看任务截图
-                    if(taskEty.isGameTask() &&taskEty.isIs_receive_account()){
+                    if(taskEty.isGameTask() &&taskEty.isCan_receive_account()){
 
                         GAME_INSTEAD_OF_RECHARGE_GET.onEvent();
                         CommonUtil.getInstance()

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

@@ -72,7 +72,7 @@ public class AdpGameAccount extends AdpCommonRecy<RecyleObj> {
             return;
         TextView item_title_tv = holder.itemView.findViewById(R.id.item_title_tv);
         item_title_tv.setVisibility(View.VISIBLE);
-        item_title_tv.setTextColor(context.getResources().getColor(R.color.txt_gray_e6e4e4));
+        item_title_tv.setTextColor(context.getResources().getColor(R.color.black_444444));
         item_title_tv.setPadding(3,3,3,3);
         switch (recyleObj.getRecyleType()){
             case GAME_ACCOUNT_PLATFORM:

+ 17 - 8
app/src/main/java/com/sheep/gamegroup/view/adapter/TryMakeMoneyAdp.java

@@ -293,7 +293,7 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                     }
                 }
                 task_type_tv.setText(taskTypeTvValue+"");
-                task_type_tv.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + item.getDownload_url());
+                task_type_tv.setTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + item.getDownload_url());
 //                ((TextView)viewHolder.itemView.findViewById(R.id.item_num_tv)).setText("剩余"+ item.getLast_num()+"份");
 //                ((TextView)viewHolder.itemView.findViewById(R.id.item_money)).setText("+"+ item.getBonus() +"元");
                 //任务领取
@@ -485,14 +485,21 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                 viewHolder.itemView.findViewById(R.id.cancel_task_tv).setVisibility(View.GONE);
 
                 TextView detail_task_tv = viewHolder.itemView.findViewById(R.id.detail_task_tv);
-
-
-                if(taskReleaseEty.getTask().isIs_receive_account()){
-                    detail_task_tv.setText("已有账号");
-                    detail_task_tv.setBackground(context.getResources().getDrawable(R.drawable.sp_rectangle_bg_gray_radius));
-                    detail_task_tv.setEnabled(false);
-                    viewHolder.itemView.setEnabled(false);
+                TextView detail_task_tv_down = viewHolder.itemView.findViewById(R.id.detail_task_tv_down);
+
+
+                if(!taskReleaseEty.getTask().isCan_receive_account()){
+//                    detail_task_tv.setText("已有账号");
+//                    detail_task_tv.setBackground(context.getResources().getDrawable(R.drawable.sp_rectangle_bg_gray_radius));
+//                    detail_task_tv.setEnabled(false);
+//                    viewHolder.itemView.setEnabled(false);
+                    detail_task_tv.setVisibility(View.GONE);
+                    detail_task_tv_down.setVisibility(View.VISIBLE);
+                    taskReleaseEty.getDownloadHelper().updateDownloadTaskView((Activity) context, taskEty, detail_task_tv_down);
+                    detail_task_tv_down.setTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + taskEty.getDownload_link());
                 }else {
+                    detail_task_tv.setVisibility(View.VISIBLE);
+                    detail_task_tv_down.setVisibility(View.GONE);
                     detail_task_tv.setText("领取游戏帐号");
                     detail_task_tv.setBackground(context.getResources().getDrawable(R.drawable.sp_bg_gradient_rectangle_blue));
                     detail_task_tv.setEnabled(true);
@@ -527,6 +534,8 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                                 public void call(BaseMessage baseMessage) {
                                     G.showToast("领取成功");
                                     EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.GENERATION_ACCOUNT_REFRESH));
+
+
                                 }
                             });
                     }

+ 12 - 3
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogAddAccount.java

@@ -65,6 +65,8 @@ public class DialogAddAccount {
     //qq:1 wx:2
     private int tencentType;
 
+    private boolean isSelectRadio;
+
     public DialogAddAccount(Activity activity) {
         this.activity = activity;
     }
@@ -176,9 +178,11 @@ public class DialogAddAccount {
                 message.what = 0;
                 if (id == R.id.conmon_id) {
                     message.obj = View.GONE;
+                    isSelectRadio = false;
                 }
                 if (id == R.id.fixation_id) {
                     message.obj = View.VISIBLE;
+                    isSelectRadio = true;
                 }
                 mHandler.sendMessage(message);
             }
@@ -222,8 +226,13 @@ public class DialogAddAccount {
                     return;
                 }
 
-                if(tencentType < 1){
+                if(radio_group_tencent.isShown() &&tencentType < 1){
                     G.showToast("请选择QQ或微信");
+                    return;
+                }
+                if(task_id < 1 && isSelectRadio){
+                    G.showToast("请选择游戏");
+                    return;
                 }
 
                 JSONObject jsonObject = new JSONObject();
@@ -231,7 +240,7 @@ public class DialogAddAccount {
                 jsonObject.put("password", password);
                 jsonObject.put("task_id", task_id);
                 jsonObject.put("game_type", game_type);//Todo
-                jsonObject.put("tx_plotform", tencentType);//Todo
+                jsonObject.put("tencent_platform", tencentType);//Todo
 
                 ViewUtil.newInstance().showProgress(activity);
                 SheepApp.getInstance()
@@ -251,7 +260,7 @@ public class DialogAddAccount {
                             @Override
                             public void onNext(BaseMessage baseMessage) {
                                 ViewUtil.newInstance().hideProgress(activity);
-                                G.showToast(baseMessage);
+                                G.showToast("添加成功");
                                 if(action1 != null)
                                     action1.call(1);
                                 dialog.dismiss();

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogModifyAccount.java

@@ -113,7 +113,7 @@ public class DialogModifyAccount {
                         }
 
                         JSONObject jsonObject = new JSONObject();
-                        jsonObject.put("id", 0);
+                        jsonObject.put("id", gameAccountEntity.getId());
                         jsonObject.put("password", game_new_pwd_ets);
                         CommonUtil.getInstance()
                                 .modifyGameAccount(activity, jsonObject, new Action1<Integer>() {
@@ -184,7 +184,7 @@ public class DialogModifyAccount {
     }
 
     private void initView(){
-        game_title_et.setText(gameAccountEntity.getDetailShow()+"");
+        game_title_et.setText(gameAccountEntity.getDetailShowForGameType()+"");
         game_account_et.setText("账号:"+gameAccountEntity.getAccount()+"");
         game_old_pwd_et.setText("原密码:"+gameAccountEntity.getPassword()+"");
     }

+ 64 - 15
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogPayAccount.java

@@ -2,6 +2,7 @@ package com.sheep.gamegroup.view.dialog;
 
 import android.app.Activity;
 import android.content.DialogInterface;
+import android.os.Handler;
 import android.support.v7.app.AlertDialog;
 import android.text.Editable;
 import android.text.TextUtils;
@@ -12,6 +13,8 @@ import android.view.ViewGroup;
 import android.widget.AdapterView;
 import android.widget.EditText;
 import android.widget.LinearLayout;
+import android.widget.RadioButton;
+import android.widget.RadioGroup;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
@@ -53,6 +56,10 @@ public class DialogPayAccount {
 
     private List<GamePayList> gamePayLists= new ArrayList<>();
     private EditText game_et,game_account_et,game_pay_et,game_pwd_et,game_area_et,game_role_et,game_role_id_et,game_goods_et;
+    private RadioGroup radio_group_tencent;
+    //qq:1 wx:2
+    private int tencentType;
+    private boolean isShow;
 
     public DialogPayAccount(Activity activity, PayEntity payEntity) {
         this.activity = activity;
@@ -95,18 +102,54 @@ public class DialogPayAccount {
         game_goods_et = view.findViewById(R.id.game_goods_et);
 
         /**
+         * radio_group_tencent
+         */
+        radio_group_tencent = view.findViewById(R.id.radio_group_tencent);
+        radio_group_tencent.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
+            @Override
+            public void onCheckedChanged(RadioGroup group, int checkedId) {
+
+                // 获取选中的RadioButton的id
+                int id = group.getCheckedRadioButtonId();
+                // 通过id实例化选中的这个RadioButton
+                RadioButton choise = (RadioButton) activity.findViewById(id);
+                switch (id){
+                    case R.id.conmon_id_tencent:
+                        tencentType = 1;
+                        break;
+                    case R.id.fixation_id_tencent:
+                        tencentType = 2;
+                        break;
+                }
+            }
+        });
+        if(payEntity.getTask_type().equals("1003")){
+            radio_group_tencent.setVisibility(View.VISIBLE);
+        }else {
+            radio_group_tencent.setVisibility(View.GONE);
+        }
+
+        /**
          * 游戏列表
          */
 
         game_et.addTextChangedListener(new TextWatcher() {
+            String oldStr;
             @Override
             public void beforeTextChanged(CharSequence s, int start, int count, int after) {
-
+                oldStr = s.toString();
             }
 
             @Override
             public void onTextChanged(CharSequence s, int start, int before, int count) {
-                if (!TextUtils.isEmpty(s) && s.length() > 0 && payEntity != null && CommonUtil.getInstance().clickTime(500)) {
+
+                new Handler().postDelayed(new Runnable() {
+                    @Override
+                    public void run() {
+                        isShow = false;
+                    }
+                },1000);
+                if (!TextUtils.isEmpty(s) && s.length() > 0 && payEntity != null && CommonUtil.getInstance().clickTime(500) && !isShow && !s.equals(oldStr)) {
                     intitDataAccountList(s.toString(), payEntity);
                 }
             }
@@ -135,28 +178,33 @@ public class DialogPayAccount {
                     G.showToast("请输入密码");
                     return;
                 }
-                if(showToast(game_area_et)){
-                    G.showToast("请输入区服");
-                    return;
-                }
+//                if(showToast(game_area_et)){
+//                    G.showToast("请输入区服");
+//                    return;
+//                }
                 if(showToast(game_role_et)){
                     G.showToast("请输入角色");
                     return;
                 }
-                if(showToast(game_role_id_et)){
-                    G.showToast("请输入角色ID");
-                    return;
-                }
+//                if(showToast(game_role_id_et)){
+//                    G.showToast("请输入角色ID");
+//                    return;
+//                }
                 if(showToast(game_goods_et)){
                     G.showToast("请输入商品");
                     return;
                 }
+                if(radio_group_tencent.isShown() && tencentType <1){
+                    G.showToast("请选择QQ或者微信");
+                    return;
+                }
                 payEntity.setAccount(game_account_etStr);
                 payEntity.setPwd(game_pwd_et.getText().toString().trim());
                 payEntity.setService(game_area_et.getText().toString().trim());
                 payEntity.setRole_name(game_role_et.getText().toString().trim());
                 payEntity.setRole_id(game_role_id_et.getText().toString().trim());
                 payEntity.setGoods(game_goods_et.getText().toString().trim());
+                payEntity.setTencent_platform(tencentType);
 
                 ViewUtil.showGamePay(activity, payEntity);
 
@@ -209,7 +257,7 @@ public class DialogPayAccount {
     private void intitDataAccountList(String name, PayEntity payEntity) {
 
         CommonUtil.getInstance()
-                .gameTask(activity, TextUtils.isEmpty(payEntity.getTask_type())?"1002,1003,1004":payEntity.getTask_type(), name, new Action1<BaseMessage>() {
+                .gameTaskList(activity, Integer.parseInt(payEntity.getTask_type()), name, new Action1<BaseMessage>() {
                     @Override
                     public void call(BaseMessage baseMessage) {
                         try {
@@ -231,6 +279,7 @@ public class DialogPayAccount {
                             @Override
                             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                                 GamePayList entity = (GamePayList) gamePayLists.get(position);
+                                isShow = true;
                                 game_account_et.setText(entity.getName() + "");
                                 if(payEntity == null)
                                     return;
@@ -243,7 +292,7 @@ public class DialogPayAccount {
                             @Override
                             public boolean convert(int position, View convertView, ViewGroup parent, GamePayList item) {
                                 final TextView name_tv = ViewFindUtils.find(convertView, R.id.name_tv);
-                                name_tv.setText(item + "");
+                                name_tv.setText(item.getName() + "");
                                 return true;
                             }
                         })
@@ -259,7 +308,7 @@ public class DialogPayAccount {
         if(payEntity != null ){
             switch (payEntity.getTask_type()){
                 case "1002":
-                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_account_et);
+                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_et);
                     CommonUtil.getInstance().showView(View.GONE, game_pwd_et);
                     CommonUtil.getInstance().showView(View.GONE, game_area_et);
                     CommonUtil.getInstance().showView(View.GONE, game_role_et);
@@ -267,7 +316,7 @@ public class DialogPayAccount {
                     CommonUtil.getInstance().showView(View.GONE, game_goods_et);
                     break;
                 case "1003":
-                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_account_et);
+                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_pwd_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_area_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_role_et);
@@ -275,7 +324,7 @@ public class DialogPayAccount {
                     CommonUtil.getInstance().showView(View.VISIBLE, game_goods_et);
                     break;
                 case "1004":
-                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_account_et);
+                    CommonUtil.getInstance().showView(gameId.equals("0")?View.VISIBLE:View.GONE, game_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_pwd_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_area_et);
                     CommonUtil.getInstance().showView(View.VISIBLE, game_role_et);

+ 22 - 13
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogPayGame.java

@@ -14,6 +14,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONObject;
+import com.kfzs.duanduan.utils.NumberFormatUtils;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.GamePayList;
 import com.sheep.gamegroup.model.entity.GridViewEntity;
@@ -273,6 +274,18 @@ public class DialogPayGame {
      是否用绵羊币 true:用 false:不用
      */
     private void surePay(){
+
+        if(ListUtil.hasIndex(wlLists, select)) {
+            amount = wlLists.get(select).getGridViewEntity().getValue();
+            if (TextUtils.isEmpty(amount)) {
+                G.showToast("请选择金额");
+                return;
+            }
+
+        }
+        if(!TextUtils.isEmpty(money_et.getText()) && !TextUtils.isEmpty(money_et.getText().toString().trim())){
+            amount = money_et.getText().toString().trim();
+        }
         GAME_INSTEAD_OF_RECHARGE_PAY.onEvent();
         if(list.isEmpty()){
             return;
@@ -300,11 +313,15 @@ public class DialogPayGame {
             G.showToast("请选择支付方式");
             return;
         }
+        if(TextUtils.isEmpty(amount)){
+            G.showToast("请输入正确的金额!");
+            return;
+        }
         ViewUtil.newInstance()
                 .showProgress(activity, false);
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("account", payEntity.getAccount());
-        jsonObject.put("amount", Float.valueOf(0));//todo
+        jsonObject.put("amount", Float.valueOf(amount));//todo
         jsonObject.put("game_id", payEntity.getGame_id()+"");
         jsonObject.put("pay_type", pay_type);
         jsonObject.put("use_voucher", use_voucher);
@@ -314,6 +331,7 @@ public class DialogPayGame {
         jsonObject.put("role_id", payEntity.getRole_id());
         jsonObject.put("role_name", payEntity.getRole_name());
         jsonObject.put("service", payEntity.getService());
+        jsonObject.put("tencent_platform", payEntity.getTencent_platform());
         final int finalPay_type = pay_type;
         SheepApp.getInstance().getNetComponent().getApiService().game_consumption(jsonObject)
                 .subscribeOn(Schedulers.io())
@@ -394,17 +412,6 @@ public class DialogPayGame {
                 money_et.setText("");
             }
         });
-        if(ListUtil.hasIndex(wlLists, select)) {
-            amount = wlLists.get(select).getGridViewEntity().getValue();
-            if (TextUtils.isEmpty(amount)) {
-                G.showToast("请选择金额");
-                return;
-            }
-
-        }
-        if(!TextUtils.isEmpty(money_et.getText()) && !TextUtils.isEmpty(money_et.getText().toString().trim())){
-            amount = money_et.getText().toString().trim();
-        }
 
         money_et.addTextChangedListener(new TextWatcher() {
             @Override
@@ -451,9 +458,11 @@ public class DialogPayGame {
         if(ListUtil.isEmpty(list) || gameVoucherAndRatio == null || TextUtils.isEmpty(price))
             return;
         double showPrice = gameVoucherAndRatio.getGift_ratio() * Integer.valueOf(price) /100;
-        String p = "绵羊币 (可用"+ (showPrice > gameVoucherAndRatio.getVoucher() ? gameVoucherAndRatio.getVoucher(): showPrice) +") 指非定向货币+定向货币";
+        double priceDouble = NumberFormatUtils.decimal(showPrice > gameVoucherAndRatio.getVoucher() ? gameVoucherAndRatio.getVoucher() + gameVoucherAndRatio.getUser_balance(): showPrice + gameVoucherAndRatio.getUser_balance(), 2);
+        String p = "绵羊币 (可用"+ priceDouble +") 指非定向货币+定向货币";
         TextView textView = pay_listview.getChildAt(0).findViewById(R.id.pay_game_dialog_item_tv);
         textView.setText(p);
+        list.get(0).setName(p);
         adpPayGameDialog.notifyDataSetChanged();
     }
 }

+ 5 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/service/DownloadService.java

@@ -8,12 +8,16 @@ import android.support.annotation.Nullable;
 import com.arialyy.annotations.Download;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTask;
+import com.kfzs.duanduan.event.BigEvent;
+import com.kfzs.duanduan.event.EventTypes;
 import com.kfzs.duanduan.services.DownloadTaskService;
 import com.kfzs.duanduan.utils.ApkUtils;
 import com.kfzs.duanduan.utils.dlg.HelperUtils;
 import com.kfzs.duanduan.view.DialogStorageLow;
 import com.sheep.gamegroup.util.LogUtil;
 
+import org.greenrobot.eventbus.EventBus;
+
 /**
  *  @auther realicing
  * 自动更新的Service
@@ -42,6 +46,7 @@ public class DownloadService extends Service{
     @Download.onTaskRunning protected void running(DownloadTask task) {
         LogUtil.println("DownloadService", "running", task.getKey(), task.getTaskName(), task.getPercent());
         mDownloadTaskService.setDownloadTaskPercent(task.getPercent(), task.getCurrentProgress()/1024d/1024d,task.getFileSize()/1024d/1024d,0,task.getKey());
+        EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.GENERATION_ACCOUNT_REFRESH_ADAPTER).setData(task));
     }
 
     @Download.onTaskStop void taskStop(DownloadTask task) {

+ 33 - 1
app/src/main/res/layout/dialog_pay_account.xml

@@ -35,7 +35,7 @@
         android:layout_height="wrap_content"
         android:minWidth="@dimen/view_size_150"
         android:background="@drawable/sp_bg_blue_stroke"
-        android:hint="输入游戏"
+        android:hint="输入游戏"
         android:text=""
         android:textSize="@dimen/text_size_13"
         android:padding="@dimen/content_padding_small"
@@ -100,6 +100,38 @@
         android:padding="@dimen/content_padding_small"
         android:visibility="gone"/>
 
+    <RadioGroup
+        android:id="@+id/radio_group_tencent"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal"
+        android:paddingRight="@dimen/content_padding_20"
+        android:paddingBottom="@dimen/dp_10"
+        android:paddingTop="@dimen/dp_10"
+        android:paddingLeft="@dimen/content_padding_20"
+        android:visibility="gone">
+
+        <RadioButton
+            android:id="@+id/conmon_id_tencent"
+            android:layout_width="match_parent"
+            android:layout_weight="1"
+            android:layout_height="match_parent"
+            android:text="QQ"
+            android:textSize="@dimen/text_size_13"
+            android:drawablePadding="@dimen/content_padding_5"
+            android:paddingStart="@dimen/content_padding_15"/>
+
+        <RadioButton
+            android:id="@+id/fixation_id_tencent"
+            android:layout_width="match_parent"
+            android:layout_weight="1"
+            android:layout_height="match_parent"
+            android:text="微信"
+            android:textSize="@dimen/text_size_13"
+            android:checked="false"
+            android:paddingStart="@dimen/content_padding_15"/>
+    </RadioGroup>
+
     <TextView
         android:id="@+id/pay_sure_tv"
         android:layout_width="match_parent"

+ 31 - 12
app/src/main/res/layout/try_makemoney_item_recommend.xml

@@ -127,7 +127,7 @@
             android:orientation="horizontal"
             app:layout_constraintTop_toBottomOf="@+id/item_num_tv"
             app:layout_constraintStart_toEndOf="@+id/icon_layout"
-            app:layout_constraintEnd_toStartOf="@+id/detail_task_tv"
+            app:layout_constraintEnd_toStartOf="@+id/detail_task_layout"
             app:layout_constraintStart_toStartOf="@+id/item_anem_tv"
             app:layout_constraintBottom_toBottomOf="parent"
             android:layout_marginRight="@dimen/content_padding_8">
@@ -151,20 +151,39 @@
                 android:src="@mipmap/task_game_qustion_icon"
                 android:visibility="gone"/>
         </LinearLayout>
-        <TextView
-            android:id="@+id/detail_task_tv"
+        <RelativeLayout
+            android:id="@+id/detail_task_layout"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:text="取消任务"
-            android:minWidth="@dimen/view_size_80"
-            android:textColor="@color/white"
-            android:textSize="@dimen/text_size_12"
-            android:gravity="center"
-            android:padding="@dimen/content_padding_3"
             app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintBottom_toBottomOf="parent"
-            android:layout_marginTop="@dimen/content_padding_small"
-            android:background="@drawable/sp_bg_gradient_rectangle_blue"/>
+            app:layout_constraintBottom_toBottomOf="parent">
+            <TextView
+                android:id="@+id/detail_task_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="取消任务"
+                android:minWidth="@dimen/view_size_80"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_size_12"
+                android:gravity="center"
+                android:padding="@dimen/content_padding_3"
+                android:layout_marginTop="@dimen/content_padding_small"
+                android:background="@drawable/sp_bg_gradient_rectangle_blue"/>
+            <TextView
+                android:id="@+id/detail_task_tv_down"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="取消任务"
+                android:minWidth="@dimen/view_size_80"
+                android:textColor="@color/white"
+                android:textSize="@dimen/text_size_12"
+                android:gravity="center"
+                android:padding="@dimen/content_padding_3"
+                android:layout_marginTop="@dimen/content_padding_small"
+                android:background="@drawable/sp_bg_gradient_rectangle_blue"
+                android:visibility="gone"/>
+
+        </RelativeLayout>
     </android.support.constraint.ConstraintLayout>
 
     <TextView

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -53,5 +53,6 @@
     <string name="warm_prompt_n">温馨提示</string>
     <string name="warm_prompt_content">游戏必须是在小绵羊平台下载的游戏,且游戏账号是新注册的,否者任务奖励无法使用。</string>
     <string name="warm_prompt_content_notice">注意:用户若删除游戏后,系统自动检测让其下载安装游戏。</string>
+    <string name="get_game_task_success_dialog">%1$s账号:%2$s \n  密码请在个人中心查看\n  注意:登陆后请及时修改密码哟</string>
 
 </resources>

+ 2 - 2
gradle.properties

@@ -17,8 +17,8 @@
 # org.gradle.parallel=true
 #android.injected.build.model.only.versioned = 3
 
-VERSION_NAME=2.7.0
-VERSION_CODE=2007000
+VERSION_NAME=2.8.0
+VERSION_CODE=2008000
 ANDROID_COMPILE_SDK_VERSION=27
 ANDROID_BUILD_TOOLS_VERSION=27.0.2
 ANDROID_MIN_SDK_VERSION=18