소스 검색

充值修改

liujiangyao 7 년 전
부모
커밋
5a49ffcea4

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

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

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -637,7 +637,7 @@ public interface ApiService {
     /**
      *获取游戏任务下拉列表
      */
-    @GET("app/release_task/recharge_Game_List")
+    @GET("app/release_task/recharge_game_List")
     Observable<BaseMessage> rechargeGameList(@Query("task_type") int task_type, @Query("name") String name);
 
     /**

+ 15 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/PayEntity.java

@@ -115,4 +115,19 @@ public class PayEntity implements Serializable {
     public String getTaskType(){
         return TextUtils.isEmpty(task_type) ? "0":task_type;
     }
+
+    /**
+     * 游戏详情,title显示
+     */
+    public String getDetailShow(){
+        switch (task_type){
+            case "1002":
+            default:
+                return "平台游戏";
+            case "1003":
+                return "腾讯游戏";
+            case "1004":
+                return "小米游戏";
+        }
+    }
 }

+ 7 - 0
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1258,4 +1258,11 @@ public class CommonUtil {
                     }
                 });
     }
+
+    /**
+     * show view
+     */
+    public void showView(int goneOrShow, View view){
+        view.setVisibility(goneOrShow);
+    }
 }

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

@@ -13,6 +13,7 @@ import android.widget.LinearLayout;
 
 import com.alibaba.fastjson.JSONArray;
 import com.bumptech.glide.Glide;
+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.DialogConfig;
@@ -38,6 +39,9 @@ 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;
 
@@ -81,7 +85,8 @@ public class ActGameAgencyRecharge extends BaseActivity {
 
     @Override
     public void initView() {
-        
+
+        EventBus.getDefault().register(this);
         activity = this;
         TitleBarUtils.getInstance()
                 .setTitleFinish(activity)
@@ -249,7 +254,7 @@ public class ActGameAgencyRecharge extends BaseActivity {
                 0,
                 0,
                 0,
-                 gridViewEntity.getTask_type(),
+                        task_type,
                 0)
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -331,4 +336,19 @@ public class ActGameAgencyRecharge extends BaseActivity {
         }
         refresh.setRefreshing(false);
     }
+
+    @Override
+    protected void onDestroy() {
+        super.onDestroy();
+
+        EventBus.getDefault().unregister(this);
+    }
+    @Subscribe
+    public void onEventMainThread(BigEvent event){
+        switch (event.getEventTypes()){
+            case GENERATION_ACCOUNT_REFRESH:
+                initData();
+                break;
+        }
+    }
 }

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

@@ -503,6 +503,22 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                     viewHolder.itemView.setEnabled(false);
                 }
 
+                /**
+                 * 立即充值
+                 */
+                TextView task_type_tv = viewHolder.itemView.findViewById(R.id.task_type_tv);
+                task_type_tv.setText("立即充值");
+                task_type_tv.setVisibility(View.VISIBLE);
+                task_type_tv.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View v) {
+
+                        PayEntity payEntity = new PayEntity();
+                        payEntity.setTask_type(taskEty.getTask_type()+"");
+                        payEntity.setGame_id(taskReleaseEty.getTask().getThird_task_id());
+                        ViewUtil.newInstance().showGamePayAccount((Activity) context, payEntity);
+                    }
+                });
 
                 detail_task_tv.setOnClickListener(new View.OnClickListener() {
                     @Override
@@ -512,6 +528,7 @@ public class TryMakeMoneyAdp extends AdpCommonRecy<RecyleObj> {
                                 @Override
                                 public void call(BaseMessage baseMessage) {
                                     G.showToast("领取成功");
+                                    EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.GENERATION_ACCOUNT_REFRESH));
                                 }
                             });
                     }

+ 79 - 13
app/src/main/java/com/sheep/gamegroup/view/dialog/DialogPayAccount.java

@@ -23,6 +23,7 @@ import com.sheep.gamegroup.model.entity.OrienteeringDetail;
 import com.sheep.gamegroup.model.entity.PayEntity;
 import com.sheep.gamegroup.model.entity.TaskReleaseEty;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.ViewUtil;
