|
|
@@ -63,24 +63,24 @@ public class RegisterActivity extends BaseActivity {
|
|
|
@OnClick(R.id.getCode)
|
|
|
public void getCode() {
|
|
|
String phone = phoneEdit.getText().toString();
|
|
|
- if(TextUtils.isEmpty(phone)) {
|
|
|
+ if (TextUtils.isEmpty(phone)) {
|
|
|
showToast("请输入手机号");
|
|
|
return;
|
|
|
}
|
|
|
- if(!CommonUtils.isPhone(phone)) {
|
|
|
+ if (!CommonUtils.isPhone(phone)) {
|
|
|
showToast("手机号不正确");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
code = CodeUtils.randomCode();
|
|
|
- String codeStr = CodeUtils.getCodeStr(0,code);
|
|
|
+ String codeStr = CodeUtils.getCodeStr(0, code);
|
|
|
showLoading();
|
|
|
- UserService.getCode(phone,codeStr, new RequestCallback(){
|
|
|
+ UserService.getCode(phone, code, new RequestCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(String result) {
|
|
|
hideLoading();
|
|
|
ChmoApplication.getApp().setCode(code);
|
|
|
- codeCounter = new VerifyCodeCounter(60000,1000,getCodeBtn);
|
|
|
+ codeCounter = new VerifyCodeCounter(60000, 1000, getCodeBtn);
|
|
|
codeCounter.start();
|
|
|
}
|
|
|
|
|
|
@@ -100,37 +100,37 @@ public class RegisterActivity extends BaseActivity {
|
|
|
final String password = passwordEdit.getText().toString();
|
|
|
String confirmPwd = confirmPwdEdit.getText().toString();
|
|
|
String code = codeEdit.getText().toString();
|
|
|
- if(TextUtils.isEmpty(nickName)) {
|
|
|
+ if (TextUtils.isEmpty(nickName)) {
|
|
|
showToast("请输入昵称");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(TextUtils.isEmpty(phone)) {
|
|
|
+ if (TextUtils.isEmpty(phone)) {
|
|
|
showToast("请输入手机号");
|
|
|
return;
|
|
|
}
|
|
|
- if(!CommonUtils.isPhone(phone)) {
|
|
|
+ if (!CommonUtils.isPhone(phone)) {
|
|
|
showToast("手机号不正确");
|
|
|
return;
|
|
|
}
|
|
|
- if(TextUtils.isEmpty(password)){
|
|
|
+ if (TextUtils.isEmpty(password)) {
|
|
|
showToast("请输入密码");
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if(password.length() < 6){
|
|
|
+ if (password.length() < 6) {
|
|
|
showToast("密码长度不少于6位");
|
|
|
return;
|
|
|
}
|
|
|
- if(!password.equals(confirmPwd)) {
|
|
|
+ if (!password.equals(confirmPwd)) {
|
|
|
showToast("确认密码不一致");
|
|
|
return;
|
|
|
}
|
|
|
- if(TextUtils.isEmpty(code)){
|
|
|
+ if (TextUtils.isEmpty(code)) {
|
|
|
showToast("请输入验证码");
|
|
|
return;
|
|
|
}
|
|
|
- if(!code.equals(this.code)) {
|
|
|
+ if (!code.equals(this.code)) {
|
|
|
showToast("验证码不正确");
|
|
|
return;
|
|
|
}
|
|
|
@@ -141,14 +141,14 @@ public class RegisterActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
showLoading();
|
|
|
- UserService.register(nickName, phone, password, new RequestCallback(){
|
|
|
+ UserService.register(nickName, phone, password, new RequestCallback() {
|
|
|
@Override
|
|
|
public void onSuccess(String result) {
|
|
|
hideLoading();
|
|
|
RegisterRes res = new Gson().fromJson(result, RegisterRes.class);
|
|
|
- if(res.msg.equals("fail")) {
|
|
|
+ if (res.msg.equals("fail")) {
|
|
|
showToast(TextUtils.isEmpty(res.value) ? "注册失败" : res.value);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
//注册成功
|
|
|
showToast("注册成功");
|
|
|
SpManager.getInstance().setString("LoginPhone", phone);
|
|
|
@@ -167,10 +167,9 @@ public class RegisterActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
@OnClick(R.id.container)
|
|
|
public void containerClick() {
|
|
|
- CommonUtils.closeKeybord(phoneEdit,this);
|
|
|
+ CommonUtils.closeKeybord(phoneEdit, this);
|
|
|
}
|
|
|
|
|
|
@OnClick(R.id.protocol)
|