|
|
@@ -12,6 +12,8 @@ import android.widget.LinearLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.kfzs.duanduan.event.BigEvent;
|
|
|
+import com.kfzs.duanduan.event.EventTypes;
|
|
|
import com.sheep.gamegroup.absBase.BaseActivity;
|
|
|
import com.sheep.gamegroup.di.components.DaggerChangePhoneComponent;
|
|
|
import com.sheep.gamegroup.di.components.DaggerPhoneComponent;
|
|
|
@@ -30,6 +32,7 @@ import com.sheep.jiuyan.samllsheep.utils.G;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.SpUtils;
|
|
|
import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
|
|
|
|
|
|
+import org.greenrobot.eventbus.EventBus;
|
|
|
import org.xutils.ex.DbException;
|
|
|
|
|
|
import javax.inject.Inject;
|
|
|
@@ -145,18 +148,21 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
public void onTimerRest() {
|
|
|
canGetCaptchaPhone = true;
|
|
|
phoneBtnCode.setText(getString(R.string.get_captcha));
|
|
|
+ phone_btn_code_old.setText(getString(R.string.get_captcha));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onTimerTick(long millisUntilFinished, int counTime) {
|
|
|
String textStr = counTime + " s";
|
|
|
phoneBtnCode.setText(textStr);
|
|
|
+ phone_btn_code_old.setText(textStr);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public void onTimerFinish() {
|
|
|
canGetCaptchaPhone = true;
|
|
|
phoneBtnCode.setText(getString(R.string.get_captcha));
|
|
|
+ phone_btn_code_old.setText(getString(R.string.get_captcha));
|
|
|
}
|
|
|
};
|
|
|
}
|
|
|
@@ -177,7 +183,7 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
hitStr = "请输入原手机号码";
|
|
|
noticeStr = "验证原手机";
|
|
|
phoneEtAccount.setHint(hitStr+"");
|
|
|
- phoneEtAccount.setText(mobiles+"");
|
|
|
+// phoneEtAccount.setText(mobiles+"");
|
|
|
}else{
|
|
|
step = 0;
|
|
|
hitStr = "请输入手机号码";
|
|
|
@@ -209,10 +215,11 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
return;
|
|
|
}
|
|
|
step = 3;
|
|
|
+ submit();
|
|
|
break;
|
|
|
case R.id.phone_sure_tv://更换手机号
|
|
|
sec_code = phoneEtCode.getText().toString()+"";
|
|
|
-
|
|
|
+ mobile = phoneEtAccount.getText().toString() +"";
|
|
|
if(!checkPhoneInput(mobile)){
|
|
|
return;
|
|
|
}
|
|
|
@@ -242,6 +249,9 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
// Jump2View.getInstance().goPhoneLoginView(ChangeTelAct.this, 1);
|
|
|
break;
|
|
|
case R.id.phone_btn_code_old://旧手机获取验证码
|
|
|
+ if (!canGetCaptchaPhone) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
sec_code = null;
|
|
|
step = 1;
|
|
|
submit();
|
|
|
@@ -268,10 +278,14 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
case 3:
|
|
|
jsonObject.put("auth_code", auth_code+"");
|
|
|
jsonObject.put("mobile", mobile+"");
|
|
|
+ selfCountDownTimer.reset();
|
|
|
+ canGetCaptchaPhone = false;
|
|
|
+ selfCountDownTimer.start();
|
|
|
break;
|
|
|
case 4:
|
|
|
jsonObject.put("sec_code", sec_code+"");
|
|
|
jsonObject.put("auth_code", auth_code+"");
|
|
|
+ jsonObject.put("mobile", mobile+"");
|
|
|
break;
|
|
|
}
|
|
|
presenter.switchPhone(jsonObject);
|
|
|
@@ -301,10 +315,19 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
@Override
|
|
|
public void changeTelSuccess(BaseMessage o) {
|
|
|
try{
|
|
|
+// if(step == 1 || step == 3){
|
|
|
+// changeTelSuccess
|
|
|
+// }
|
|
|
if(step == 2){
|
|
|
refreshData();
|
|
|
+ phoneBtnCode.setText(getString(R.string.get_captcha));
|
|
|
+ if(selfCountDownTimer != null)
|
|
|
+ selfCountDownTimer.reset();
|
|
|
}else if(step == 4){
|
|
|
+ SpUtils.savePhone(activity,mobile);
|
|
|
G.showToast(o.getMsg()+"");
|
|
|
+
|
|
|
+ EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.REFRESH_DATA_PHONE));
|
|
|
finish();
|
|
|
}
|
|
|
if(o == null){
|
|
|
@@ -312,10 +335,10 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
|
|
|
return;
|
|
|
}
|
|
|
if(o.getData() == null || o.getData().equals("")){
|
|
|
- G.showToast(o.getMsg()+"");
|
|
|
+// G.showToast(o.getMsg()+"");
|
|
|
return;
|
|
|
}
|
|
|
- G.showToast(o.getMsg()+"");
|
|
|
+ G.showToast((o.getMsg()).equals("")?"提交成功":o.getMsg()+"");
|
|
|
JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(o.getData()));
|
|
|
auth_code = jsonObject.getString("auth_code");
|
|
|
}catch (Exception e){
|