|
|
@@ -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);
|