Beispiel #1
0
 /**
  * Searches all bitmaps in memory cache which are corresponded to incoming URI.<br>
  * <b>Note:</b> Memory cache can contain multiple sizes of the same image if only you didn't set
  * {@link ImageLoaderConfiguration.Builder#denyCacheImageMultipleSizesInMemory()
  * denyCacheImageMultipleSizesInMemory()} option in {@linkplain ImageLoaderConfiguration
  * configuration}
  */
 public static List<Bitmap> findCachedBitmapsForImageUri(
     String imageUri, MemoryCacheAware<String, Bitmap> memoryCache) {
   List<Bitmap> values = new ArrayList<Bitmap>();
   for (String key : memoryCache.keys()) {
     if (key.startsWith(imageUri)) {
       values.add(memoryCache.get(key));
     }
   }
   return values;
 }
Beispiel #2
0
 /**
  * Removes from memory cache all images for incoming URI.<br>
  * <b>Note:</b> Memory cache can contain multiple sizes of the same image if only you didn't set
  * {@link ImageLoaderConfiguration.Builder#denyCacheImageMultipleSizesInMemory()
  * denyCacheImageMultipleSizesInMemory()} option in {@linkplain ImageLoaderConfiguration
  * configuration}
  */
 public static void removeFromCache(
     String imageUri, MemoryCacheAware<String, Bitmap> memoryCache) {
   List<String> keysToRemove = new ArrayList<String>();
   for (String key : memoryCache.keys()) {
     if (key.startsWith(imageUri)) {
       keysToRemove.add(key);
     }
   }
   for (String keyToRemove : keysToRemove) {
     memoryCache.remove(keyToRemove);
   }
 }