|
|
@@ -57,6 +57,7 @@ public class ActModifyThird extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
private String type;
|
|
|
+
|
|
|
@Override
|
|
|
public void initView() {
|
|
|
TitleBarUtils.getInstance()
|
|
|
@@ -64,17 +65,18 @@ public class ActModifyThird extends BaseActivity {
|
|
|
.setTitle(this, "验证手机号")
|
|
|
.setTitleFinish(this);
|
|
|
type = getIntent().getStringExtra("type");
|
|
|
- if(StringUtils.isMobile(DataUtil.getInstance().getUserMobile())) {
|
|
|
+ if (StringUtils.isMobile(DataUtil.getInstance().getUserMobile())) {
|
|
|
modifyThirdMobileEt.setText(DataUtil.getInstance().getUserMobile());
|
|
|
modifyThirdMobileEt.setEnabled(false);
|
|
|
}
|
|
|
- if(BuildConfig.DEBUG){
|
|
|
+ if (BuildConfig.DEBUG) {
|
|
|
modifyThirdMobileEt.setInputType(InputType.TYPE_CLASS_TEXT);
|
|
|
modifyThirdMobileEt.setFilters(new InputFilter[]{new InputFilter.LengthFilter(1000)});
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private SelfCountDownTimer selfCountDownTimer;
|
|
|
+
|
|
|
@Override
|
|
|
public void initListener() {
|
|
|
selfCountDownTimer = new SelfCountDownTimer(60 * 1000, 1000, SelfCountDownTimer.FULL_SECOND) {
|
|
|
@@ -103,10 +105,12 @@ public class ActModifyThird extends BaseActivity {
|
|
|
@Retention(RetentionPolicy.SOURCE)
|
|
|
public @interface THIRD_TYPE {
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
public void initData() {
|
|
|
genre = getIntent().getStringExtra("type");
|
|
|
}
|
|
|
+
|
|
|
@OnClick({R.id.modify_third_code_btn, R.id.modify_third_commit})
|
|
|
public void onViewClicked(View view) {
|
|
|
switch (view.getId()) {
|
|
|
@@ -118,21 +122,24 @@ public class ActModifyThird extends BaseActivity {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private String mMobile;
|
|
|
+
|
|
|
/**
|
|
|
* 获取验证码
|
|
|
* captcha string
|
|
|
- genre string
|
|
|
- enum:modifyqzone,modifywechat
|
|
|
- mobile string
|
|
|
- step string
|
|
|
- enum:first,second
|
|
|
+ * genre string
|
|
|
+ * enum:modifyqzone,modifywechat
|
|
|
+ * mobile string
|
|
|
+ * step string
|
|
|
+ * enum:first,second
|
|
|
+ *
|
|
|
* @param view
|
|
|
*/
|
|
|
public void getCaptcha(View view) {
|
|
|
//检查手机号
|
|
|
final String mobile = modifyThirdMobileEt.getText().toString().trim();
|
|
|
- if(!StringUtils.isMobile(mobile)){
|
|
|
+ if (!StringUtils.isMobile(mobile)) {
|
|
|
G.showToast("请填写正确的手机号!");
|
|
|
return;
|
|
|
}
|
|
|
@@ -161,15 +168,17 @@ public class ActModifyThird extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 检验验证码
|
|
|
+ *
|
|
|
* @param view
|
|
|
*/
|
|
|
public void toCommit(View view) {
|
|
|
final String captcha = modifyThirdCodeEt.getText().toString().trim();
|
|
|
- if(TextUtils.isEmpty(captcha)){
|
|
|
+ if (TextUtils.isEmpty(captcha)) {
|
|
|
G.showToast("请输入验证码");
|
|
|
- if(BuildConfig.DEBUG && modifyThirdMobileEt.getText().toString().length() > 11){
|
|
|
+ if (BuildConfig.DEBUG && modifyThirdMobileEt.getText().toString().length() > 11) {
|
|
|
authorization_code = modifyThirdMobileEt.getText().toString().trim();
|
|
|
modifyThird();
|
|
|
}
|
|
|
@@ -197,10 +206,11 @@ public class ActModifyThird extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
private String authorization_code;//验证手机成功后得到的token
|
|
|
|
|
|
private void modifyThird() {
|
|
|
- switch (type){
|
|
|
+ switch (type) {
|
|
|
case THIRD_TYPE_QQ:
|
|
|
modifyQQ();
|
|
|
break;
|
|
|
@@ -235,6 +245,7 @@ public class ActModifyThird extends BaseActivity {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
+
|
|
|
private void modifyWX() {
|
|
|
UMShareAPI.get(this).doOauthVerify(this, SHARE_MEDIA.WEIXIN, new UMAuthListener() {
|
|
|
@Override
|
|
|
@@ -263,14 +274,15 @@ public class ActModifyThird extends BaseActivity {
|
|
|
|
|
|
/**
|
|
|
* aaccess_token string
|
|
|
- authorization_code string
|
|
|
- open_id string
|
|
|
- platform string
|
|
|
- qzone, wechat
|
|
|
- s_from string
|
|
|
- sheep, web_sheep
|
|
|
+ * authorization_code string
|
|
|
+ * open_id string
|
|
|
+ * platform string
|
|
|
+ * qzone, wechat
|
|
|
+ * s_from string
|
|
|
+ * sheep, web_sheep
|
|
|
*/
|
|
|
private void modifyThird(String platform, String access_token, String openid) {
|
|
|
+ if (TextUtils.isEmpty(openid)) return;
|
|
|
JSONObject jsonObject = new JSONObject();
|
|
|
jsonObject.put("access_token", access_token);
|
|
|
jsonObject.put("authorization_code", authorization_code);
|
|
|
@@ -306,9 +318,10 @@ public class ActModifyThird extends BaseActivity {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
@Override
|
|
|
protected void onDestroy() {
|
|
|
- if(selfCountDownTimer != null)
|
|
|
+ if (selfCountDownTimer != null)
|
|
|
selfCountDownTimer.cancel();
|
|
|
super.onDestroy();
|
|
|
}
|