App6 for group buying with imitation handles -- registration interface, app6 for group buying with imitation handles --
Get Verification Code
Case R. id. register_btn_getCode: mPhoneNumber = mEtPhoneNumber. getText (). toString (); if (LoginHelperUtil. isPhoneNumber (mPhoneNumber) {BmobManager. getInstance (new BmobMsgSendCallback () {@ Override public void onMsgSendSuccess () {ToastUtil. show (RegisterActivity. this, R. string. sms_code_send_success); // The verification code is successfully sent. The countdown setCodeTimeDown () ;}@ Override public void onMsgSendFailure () {ToastUtil. show (RegisterActivity. this, R. string. sms_code_send_failure );}}). sendMsgCode (mPhoneNumber);} else {ToastUtil. show (this, R. string. phone_number_incorrect);} break;
private void setCodeTimeDown() { mBtnGetCode.setEnabled(false); final Timer timer = new Timer(); mSecCount = 60; TimerTask timerTask = new TimerTask() { @Override public void run() { runOnUiThread(new Runnable() { @Override public void run() { mSecCount--; mBtnGetCode.setText(mSecCount+" s"); if (mSecCount<=0) { timer.cancel(); mBtnGetCode.setText(R.string.reSend); mBtnGetCode.setEnabled(true); } } }); } }; timer.schedule(timerTask,1000,1000);}
Register
case R.id.register_btn_register: mPhoneNumber = mEtPhoneNumber.getText().toString(); mMsgCode = mEtCode.getText().toString(); mPassword = mEtPassword.getText().toString(); mRepassword = mEtRepassword.getText().toString(); if (LoginHelperUtil.isPhoneNumber(mPhoneNumber) && LoginHelperUtil.isCodeCorrect(mMsgCode) && TextUtils.equals(mPassword,mRepassword)) { BmobManager.getInstance(new BmobSignUpCallback() { @Override public void onSignUpSuccess(User user) { Intent intent = new Intent(RegisterActivity.this,MainActivity.class); intent.putExtra(INTENT_USER,user); startActivity(intent); ToastUtil.show(RegisterActivity.this,R.string.register_success); finish(); } @Override public void onSignUpFailure(BmobException e) { ToastUtil.show(RegisterActivity.this,R.string.register_failure); } }).signUp(mPhoneNumber,mMsgCode,mPassword); } else { ToastUtil.show(this,R.string.register_input_incorrect); } break;