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); } }); }
@Override public void fetchRemoteResult( long sinceId, long newestId, JsonHttpResponseHandler httpResponseHandler) { TwitterModel.getRestClient(mContext) .getUserTimeline(mUserId, sinceId, newestId, httpResponseHandler); }
@Override public void fetchRemoteResult( long sinceId, long newestId, JsonHttpResponseHandler httpResponseHandler) { TwitterModel.getRestClient(mContext).getHomeTweets(sinceId, newestId, httpResponseHandler); }