コード例 #1
0
  /** 回复公司圈消息 */
  private void friendZoneCommentSub(
      String infoId, String userId, String commentId, final String content, String infouserid) {
    APIClient.friendZoneCommentSub(
        new FriendZoneCommentSubRequest(infoId, userId, commentId, content, infouserid),
        new AsyncHttpResponseHandler() {
          @Override
          protected void onPreExecute() {
            HttpHanderUtil.cancel(mHttpHandler);
            mHttpHandler = this;
            showLoadingView();
          }

          @Override
          public void onSuccess(int statusCode, String result) {
            FriendZoneCommentSubResponse response;
            try {
              ResponseUtil.checkResponse(result);
              response = new Gson().fromJson(result, FriendZoneCommentSubResponse.class);
            } catch (Exception e) {
              showToast(R.string.data_format_error);
              return;
            }
            if (response.isSuccess() && response.getData() != null) {
              if (mComLis != null) {
                FriendZoneCommentSubResponse.Data dataRes = response.getData();
                setResult(dataRes.getCommentid(), content, dataRes.getCtime());
                mComLis.onHideCommunityCommentary();
              }
              hideLoadingView();
              getFragmentManager()
                  .beginTransaction()
                  .remove(CommunityCommentaryFragment.this)
                  .commit();
            } else {
              showToast(response.getMsg());
            }
          }

          @Override
          public void onFailure(Throwable error, String content) {
            showToast(R.string.load_server_failure);
          }

          @Override
          public void onFinish() {
            mHttpHandler = null;
            hideLoadingView();
          }
        });
  }
コード例 #2
0
  private void findEmailPassword(String account) {

    APIClient.findEmailPassword(
        new FindEmailPasswordRequest(account),
        new AsyncHttpResponseHandler() {

          @Override
          public void onFinish() {
            mGetFindPassWordHandler = null;
            hideLoadingView();
          }

          @Override
          protected void onPreExecute() {
            if (mGetFindPassWordHandler != null) {
              mGetFindPassWordHandler.cancle();
            }
            mGetFindPassWordHandler = this;
            showLoadingView(R.string.sending_now);
          }

          @Override
          public void onSuccess(String content) {
            BaseResponse response;
            try {
              ResponseUtil.checkResponse(content);
              response = new Gson().fromJson(content, BaseResponse.class);
            } catch (Exception e) {
              showToast(R.string.data_format_error);
              return;
            }
            if (response.isSuccess()) {
              setResult(RESULT_OK);
              //                    showMessage("");
              showToast("链接已发送至邮箱");
              finish();
            } else {
              showToast(response.getMsg());
            }
          }

          @Override
          public void onFailure(Throwable error, String content) {
            showToast(R.string.load_server_failure);
          }
        });
  }