aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorandaagar <anders.aagaard@finn.no>2013-05-22 19:28:14 +0200
committerandaagar <aagaande@gmail.com>2013-05-29 21:23:43 +0200
commit285d4727a6c223e8f4c19b6b44078464605b7f8b (patch)
tree4f3824425a1c12f79ab01e09447b067f8c170396 /src
parent4af455a438f7cd25a6064fadaa545be0c8fc1c73 (diff)
downloadvolley-285d4727a6c223e8f4c19b6b44078464605b7f8b.tar.gz
adding isCached function to ImageLoader
Change-Id: I771a608910a7b2b1dc1fe1d30395a7bb0738592e
Diffstat (limited to 'src')
-rwxr-xr-xsrc/com/android/volley/toolbox/ImageLoader.java14
1 files changed, 14 insertions, 0 deletions
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 @@ public class ImageLoader {
}
/**
+ * 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.