Last active
August 29, 2015 14:06
-
-
Save dostiharise/a742afa13bac986c8381 to your computer and use it in GitHub Desktop.
BitmapCache.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* BitmapCache.java | |
* | |
* | |
* | |
*/ | |
package net.xxx.xxx.lib.server; | |
import android.graphics.Bitmap; | |
import android.support.v4.util.LruCache; | |
import com.android.volley.toolbox.ImageLoader.ImageCache; | |
/** | |
* @author hari | |
* | |
*/ | |
public class BitmapCache extends LruCache<String, Bitmap> implements ImageCache { | |
public BitmapCache(int maxSize) { | |
super(maxSize); | |
} | |
@Override | |
protected int sizeOf(String key, Bitmap value) { | |
return value.getRowBytes() * value.getHeight(); | |
} | |
@Override | |
public Bitmap getBitmap(String url) { | |
return get(url); | |
} | |
@Override | |
public void putBitmap(String url, Bitmap bitmap) { | |
put(url, bitmap); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment