Android Open Source - android-intro Lru Bitmap Cache






From Project

Back to project page android-intro.

License

The source code is released under:

MIT License

If you think the Android project android-intro 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.example.app.cache;
/*from  ww w .  j  av  a  2  s. co m*/
import android.graphics.Bitmap;
import android.util.LruCache;

import com.android.volley.toolbox.ImageLoader;

/**
 * Created by andy on 3/13/14.
 */
public class LruBitmapCache extends LruCache<String, Bitmap> implements ImageLoader.ImageCache {

    public LruBitmapCache(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);
    }
}




Java Source Code List

com.example.app.EventListFragment.java
com.example.app.GithubEventsApp.java
com.example.app.MainActivity.java
com.example.app.WebViewActivity.java
com.example.app.api.Actor.java
com.example.app.api.Event.java
com.example.app.api.EventsResponse.java
com.example.app.api.GitHubRequestManager.java
com.example.app.api.GitHubRequest.java
com.example.app.api.Repo.java
com.example.app.cache.LruBitmapCache.java