|
@@ -10,15 +10,21 @@ import android.widget.ImageView;
|
|
|
import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
+import com.common.library.okhttp.callback.Callback;
|
|
|
+import com.google.gson.Gson;
|
|
|
import com.ynstkz.shitu.android.R;
|
|
|
import com.ynstkz.shitu.android.application.STSign;
|
|
|
+import com.ynstkz.shitu.android.base.BaseBean;
|
|
|
import com.ynstkz.shitu.android.base.TitleBarActivity;
|
|
|
+import com.ynstkz.shitu.android.data.RequestGroup;
|
|
|
import com.ynstkz.shitu.android.event.UserInfoChangeEvent;
|
|
|
import com.ynstkz.shitu.android.listener.CheckVerifyCodeCallback;
|
|
|
|
|
|
import org.greenrobot.eventbus.EventBus;
|
|
|
|
|
|
import butterknife.Bind;
|
|
|
+import okhttp3.Call;
|
|
|
+import okhttp3.Response;
|
|
|
|
|
|
/**
|
|
|
* 作者:fuchangle on 2018/2/23 09:19
|
|
@@ -39,6 +45,7 @@ public class AlterPhoneNumberCheckActivity extends TitleBarActivity implements C
|
|
|
@Bind(R.id.btn_submit)
|
|
|
Button btnSubmit;
|
|
|
|
|
|
+ private String oldPhoneNum;
|
|
|
private String phoneNumber;
|
|
|
|
|
|
@Override
|
|
@@ -60,6 +67,7 @@ public class AlterPhoneNumberCheckActivity extends TitleBarActivity implements C
|
|
|
|
|
|
private void initData(){
|
|
|
phoneNumber = getIntent().getStringExtra("phoneNumber");
|
|
|
+ oldPhoneNum = getIntent().getStringExtra("oldPhoneNum");
|
|
|
tvPhoneNumber.setText(phoneNumber);
|
|
|
}
|
|
|
|
|
@@ -84,10 +92,41 @@ public class AlterPhoneNumberCheckActivity extends TitleBarActivity implements C
|
|
|
@Override
|
|
|
public void isVerifyCodeSuccess(int type, String phoneNumber, String code, boolean isSuccess) {
|
|
|
if(type == 4 && isSuccess){
|
|
|
- showToast("修改成功!");
|
|
|
- setResult(RESULT_OK);
|
|
|
- EventBus.getDefault().post(new UserInfoChangeEvent());
|
|
|
- finish();
|
|
|
+ alterPhoneNumber(oldPhoneNum, phoneNumber, code);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改手机号
|
|
|
+ * @param oldMobile
|
|
|
+ * @param mobile
|
|
|
+ * @param code
|
|
|
+ */
|
|
|
+ private void alterPhoneNumber(String oldMobile, final String mobile, String code) {
|
|
|
+
|
|
|
+ RequestGroup.alterPhoneNumber(oldMobile, mobile, code, new Callback() {
|
|
|
+ @Override
|
|
|
+ public Object parseNetworkResponse(Response response, int id) throws Exception {
|
|
|
+ return new Gson().fromJson(response.body().string(), BaseBean.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onError(Call call, Exception e, int id) {
|
|
|
+ showToast(getString(R.string.error_msg));
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onResponse(Object response, int id) {
|
|
|
+ BaseBean baseBean = (BaseBean)response;
|
|
|
+ if(baseBean != null) {
|
|
|
+ if("200".equals(baseBean.getCode())) {
|
|
|
+ setResult(RESULT_OK);
|
|
|
+ EventBus.getDefault().post(new UserInfoChangeEvent());
|
|
|
+ finish();
|
|
|
+ }
|
|
|
+ showToast(baseBean.getMsg());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|