예제 #1
0
  private void sendFeedback() {

    try {
      imm.hideSoftInputFromWindow(mContent.getWindowToken(), 0);
      String content = mContent.getText().toString();
      Logger.i(content);
      if (StringUtils.empty(content)) {
        UIHelper.ToastMessage(getApplicationContext(), "请输入内容", Toast.LENGTH_SHORT);
        return;
      }
      loadingPd = UIHelper.showProgress(this, null, null, true);
      AppClient.sendFeedback(
          appContext,
          content,
          new ClientCallback() {
            @Override
            public void onSuccess(Entity data) {
              UIHelper.dismissProgress(loadingPd);
              show1OptionsDialog(oprators);
            }

            @Override
            public void onFailure(String message) {
              UIHelper.dismissProgress(loadingPd);
              UIHelper.ToastMessage(getApplicationContext(), message, Toast.LENGTH_SHORT);
            }

            @Override
            public void onError(Exception e) {
              UIHelper.dismissProgress(loadingPd);
              Logger.i(e);
              UIHelper.ToastMessage(getApplicationContext(), "网络不给力", Toast.LENGTH_SHORT);
            }
          });
    } catch (Exception e) {
      Logger.i(e);
    }
  }
예제 #2
0
  private void checkLogin() {
    loadingPd = UIHelper.showProgress(this, null, null, true);
    AppClient.autoLogin(
        appContext,
        new ClientCallback() {
          @Override
          public void onSuccess(Entity data) {
            UIHelper.dismissProgress(loadingPd);
            UserEntity user = (UserEntity) data;
            switch (user.getError_code()) {
              case Result.RESULT_OK:
                appContext.saveLoginInfo(user);
                //					getUnReadMessage();
                //					if (!Utils.hasBind(getApplicationContext())) {
                //						blindBaidu();
                //					}
                break;
              default:
                UIHelper.ToastMessage(
                    getApplicationContext(), user.getMessage(), Toast.LENGTH_SHORT);
                showLogin();
                break;
            }
          }

          @Override
          public void onFailure(String message) {
            UIHelper.dismissProgress(loadingPd);
            UIHelper.ToastMessage(getApplicationContext(), message, Toast.LENGTH_SHORT);
          }

          @Override
          public void onError(Exception e) {
            UIHelper.dismissProgress(loadingPd);
            ((AppException) e).makeToast(getApplicationContext());
          }
        });
  }