コード例 #1
0
  /** 登录 */
  private void doLogin(final String number, final String code) {

    Client.requestCodeLogin(
        this,
        number,
        code,
        new ResponseHandler() {
          @Override
          public void onInnovationSuccess(JsonElement value) {
            CodeLoginResponse codeLoginResponse = get(value.toString(), CodeLoginResponse.class);
            // 全局信息
            GlobalBean globalBean = new GlobalBean();
            globalBean.setPhoneNum(number);
            globalBean.setHguid(codeLoginResponse.getId());
            globalBean.setToken(codeLoginResponse.getToken());
            Config.setGlobal(DynamicLoginActivity.this, new Gson().toJson(globalBean));
            ZnkActivityUtil.startActivity(DeviceActivity.class);
            ZnkActivityUtil.finishActivity();
          }

          @Override
          public void onInnovationFinish() {
            super.onInnovationFinish();
            mRegisterSubmitImgView.setEnabled(true);
          }

          @Override
          public void onInnovationExceptionFinish() {
            super.onInnovationExceptionFinish();
            mRegisterSubmitImgView.setEnabled(true);
          }
        },
        new ZNKNetWorkUnavialableListener());
  }
コード例 #2
0
  /** 获得验证码 */
  private void doGetVerificationCode(final String userNameStr) {
    // 当未连接网络,或网络连接超时的情况发生时,重置计时器.
    Client.requestGetLoginCode(
        this,
        userNameStr,
        new ResponseHandler() {
          @Override
          public void onInnovationSuccess(JsonElement value) {
            stopTime();
            getSMSCodeFlg = true;
          }

          @Override
          public void onZNKFailure(String value) {
            super.onZNKFailure(value);
            stopTime();
            getSMSCodeFlg = true;
          }
        },
        new ZNKNetWorkUnavialableListener());
  }