@@ -47,12 +48,12 @@ public class DialogPayAccount {
     private PayEntity payEntity;
 
     private List<GamePayList> gamePayLists= new ArrayList<>();
-    private EditText game_et;
+    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;
 
     public DialogPayAccount(Activity activity, PayEntity payEntity) {
         this.activity = activity;
         this.payEntity = payEntity;
-        this.gameId = (payEntity != null? payEntity.getGame_id(): "0");
+        this.gameId = (payEntity != null? (payEntity.getGame_id()== null?"0":payEntity.getGame_id()): "0");
     }
 
     public DialogPayAccount(Activity activity, String gameId) {
@@ -79,15 +80,15 @@ public class DialogPayAccount {
         dialog_title.setText("游戏中心");
 
         TextView sureTv = view.findViewById(R.id.pay_sure_tv);
-        final EditText game_account_et = view.findViewById(R.id.game_account_et);
-        final EditText game_pay_et = view.findViewById(R.id.game_pay_et);
+        game_account_et = view.findViewById(R.id.game_account_et);
+        game_pay_et = view.findViewById(R.id.game_pay_et);
 
-        final EditText game_pwd_et = view.findViewById(R.id.game_pwd_et);
+        game_pwd_et = view.findViewById(R.id.game_pwd_et);
         game_et = view.findViewById(R.id.game_et);
-        final EditText game_area_et = view.findViewById(R.id.game_area_et);
-        final EditText game_role_et = view.findViewById(R.id.game_role_et);
-        final EditText game_role_id_et = view.findViewById(R.id.game_role_id_et);
-        final EditText game_goods_et = view.findViewById(R.id.game_goods_et);
+        game_area_et = view.findViewById(R.id.game_area_et);
+        game_role_et = view.findViewById(R.id.game_role_et);
+        game_role_id_et = view.findViewById(R.id.game_role_id_et);
+        game_goods_et = view.findViewById(R.id.game_goods_et);
 
         /**
          * 游戏列表
@@ -122,10 +123,30 @@ public class DialogPayAccount {
                     G.showToast("游戏账号不能为空!");
                     return;
                 }
-                if(payEntity == null || TextUtils.isEmpty(payEntity.getGame_id())) {
+                if(payEntity == null || TextUtils.isEmpty(payEntity.getGame_id()) || gameId.equals("0")) {
                     G.showToast("请选择游戏!");
                     return;
                 }
+                if(showToast(game_pwd_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_goods_et)){
+                    G.showToast("请输入商品");
+                    return;
+                }
                 payEntity.setAccount(game_account_etStr);
                 payEntity.setPwd(game_pwd_et.getText().toString().trim());
                 payEntity.setService(game_area_et.getText().toString().trim());
@@ -156,6 +177,7 @@ public class DialogPayAccount {
         } catch (Exception e) {
             e.printStackTrace();
         }
+        initView();
     }
 
     public void initData(){
@@ -182,7 +204,6 @@ public class DialogPayAccount {
      */
     private void intitDataAccountList(String name, PayEntity payEntity) {
 
-        ViewUtil.newInstance().showProgress(activity);
         SheepApp.getInstance()
                 .getNetComponent()
                 .getApiService()
@@ -193,13 +214,11 @@ public class DialogPayAccount {
                     @Override
                     public void onError(BaseMessage baseMessage) {
 
-                        ViewUtil.newInstance().hideProgress(activity);
                         G.showToast(baseMessage.getMsg() + "");
                     }
 
                     @Override
                     public void onNext(BaseMessage baseMessage) {
-                        ViewUtil.newInstance().hideProgress(activity);
                         List<GamePayList> taskReleaseEtyList = baseMessage.getDatas(GamePayList.class);
                         if (!ListUtil.isEmpty(taskReleaseEtyList)) {
                             gamePayLists.clear();
@@ -219,6 +238,7 @@ public class DialogPayAccount {
                                 if(payEntity == null)
                                     return;
                                 payEntity.setGame_id(entity.getGame_id());
+                                gameId = entity.getGame_id();
                                 SelfPopupWindow.newInstance().hidePop();
                             }
                         },
@@ -234,4 +254,50 @@ public class DialogPayAccount {
                 .showPop();
     }
 
+    /**
+     * task_type:1002平台游戏,1003 腾讯游戏,1004 小米游戏
+     */
+    private void initView(){
+//        game_et,game_account_et,game_pay_et,game_pwd_et,game_area_et,game_role_et,game_role_id_et,game_goods_et;
+        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(View.GONE, game_pwd_et);
+                    CommonUtil.getInstance().showView(View.GONE, game_area_et);
+                    CommonUtil.getInstance().showView(View.GONE, game_role_et);
+                    CommonUtil.getInstance().showView(View.GONE, game_role_id_et);
+                    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(View.VISIBLE, game_pwd_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_area_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_role_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_role_id_et);
+                    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(View.VISIBLE, game_pwd_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_area_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_role_et);
+                    CommonUtil.getInstance().showView(View.VISIBLE, game_role_id_et);
+                    CommonUtil.getInstance().showView(View.GONE, game_goods_et);
+                    break;
+            }
+        }
+
+    }
+
+    /**
+     * 是否输入
+     */
+    private boolean showToast(EditText view){
+        if(view.isShown() && TextUtils.isEmpty(view.getText().toString().trim())){
+            return true;
+        }
+        return false;
+    }
+
 }

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

@@ -81,7 +81,7 @@ public class DialogPayGame {
     public DialogPayGame(Activity activity, PayEntity payEntity) {
         this.activity = activity;
         this.game_account_etStr = game_account_etStr;
-        this.gameId = gameId;
+        this.gameId = payEntity.getGame_id();
         this.payEntity = payEntity;
         gao = SheepApp.getInstance().getResources().getDimensionPixelSize(R.dimen.content_padding_10)*5;
         maxShowCount = Math.max(6, G.HEIGHT*3/4/gao);

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

@@ -45,7 +45,7 @@ public class SelfPopupWindow {
     private View mSelectTv;
 
     /** popup窗口里的ListView */
-    private MyListview myListview;
+    private ListView myListview;
 
     /** popup窗口 */
     private PopupWindow typeSelectPopup;
@@ -68,7 +68,7 @@ public class SelfPopupWindow {
     }
 
     public SelfPopupWindow initPopup(){
-        myListview = new MyListview(activity);
+        myListview = new ListView(activity);
         TestData();
         myListview.setAdapter(testDataAdapter);
         myListview.setOnItemClickListener(onItemClickListener);