|
|
@@ -5,7 +5,9 @@ import android.graphics.Typeface;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
+import android.text.Editable;
|
|
|
import android.text.TextUtils;
|
|
|
+import android.text.TextWatcher;
|
|
|
import android.text.method.HideReturnsTransformationMethod;
|
|
|
import android.text.method.PasswordTransformationMethod;
|
|
|
import android.util.Log;
|
|
|
@@ -15,13 +17,14 @@ import android.widget.ImageView;
|
|
|
import android.widget.TextView;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
-import com.andreabaccega.widget.FormEditText;
|
|
|
+import com.common.data.RegexUtil;
|
|
|
import com.common.hmac.Md5Util;
|
|
|
import com.core.app.Constants;
|
|
|
import com.core.base.BaseActivity;
|
|
|
import com.core.net.http.ViewUtil;
|
|
|
import com.core.utils.CommonUtil;
|
|
|
import com.core.utils.ToastUtil;
|
|
|
+import com.core.widget.ClearEditText;
|
|
|
import com.modular.login.R;
|
|
|
|
|
|
import org.json.JSONException;
|
|
|
@@ -35,6 +38,7 @@ import java.util.TimerTask;
|
|
|
|
|
|
/**
|
|
|
* Created by RaoMeng on 2017/9/21.
|
|
|
+ * 管理员信息注册页面
|
|
|
*/
|
|
|
|
|
|
public class AdminRegisterActivity extends BaseActivity implements View.OnClickListener {
|
|
|
@@ -44,20 +48,21 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
private final int UPLOAD_REGISTER_MESSAGE = 0x04;
|
|
|
|
|
|
private Button mNextStepButton;
|
|
|
- private FormEditText mAdminNameEt;
|
|
|
- private FormEditText mAdminPhoneEt;
|
|
|
- private FormEditText mAdminEmailEt;
|
|
|
- private FormEditText mAdminVerificationEt;
|
|
|
+ private ClearEditText mAdminNameEt;
|
|
|
+ private ClearEditText mAdminPhoneEt;
|
|
|
+ private ClearEditText mAdminEmailEt;
|
|
|
+ private ClearEditText mAdminVerificationEt;
|
|
|
private TextView mAdminObtainCodeTv;
|
|
|
- private FormEditText mAdminPasswordEt;
|
|
|
+ private ClearEditText mAdminPasswordEt;
|
|
|
private ImageView mAdminPasswordVisiableIv;
|
|
|
+ private TextView mNameErrorTextView, mPhoneErrorTextView, mEmailErrorTextView, mCodeErrorTextView, mPasswordErrorTextView;
|
|
|
private boolean isPasswordVisiable = false;
|
|
|
private String mCheckcodeToken, mCompanyName = "", mIndustry = "", mAddress = "", mLatitude = "", mLongitude;
|
|
|
+ private boolean isNameAdopt = false, isPhoneAdopt = false, isEmailAdopt = false, isCodeAdopt = false, isPasswordAdopt = false;
|
|
|
|
|
|
private Handler mHandler = new Handler() {
|
|
|
@Override
|
|
|
public void handleMessage(Message msg) {
|
|
|
- progressDialog.dismiss();
|
|
|
String result = null;
|
|
|
if (msg.what != VERIFICATION_TIME_TASK) {
|
|
|
result = msg.getData().getString("result");
|
|
|
@@ -65,15 +70,31 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
}
|
|
|
switch (msg.what) {
|
|
|
case OBTAIN_VERIFICATION_CODE:
|
|
|
+ progressDialog.dismiss();
|
|
|
if (result != null) {
|
|
|
try {
|
|
|
JSONObject resultObject = new JSONObject(result);
|
|
|
if (resultObject.optBoolean("success")) {
|
|
|
JSONObject contentObject = resultObject.optJSONObject("content");
|
|
|
if (contentObject != null) {
|
|
|
+ mFlag = 60;
|
|
|
+ mTimer = new Timer();
|
|
|
+ mTimer.schedule(new TimerTask() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ Message message = Message.obtain();
|
|
|
+ message.what = VERIFICATION_TIME_TASK;
|
|
|
+ mHandler.sendMessage(message);
|
|
|
+ }
|
|
|
+ }, 0, 1000);
|
|
|
+
|
|
|
+ ToastUtil.showToast(AdminRegisterActivity.this
|
|
|
+ , "验证码已发送,请注意接收");
|
|
|
mCheckcodeToken = contentObject.optString("token");
|
|
|
} else {
|
|
|
progressDialog.dismiss();
|
|
|
+ mAdminObtainCodeTv.setEnabled(true);
|
|
|
+ mAdminObtainCodeTv.setText("获取验证码");
|
|
|
ToastUtil.showToast(AdminRegisterActivity.this
|
|
|
, "验证码获取失败,请重试");
|
|
|
}
|
|
|
@@ -82,10 +103,17 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
String errMsg = resultObject.optString("errMsg");
|
|
|
ToastUtil.showToast(AdminRegisterActivity.this
|
|
|
, TextUtils.isEmpty(errMsg) ? "验证码获取失败,请重试" : errMsg);
|
|
|
+ mAdminObtainCodeTv.setEnabled(true);
|
|
|
+ mAdminObtainCodeTv.setText("获取验证码");
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ } else {
|
|
|
+ mAdminObtainCodeTv.setEnabled(true);
|
|
|
+ mAdminObtainCodeTv.setText("获取验证码");
|
|
|
+ ToastUtil.showToast(AdminRegisterActivity.this
|
|
|
+ , "验证码获取失败,请重试");
|
|
|
}
|
|
|
break;
|
|
|
case ADMIN_REGISTER:
|
|
|
@@ -98,8 +126,16 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
// intent.setClass(AdminRegisterActivity.this, EnterpriseCompleteActivity.class);
|
|
|
// startActivity(intent);
|
|
|
// finish();*/
|
|
|
- uploadMsg();
|
|
|
+ JSONObject content = resultObject.optJSONObject("content");
|
|
|
+ String enUU = "";
|
|
|
+ String imid = "";
|
|
|
+ if (content != null) {
|
|
|
+ enUU = content.optString("enUU");
|
|
|
+ imid = content.optString("imid");
|
|
|
+ }
|
|
|
+ uploadMsg(enUU, imid);
|
|
|
} else {
|
|
|
+ progressDialog.dismiss();
|
|
|
String errMsg = resultObject.optString("errMsg");
|
|
|
ToastUtil.showToast(AdminRegisterActivity.this, errMsg);
|
|
|
}
|
|
|
@@ -118,6 +154,9 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
intent.setClass(AdminRegisterActivity.this, EnterpriseCompleteActivity.class);
|
|
|
startActivity(intent);
|
|
|
finish();
|
|
|
+ } else {
|
|
|
+ String resultMsg = resultObject.optString("resultMsg");
|
|
|
+ ToastUtil.showToast(AdminRegisterActivity.this, resultMsg);
|
|
|
}
|
|
|
} catch (JSONException e) {
|
|
|
e.printStackTrace();
|
|
|
@@ -147,6 +186,98 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
private int mFlag;
|
|
|
private Timer mTimer;
|
|
|
|
|
|
+ private TextWatcher mNameTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString();
|
|
|
+ nameAdopt(text);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ private TextWatcher mPhoneTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString();
|
|
|
+ phoneAdopt(text);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+ private TextWatcher mEmailTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString();
|
|
|
+ emailAdopt(text);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ private TextWatcher mCodeTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString();
|
|
|
+ codeAdopt(text);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
+
|
|
|
+ private TextWatcher mPasswordTextWatcher = new TextWatcher() {
|
|
|
+ @Override
|
|
|
+ public void beforeTextChanged(CharSequence s, int start, int count, int after) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void onTextChanged(CharSequence s, int start, int before, int count) {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void afterTextChanged(Editable s) {
|
|
|
+ String text = s.toString();
|
|
|
+ passwordAdopt(text);
|
|
|
+ }
|
|
|
+ };
|
|
|
+
|
|
|
@Override
|
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
|
super.onCreate(savedInstanceState);
|
|
|
@@ -160,15 +291,20 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
|
|
|
private void initViews() {
|
|
|
mNextStepButton = (Button) findViewById(R.id.admin_register_next_step_btn);
|
|
|
- mAdminNameEt = (FormEditText) findViewById(R.id.admin_register_name_et);
|
|
|
- mAdminPhoneEt = (FormEditText) findViewById(R.id.admin_register_phone_et);
|
|
|
- mAdminEmailEt = (FormEditText) findViewById(R.id.admin_register_email_et);
|
|
|
- mAdminVerificationEt = (FormEditText) findViewById(R.id.admin_register_verification_et);
|
|
|
+ mAdminNameEt = (ClearEditText) findViewById(R.id.admin_register_name_et);
|
|
|
+ mAdminPhoneEt = (ClearEditText) findViewById(R.id.admin_register_phone_et);
|
|
|
+ mAdminEmailEt = (ClearEditText) findViewById(R.id.admin_register_email_et);
|
|
|
+ mAdminVerificationEt = (ClearEditText) findViewById(R.id.admin_register_verification_et);
|
|
|
mAdminObtainCodeTv = (TextView) findViewById(R.id.admin_register_obtain_code_tv);
|
|
|
- mAdminPasswordEt = (FormEditText) findViewById(R.id.admin_register_password_et);
|
|
|
+ mAdminPasswordEt = (ClearEditText) findViewById(R.id.admin_register_password_et);
|
|
|
mAdminPasswordEt.setTypeface(Typeface.DEFAULT);
|
|
|
mAdminPasswordEt.setTransformationMethod(new PasswordTransformationMethod());
|
|
|
mAdminPasswordVisiableIv = (ImageView) findViewById(R.id.admin_register_password_visiable_iv);
|
|
|
+ mNameErrorTextView = (TextView) findViewById(R.id.admin_register_name_error_tv);
|
|
|
+ mPhoneErrorTextView = (TextView) findViewById(R.id.admin_register_phone_error_tv);
|
|
|
+ mEmailErrorTextView = (TextView) findViewById(R.id.admin_register_email_error_tv);
|
|
|
+ mCodeErrorTextView = (TextView) findViewById(R.id.admin_register_code_error_tv);
|
|
|
+ mPasswordErrorTextView = (TextView) findViewById(R.id.admin_register_password_error_tv);
|
|
|
|
|
|
Intent intent = getIntent();
|
|
|
if (intent != null) {
|
|
|
@@ -184,28 +320,89 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
mNextStepButton.setOnClickListener(this);
|
|
|
mAdminObtainCodeTv.setOnClickListener(this);
|
|
|
mAdminPasswordVisiableIv.setOnClickListener(this);
|
|
|
+
|
|
|
+ mAdminNameEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ nameAdopt(mAdminNameEt.getText().toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mAdminPhoneEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ phoneAdopt(mAdminPhoneEt.getText().toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mAdminEmailEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ emailAdopt(mAdminEmailEt.getText().toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mAdminVerificationEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ codeAdopt(mAdminVerificationEt.getText().toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mAdminPasswordEt.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
|
|
+ @Override
|
|
|
+ public void onFocusChange(View v, boolean hasFocus) {
|
|
|
+ passwordAdopt(mAdminPasswordEt.getText().toString());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ mAdminNameEt.addTextChangedListener(mNameTextWatcher);
|
|
|
+ mAdminPhoneEt.addTextChangedListener(mPhoneTextWatcher);
|
|
|
+ mAdminEmailEt.addTextChangedListener(mEmailTextWatcher);
|
|
|
+ mAdminObtainCodeTv.addTextChangedListener(mCodeTextWatcher);
|
|
|
+ mAdminPasswordEt.addTextChangedListener(mPasswordTextWatcher);
|
|
|
}
|
|
|
|
|
|
- private void uploadMsg() {
|
|
|
+ private void uploadMsg(String enUU, String imid) {
|
|
|
String url = "http://113.105.74.140:8092/user/appSaveCompany";
|
|
|
+// String url = "http://192.168.253.136:8092/user/appSaveCompany";
|
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
- map.put("sc_company", mCompanyName);
|
|
|
+ map.put("sc_uu", enUU);
|
|
|
+ map.put("sc_companyname", mCompanyName);
|
|
|
map.put("sc_industry", mIndustry);
|
|
|
map.put("sc_address", mAddress);
|
|
|
map.put("sc_adminname", mAdminNameEt.getText().toString());
|
|
|
map.put("sc_telephone", mAdminPhoneEt.getText().toString());
|
|
|
map.put("sc_longitude", mLongitude);
|
|
|
map.put("sc_latitude", mLatitude);
|
|
|
+ String industrycode = "0";
|
|
|
+ if ("医疗".equals(mIndustry)) {
|
|
|
+ industrycode = "10001";
|
|
|
+ } else if ("运动健身".equals(mIndustry)) {
|
|
|
+ industrycode = "10002";
|
|
|
+ } else if ("餐饮".equals(mIndustry)) {
|
|
|
+ industrycode = "10003";
|
|
|
+ } else if ("美容美发".equals(mIndustry)) {
|
|
|
+ industrycode = "10004";
|
|
|
+ } else if ("会所".equals(mIndustry)) {
|
|
|
+ industrycode = "10005";
|
|
|
+ } else if ("KTV".equals(mIndustry)) {
|
|
|
+ industrycode = "10006";
|
|
|
+ }
|
|
|
+ map.put("sc_industrycode", industrycode);
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("map", JSON.toJSON(map).toString());
|
|
|
+ params.put("imid", TextUtils.isEmpty(imid) ? "0" : imid);
|
|
|
params.put("telephone", mAdminPhoneEt.getText().toString());
|
|
|
params.put("password", Md5Util.toMD5(mAdminPasswordEt.getText().toString()));
|
|
|
params.put("nickname", mAdminNameEt.getText().toString());
|
|
|
params.put("description", "UU互联");
|
|
|
params.put("sex", "0");
|
|
|
params.put("birthday", "946656000");
|
|
|
+
|
|
|
+ Log.d("uploadparams", params.toString());
|
|
|
LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
ViewUtil.httpSendRequest(this, url, params, mHandler, headers, UPLOAD_REGISTER_MESSAGE, null, null, "post");
|
|
|
@@ -215,18 +412,10 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
public void onClick(View v) {
|
|
|
int id = v.getId();
|
|
|
if (id == R.id.admin_register_next_step_btn) {
|
|
|
- FormEditText[] allFields = {mAdminNameEt, mAdminPhoneEt
|
|
|
- , mAdminEmailEt, mAdminVerificationEt, mAdminPasswordEt};
|
|
|
-
|
|
|
- boolean allValid = true;
|
|
|
- for (FormEditText field : allFields) {
|
|
|
- allValid = field.testValidity() && allValid;
|
|
|
- }
|
|
|
-
|
|
|
- if (allValid) {
|
|
|
+ if (isNameAdopt && isPhoneAdopt && isEmailAdopt && isCodeAdopt && isPasswordAdopt) {
|
|
|
progressDialog.show();
|
|
|
|
|
|
- String url = "http://192.168.253.66:8082/sso/mobile/userspace/setAdmin";
|
|
|
+ String url = "https://account.ubtob.com/sso/mobile/userspace/setAdmin";
|
|
|
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
params.put("adminName", mAdminNameEt.getText().toString());
|
|
|
@@ -241,41 +430,30 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
ViewUtil.httpSendRequest(this, url, params, mHandler, headers, ADMIN_REGISTER, null, null, "post");
|
|
|
|
|
|
} else {
|
|
|
- // EditText are going to appear with an exclamation mark and an explicative message.
|
|
|
+ ToastUtil.showToast(this, "请完善管理员注册信息");
|
|
|
}
|
|
|
|
|
|
-
|
|
|
} else if (id == R.id.admin_register_obtain_code_tv) {
|
|
|
- FormEditText[] allFields = {mAdminPhoneEt, mAdminEmailEt};
|
|
|
+ if (isPhoneAdopt && isEmailAdopt) {
|
|
|
+ if (CommonUtil.isNetWorkConnected(this)) {
|
|
|
+ mAdminObtainCodeTv.setEnabled(false);
|
|
|
+ mAdminObtainCodeTv.setText("验证码获取中...");
|
|
|
|
|
|
- boolean allValid = true;
|
|
|
- for (FormEditText field : allFields) {
|
|
|
- allValid = field.testValidity() && allValid;
|
|
|
- }
|
|
|
-
|
|
|
- if (allValid) {
|
|
|
- mFlag = 10;
|
|
|
- mTimer = new Timer();
|
|
|
- mTimer.schedule(new TimerTask() {
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
- Message message = Message.obtain();
|
|
|
- message.what = VERIFICATION_TIME_TASK;
|
|
|
- mHandler.sendMessage(message);
|
|
|
- }
|
|
|
- }, 0, 1000);
|
|
|
-
|
|
|
-
|
|
|
- progressDialog.show();
|
|
|
- String url = "http://192.168.253.66:8082/sso/userspace/checkcode";
|
|
|
- Map<String, Object> params = new HashMap<>();
|
|
|
- params.put("tel", mAdminPhoneEt.getText().toString());
|
|
|
- params.put("email", mAdminEmailEt.getText().toString());
|
|
|
- params.put("pageToken", CommonUtil.getSharedPreferences(ct, "pageToken"));
|
|
|
- LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
- headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
- ViewUtil.httpSendRequest(this, url, params, mHandler, headers, OBTAIN_VERIFICATION_CODE, null, null, "get");
|
|
|
+ progressDialog.show();
|
|
|
+ String url = "https://account.ubtob.com/sso/userspace/checkcode";
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
+ params.put("tel", mAdminPhoneEt.getText().toString());
|
|
|
+ params.put("email", mAdminEmailEt.getText().toString());
|
|
|
+ params.put("pageToken", CommonUtil.getSharedPreferences(ct, "pageToken"));
|
|
|
+ LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
|
|
|
+ headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
|
|
|
+ ViewUtil.httpSendRequest(this, url, params, mHandler, headers, OBTAIN_VERIFICATION_CODE, null, null, "get");
|
|
|
+ } else {
|
|
|
+ ToastUtil.showToast(this, R.string.networks_out);
|
|
|
+ }
|
|
|
|
|
|
+ } else {
|
|
|
+ ToastUtil.showToast(this, "请填写正确的手机号和邮箱");
|
|
|
}
|
|
|
} else if (id == R.id.admin_register_password_visiable_iv) {
|
|
|
isPasswordVisiable = !isPasswordVisiable;
|
|
|
@@ -290,4 +468,68 @@ public class AdminRegisterActivity extends BaseActivity implements View.OnClickL
|
|
|
mAdminPasswordEt.setSelection(mAdminPasswordEt.getText().length());
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ private void passwordAdopt(String text) {
|
|
|
+ if (TextUtils.isEmpty(text)) {
|
|
|
+ mPasswordErrorTextView.setVisibility(View.VISIBLE);
|
|
|
+ isPasswordAdopt = false;
|
|
|
+ } else {
|
|
|
+ mPasswordErrorTextView.setVisibility(View.INVISIBLE);
|
|
|
+ isPasswordAdopt = true;
|
|
|
+ }
|
|
|
+ isRegButtonEnable();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void nameAdopt(String text) {
|
|
|
+ if (TextUtils.isEmpty(text)) {
|
|
|
+ mNameErrorTextView.setVisibility(View.VISIBLE);
|
|
|
+ isNameAdopt = false;
|
|
|
+ } else {
|
|
|
+ mNameErrorTextView.setVisibility(View.INVISIBLE);
|
|
|
+ isNameAdopt = true;
|
|
|
+ }
|
|
|
+ isRegButtonEnable();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void phoneAdopt(String text) {
|
|
|
+ if (TextUtils.isEmpty(text) || !RegexUtil.checkRegex(text, RegexUtil.REGEX_MOBILE)) {
|
|
|
+ mPhoneErrorTextView.setVisibility(View.VISIBLE);
|
|
|
+ isPhoneAdopt = false;
|
|
|
+ } else {
|
|
|
+ mPhoneErrorTextView.setVisibility(View.INVISIBLE);
|
|
|
+ isPhoneAdopt = true;
|
|
|
+ }
|
|
|
+ isRegButtonEnable();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void emailAdopt(String text) {
|
|
|
+ if (TextUtils.isEmpty(text) || !RegexUtil.checkRegex(text, RegexUtil.REGEX_EMAIL)) {
|
|
|
+ mEmailErrorTextView.setVisibility(View.VISIBLE);
|
|
|
+ isEmailAdopt = false;
|
|
|
+ } else {
|
|
|
+ mEmailErrorTextView.setVisibility(View.INVISIBLE);
|
|
|
+ isEmailAdopt = true;
|
|
|
+ }
|
|
|
+ isRegButtonEnable();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void codeAdopt(String text) {
|
|
|
+ if (TextUtils.isEmpty(text)) {
|
|
|
+ mCodeErrorTextView.setVisibility(View.VISIBLE);
|
|
|
+ isCodeAdopt = false;
|
|
|
+ } else {
|
|
|
+ mCodeErrorTextView.setVisibility(View.INVISIBLE);
|
|
|
+ isCodeAdopt = true;
|
|
|
+ }
|
|
|
+ isRegButtonEnable();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void isRegButtonEnable() {
|
|
|
+ if (isNameAdopt && isPhoneAdopt && isEmailAdopt && isCodeAdopt && isPasswordAdopt) {
|
|
|
+ mNextStepButton.setEnabled(true);
|
|
|
+ } else {
|
|
|
+ mNextStepButton.setEnabled(false);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|