| | |
| | | import android.os.Handler; |
| | | import android.os.Message; |
| | | import android.view.View; |
| | | import android.widget.CheckBox; |
| | | import android.widget.EditText; |
| | | import android.widget.LinearLayout; |
| | | import android.widget.TextView; |
| | |
| | | private TextView tv_obtain_verfication_code; |
| | | private EditText et_pwd; |
| | | private TextView tv_confirm; |
| | | private CheckBox cb_user_agreement; |
| | | |
| | | @Override |
| | | protected void onCreate(Bundle arg0) { |
| | |
| | | tv_obtain_verfication_code = (TextView) findViewById(R.id.tv_obtain_verfication_code); |
| | | et_pwd = (EditText) findViewById(R.id.et_pwd); |
| | | tv_confirm = (TextView) findViewById(R.id.tv_confirm); |
| | | cb_user_agreement = findViewById(R.id.cb_user_agreement); |
| | | tv_obtain_verfication_code.setOnClickListener(this); |
| | | tv_confirm.setOnClickListener(this); |
| | | findViewById(R.id.tv_back).setOnClickListener(this); |
| | | findViewById(R.id.tv_user_agreement_click).setOnClickListener(new View.OnClickListener() { |
| | | @Override |
| | | public void onClick(View v) { |
| | | cb_user_agreement.setChecked(!cb_user_agreement.isChecked()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | | public void onClick(View v) { |
| | | switch (v.getId()) { |
| | | case R.id.tv_obtain_verfication_code: |
| | | case R.id.tv_obtain_verfication_code: { |
| | | String email = et_email.getText().toString(); |
| | | if (StringUtils.isEmpty(email)) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请先输入邮箱号"); |
| | | return; |
| | | } else { |
| | | Matcher m = IsEmail.isEmailAddress().matcher(email); |
| | | if (m.matches()) { |
| | | getVerficationCode(email); |
| | | } else { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | return; |
| | | } |
| | | } |
| | | break; |
| | | case R.id.tv_confirm: |
| | | if (!cb_user_agreement.isChecked()) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请同意《用户使用协议》与《隐私政策》"); |
| | | return; |
| | | } |
| | | Matcher m = IsEmail.isEmailAddress().matcher(email); |
| | | if (m.matches()) { |
| | | getVerficationCode(email); |
| | | } else { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | break; |
| | | case R.id.tv_confirm: { |
| | | String str = et_email.getText().toString(); |
| | | if (StringUtils.isEmpty(str)) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请先输入邮箱号"); |
| | | return; |
| | | } else { |
| | | Matcher m = IsEmail.isEmailAddress().matcher(str); |
| | | if (!m.matches()) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | return; |
| | | } |
| | | } |
| | | |
| | | if (!cb_user_agreement.isChecked()) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "请同意《用户使用协议》与《隐私政策》"); |
| | | return; |
| | | } |
| | | |
| | | Matcher m = IsEmail.isEmailAddress().matcher(str); |
| | | if (!m.matches()) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "输入的邮箱账号有误,请查证!"); |
| | | return; |
| | | } |
| | | |
| | | if (StringUtils.isEmpty(et_pwd.getText().toString())) { |
| | | SingleToast.showToast(ForgetPwdActivity.this, "密码不能为空!"); |
| | | return; |
| | |
| | | return; |
| | | } |
| | | revisePwd(); |
| | | break; |
| | | } |
| | | break; |
| | | case R.id.tv_back: |
| | | finish(); |
| | | break; |