public BitmapCacheContainer get(String key) { BitmapCacheContainer b = mCache.object(key); if (b != null && b.isRecycled()) { mCache.remove(key); return null; } return b; }
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()); }