@Override
  public void handleRequestFinished(Object requestId, Throwable error, Object resultObject) {
    if (error == null) {
      Logger.instance().v(TAG, "Success \n\t\t" + resultObject);
      if ((int) requestId == RequestIds.NEWS_DETAILS_REQUEST_ID && resultObject != null) {
        newsList = (ArrayList<NewsItem>) resultObject;
        if (newsList != null && newsList.size() > 0) {
          newsItem = newsList.get(0);
          bindViews();
        }
      }

    } else if (error != null && error instanceof CTHttpError) {
      Logger.instance().v(TAG, error);
      int statusCode = ((CTHttpError) error).getStatusCode();
      if (RequestHandler.isRequestTimedOut(statusCode)) {
        ErrorDialog.showMessageDialog(
            getString(R.string.attention), getString(R.string.timeout), getActivity());
      } else if (statusCode == -1) {
        ErrorDialog.showMessageDialog(
            getString(R.string.attention), getString(R.string.conn_error), getActivity());
      }
    }
  }
Example #2
0
  @Override
  public void handleRequestFinished(Object requestId, Throwable error, Object resulObject) {
    if (error == null) {
      if ((int) requestId == RequestIds.FORGET_PASSWORD_REQUEST_ID && resulObject != null) {}

    } else if (error != null && error instanceof CTHttpError) {
      int statusCode = ((CTHttpError) error).getStatusCode();
      String errorMsg = ((CTHttpError) error).getErrorMsg();
      if (RequestHandler.isRequestTimedOut(statusCode)) {
        ErrorDialog.showMessageDialog(
            getString(R.string.attention), getString(R.string.timeout), EventsActivity.this);
      } else if (statusCode == -1) {
        ErrorDialog.showMessageDialog(
            getString(R.string.attention), getString(R.string.conn_error), EventsActivity.this);
      } else {
        ErrorDialog.showMessageDialog(getString(R.string.attention), errorMsg, EventsActivity.this);
      }

      Logger.instance().v(TAG, error);
    }
  }