예제 #1
0
  public static List<PhotoItem> getAlbumPhotos(Context context, String id) {
    String url = ApiConstants.getAlbumPhotoUrl(id);
    final ResultWrapper resultWrapper = new ResultWrapper();
    makeSyncGetJsonRequest(
        new PhotosResponse(),
        context,
        url,
        JSON_REQUEST_TIMEOUT,
        new ApiResponseListener<PhotosResponse>() {
          @Override
          public void onResponse(PhotosResponse response) {
            LogUtils.debugLog(LOG_TAG, "Results received");
            resultWrapper.setResult(response.getResult());
          }

          @Override
          public void onError(Exception exception) {
            LogUtils.errorLog(LOG_TAG, "Failed to fetch page. API returned: " + exception);
          }
        });
    return (List<PhotoItem>) resultWrapper.getResult();
  }
예제 #2
0
  private static PhotosResponse getAlbumByPage(Context context, String url) {
    final ResultWrapper resultWrapper = new ResultWrapper();

    makeSyncGetJsonRequest(
        new PhotosResponse(),
        context,
        url,
        JSON_REQUEST_TIMEOUT,
        new ApiResponseListener<PhotosResponse>() {
          @Override
          public void onResponse(PhotosResponse response) {
            LogUtils.debugLog(LOG_TAG, "Results received");

            resultWrapper.setResult(response);
          }

          @Override
          public void onError(Exception exception) {
            LogUtils.errorLog(LOG_TAG, "Failed to fetch page. API returned: " + exception);
          }
        });
    return (PhotosResponse) resultWrapper.getResult();
  }