Exemple #1
0
 public void add(String key, BitmapCacheContainer container) {
   if (container == null || container.isRecycled() || container.get() == null) return;
   BitmapCacheContainer old = mCache.object(key);
   if (old != null) {
     if (old.getLastUpdateTime() < container.getLastUpdateTime()) {
       mCache.remove(key);
     } else {
       Bitmap oldBmp = old.get();
       Bitmap newBmp = container.get();
       if (oldBmp != null
           && Math.max(oldBmp.getWidth(), oldBmp.getHeight())
               > Math.max(newBmp.getWidth(), newBmp.getHeight())) {
         return;
       }
     }
   }
   mCache.insert(key, container, container.getCost());
 }