Android Open Source - Billy Bitmap Lru Cache From Project Back to project page Billy .
License The source code is released under:
GNU General Public License
If you think the Android project Billy listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code package com.vibin.billy;
/ * f r o m w w w . j a v a 2 s . c o m * /
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;
import android.util.Log;
import com.android.volley.toolbox.ImageLoader;
/**
* Basic LRU Memory cache.
*
* @author Trey Robinson
*/
public class BitmapLruCache
extends LruCache<String, Bitmap>
implements ImageLoader.ImageCache {
private static final String TAG = BitmapLruCache.class.getSimpleName();
public BitmapLruCache() {
this (getDefaultLruCacheSize());
}
public BitmapLruCache(int sizeInKiloBytes) {
super (sizeInKiloBytes);
}
@Override
protected int sizeOf(String key, Bitmap value) {
return value.getRowBytes() * value.getHeight() / 1024;
}
@Override
public Bitmap getBitmap(String url) {
//Log.d(TAG, "Grab " + url);
return get(url);
}
@Override
public void putBitmap(String url, Bitmap bitmap) {
//Log.d(TAG, "Put " + url);
put(url, bitmap);
}
public static int getDefaultLruCacheSize() {
final int maxMemory =
(int ) (Runtime.getRuntime().maxMemory() / 1024);
final int cacheSize = maxMemory / 8;
Log.d(TAG, "cachesize is " + cacheSize);
Log.d(TAG, cacheSize + " is cache Size" );
return cacheSize;
}
}
Java Source Code List com.vibin.billy.BillyApplication.java com.vibin.billy.BillyItem.java com.vibin.billy.BitmapLruCache.java com.vibin.billy.ChangelogDialog.java com.vibin.billy.CustomBaseAdapter.java com.vibin.billy.CustomDatabaseAdapter.java com.vibin.billy.CustomFragmentAdapter.java com.vibin.billy.CustomListPreference.java com.vibin.billy.CustomShareActionProvider.java com.vibin.billy.CustomStringRequest.java com.vibin.billy.DetailView.java com.vibin.billy.LicensesFragment.java com.vibin.billy.MainActivity.java com.vibin.billy.MediaControl.java com.vibin.billy.NotifyingScrollView.java com.vibin.billy.PPlayerService.java com.vibin.billy.PlayerService.java com.vibin.billy.ProcessingTask.java com.vibin.billy.ReorderedListPreference.java com.vibin.billy.Settings.java com.vibin.billy.SongsFragment.java com.vibin.billy.SwingBottomInAnimationAdapter.java com.vibin.billy.draglistview.DynamicListView.java com.vibin.billy.draglistview.StableArrayAdapter.java com.vibin.billy.swipeable.ActivitySwipeDismissListener.java com.vibin.billy.swipeable.AnimationUtils.java com.vibin.billy.swipeable.SwipeDismissViewGroup.java com.vibin.billy.swipeable.SwipeListener.java com.vibin.billy.swipeable.SwipeableActivity.java com.vibin.billy.swipeable.WindowDimens.java com.vibin.billy.swipeable.WindowUtils.java org.videolan.libvlc.AudioOutput.java org.videolan.libvlc.EventHandler.java org.videolan.libvlc.HWDecoderUtil.java org.videolan.libvlc.IVideoPlayer.java org.videolan.libvlc.LibVLC.java org.videolan.libvlc.LibVlcException.java org.videolan.libvlc.LibVlcUtil.java org.videolan.libvlc.MediaList.java org.videolan.libvlc.Media.java org.videolan.libvlc.TrackInfo.java