Merge "adding isCached function to ImageLoader"
diff --git a/src/com/android/volley/toolbox/ImageLoader.java b/src/com/android/volley/toolbox/ImageLoader.java
index 0e72928..5735edd 100755
--- a/src/com/android/volley/toolbox/ImageLoader.java
+++ b/src/com/android/volley/toolbox/ImageLoader.java
@@ -144,6 +144,20 @@
}
/**
+ * Checks if the item is available in the cache.
+ * @param requestUrl The url of the remote image
+ * @param maxWidth The maximum width of the returned image.
+ * @param maxHeight The maximum height of the returned image.
+ * @return True if the item exists in cache, false otherwise.
+ */
+ public boolean isCached(String requestUrl, int maxWidth, int maxHeight) {
+ throwIfNotOnMainThread();
+
+ String cacheKey = getCacheKey(requestUrl, maxWidth, maxHeight);
+ return mCache.getBitmap(cacheKey) != null;
+ }
+
+ /**
* Returns an ImageContainer for the requested URL.
*
* The ImageContainer will contain either the specified default bitmap or the loaded bitmap.