Skip to content

Instantly share code, notes, and snippets.

@smaspe
Created June 17, 2013 09:44
Show Gist options
  • Save smaspe/5795808 to your computer and use it in GitHub Desktop.
Save smaspe/5795808 to your computer and use it in GitHub Desktop.
public class ExtendedImageLoader extends ImageLoader {
/** ... */
/** Creator of Image Requests */
private ImageRequestFactory mImageRequestFactory;
/** ... */
/**
* Constructs a new ImageLoader.
* @param queue The RequestQueue to use for making image requests.
* @param imageCache The cache to use as an L1 cache.
* @param factory The factory for creating ImageRequests
*/
public ExtendedImageLoader(RequestQueue queue, ImageCache imageCache, ImageRequestFactory factory) {
super(queue, null);
mRequestQueue = queue;
mCache = imageCache;
mImageRequestFactory = factory;
}
/** ... */
public ImageContainer get(String requestUrl, ImageListener imageListener,
int maxWidth, int maxHeight) {
/** ... */
Request<?> newRequest =
mImageRequestFactory.getImageRequest(requestUrl, new Listener<Bitmap>() {
@Override
public void onResponse(Bitmap response) {
onGetImageSuccess(cacheKey, response);
}
}, maxWidth, maxHeight,
Config.RGB_565, new ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
onGetImageError(cacheKey, error);
}
});
/** ... */
}
/** ... */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment