示例#1
0
 /**
  * 连续点击退出 @Title: onKeyDown @Description: TODO @Calls: TODO @CalledBy: TODO @Input:@param
  * keyCode @Input:@param event @Input:@return @Date: 下午3:20:51
  */
 public boolean onKeyDown(int keyCode, KeyEvent event) {
   if (keyCode == KeyEvent.KEYCODE_BACK) {
     if ((System.currentTimeMillis() - mExitTime) > 2000) {
       ToastManager.show(this, "再按一次退出程序");
       mExitTime = System.currentTimeMillis();
     } else {
       BaseApplication.mInstance.exit();
     }
     return true;
   }
   return super.onKeyDown(keyCode, event);
 }
 @Override
 public void onSignUpSuccess() {
   // TODO Auto-generated method stub
   dialog.dismiss();
   ToastManager.show(this, "注册成功", 1 * 1000);
   User user = new User();
   user.setUsername(edt_user.getText().toString());
   BaseApplication.mInstance.saveUserInfo(this, user);
   Intent intent = new Intent(this, LoginActivity.class);
   startActivity(intent);
   finish();
 }
  @Override
  public void onClick(View view) {
    // TODO Auto-generated method stub
    switch (view.getId()) {
      case R.id.title_back_iv:
        finish();
        break;
      case R.id.btn_register:
        if (TextUtils.isEmpty(edt_user.getText())) {
          ToastManager.show(this, "请输入手机号码", 1 * 1000);
          return;
        }
        if (TextUtils.isEmpty(edt_pwd.getText())) {
          ToastManager.show(this, "请输入密码", 1 * 1000);
          return;
        }
        if (TextUtils.isEmpty(edt_yanzhengma.getText())) {
          ToastManager.show(this, "请输入验证码", 1 * 1000);
          return;
        }
        verifySmsCode(
            edt_user.getText().toString().trim(), edt_yanzhengma.getText().toString().trim());
        dialog.show();
        break;
      case R.id.btn_yanzhengma:
        mc = new MyCount(120000, 1000);
        mc.start();
        if (TextUtils.isEmpty(edt_user.getText())) {
          ToastManager.show(this, "请输入手机号码", 1 * 1000);
          return;
        }

        requestSMSCode(edt_user.getText().toString());
        break;

      default:
        break;
    }
  }
 @Override
 public void onSignUpFailure(String msg) {
   // TODO Auto-generated method stub
   dialog.dismiss();
   ToastManager.show(this, "注册失败" + msg, 1 * 1000);
 }