예제 #1
0
  private void connectToServerRegister() {
    if (checkInput()) {

      Utils.showProgressDialog(mContext);
      RegisterRequest request =
          new RegisterRequest(
              new Response.Listener<RegisterResponse>() {
                @Override
                public void onResponse(RegisterResponse response) {
                  Utils.closeDialog();
                  RegisterResponse.RegisterData data = response.data;
                  CnpcApplication.getInstance().setCheckID(data.id);
                  Utils.moveTo(mContext, SoftwareShareActivity.class);
                }
              },
              this);
      request.setOilId(sunyardoils.get(spinner.getSpinnerText()));
      request.setPassword(et_pwds.getText().toString().trim());
      request.setCellphone(et_telNo.getText().toString().trim());
      request.setValidationCode(et_valNo.getText().toString().trim());
      request.setLongitude(longitude);
      request.setLatitude(latitude);
      request.setAddressid(cityId);
      WebUtils.doPost(request);
    }
  }
예제 #2
0
  private boolean checkInput() {

    if (StringUtils.isEmpty(et_telNo.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "用户手机号不能为空", Toast.LENGTH_SHORT).show();
      return false;
    }
    if (!Utils.checkPhoneNum(et_telNo.getText().toString())) {
      Toast.makeText(this, "手机号不合法", Toast.LENGTH_SHORT).show();
      return false;
    }
    if (StringUtils.isEmpty(et_valNo.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "用户验证码不能为空", Toast.LENGTH_SHORT).show();
      return false;
    }
    if (StringUtils.isEmpty(et_pwds.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "用户密码不能为空", Toast.LENGTH_SHORT).show();
      return false;
    }
    if (StringUtils.isEmpty(et_pwd_again.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "用户确认密码不能为空", Toast.LENGTH_SHORT).show();
      return false;
    }
    if (!et_pwds.getText().toString().trim().equals(et_pwd_again.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "密码与确认密码不一致", Toast.LENGTH_SHORT).show();
      return false;
    }
    return true;
  }
예제 #3
0
  private void getValFromServer() {

    Utils.showProgressDialog(mContext);
    GetValRequest request =
        new GetValRequest(
            new Response.Listener<GetValResponse>() {
              @Override
              public void onResponse(GetValResponse response) {
                Utils.closeDialog();

                GetValResponse.ValDateGet data = response.data;
                time.start();
                String value = data.value;
                if (StringUtils.isEmpty(value)) {
                  return;
                } else {
                  try {
                    PreferencesService.getInstance(mContext).save("value", value);
                  } catch (Exception e) {
                    e.printStackTrace();
                  }
                }
              }
            },
            this);
    request.setCellphone(et_telNo.getText().toString());
    WebUtils.doPost(request);
  }
예제 #4
0
  @Override
  protected void initBase() {

    TitleBarManager titleBarManager = new TitleBarManager();
    titleBarManager.init(RegisteredActivity.this, getSupportActionBar());
    titleBarManager.showCommonTitleBar(R.string.title_registered, R.drawable.return_arrow, true);
    showLoadingPage(false);
    networkManager = new NetworkManager(this, new LocationToggle(mContext));
    if (!Utils.isX86CPU()) startLoc();
  }
예제 #5
0
  @OnClick(R.id.tv_getVal)
  public void getVal() {

    if (StringUtils.isEmpty(et_telNo.getText().toString().trim())) {
      Toast.makeText(RegisteredActivity.this, "用户手机号不能为空", Toast.LENGTH_SHORT).show();
    } else {
      if (!Utils.checkPhoneNum(et_telNo.getText().toString())) {
        Toast.makeText(this, "手机号不合法", Toast.LENGTH_SHORT).show();
      } else {

        getValFromServer();
      }
    }
  }
예제 #6
0
  public void getSunyardOil() {
    Utils.showProgressDialog(mContext);
    SunyardOilRequset request =
        new SunyardOilRequset(
            new Response.Listener<SunyardOilResponse>() {
              @Override
              public void onResponse(SunyardOilResponse response) {
                Utils.closeDialog();
                ArrayList<SunyardOilResponse.SunyardOilDto> sunyardOilsData = response.data;
                wrapOilsData(sunyardOilsData);
              }
            },
            this);

    WebUtils.doPost(request);
  }
예제 #7
0
  @Override
  public void onClick(View v) {
    switch (v.getId()) {
      case R.id.registered_success:
        if (checkInput()) {

          Intent intent = new Intent();
          intent.putExtra("setOilId", sunyardoils.get(spinner.getSpinnerText()));
          intent.putExtra("setPassword", et_pwds.getText().toString().trim());
          intent.putExtra("setCellphone", et_telNo.getText().toString().trim());
          intent.putExtra("setValidationCode", et_valNo.getText().toString().trim());
          intent.putExtra("setLongitude", longitude);
          intent.putExtra("setLatitude", latitude);
          intent.putExtra("timeLimit", cityId);
          intent.setClass(this, SoftwareShareActivity.class);
          startActivity(intent);
        }

        break;
      case R.id.registration_agreement:
        Utils.moveTo(this, RegistrationAgreementActivity.class);
        break;
    }
  }