Ejemplo n.º 1
0
  public void postTweet(final String tweet, final OnPostFinishDelegate delegate) {
    if (!Util.isNetworkAvailable(mContext)) {
      delegate.onQueryComplete(R.string.network_connection_error);
      return;
    }

    TwitterModel.getRestClient(mContext)
        .postTweet(
            tweet,
            new JsonHttpResponseHandler() {
              @Override
              public void onSuccess(int statusCode, Header[] headers, JSONObject response) {
                delegate.onQueryComplete(0);
              }

              @Override
              public void onFailure(
                  int statusCode, Header[] headers, Throwable throwable, JSONObject errorResponse) {
                int errorMessage = generalFailureResponse(errorResponse);
                delegate.onQueryComplete(errorMessage);
              }
            });
  }
Ejemplo n.º 2
0
 @Override
 public void fetchRemoteResult(
     long sinceId, long newestId, JsonHttpResponseHandler httpResponseHandler) {
   TwitterModel.getRestClient(mContext)
       .getUserTimeline(mUserId, sinceId, newestId, httpResponseHandler);
 }
Ejemplo n.º 3
0
 @Override
 public void fetchRemoteResult(
     long sinceId, long newestId, JsonHttpResponseHandler httpResponseHandler) {
   TwitterModel.getRestClient(mContext).getHomeTweets(sinceId, newestId, httpResponseHandler);
 }