package com.tsgame.tsgame_niuniu.Volley.IamgeCache;


import android.app.ActivityManager;
import android.content.Context;
import android.graphics.Bitmap;
import android.support.v4.util.LruCache;

import com.android.volley.toolbox.ImageLoader;
import com.android.volley.toolbox.ImageLoader.ImageContainer;
import com.android.volley.toolbox.ImageLoader.ImageListener;
import com.game.webgame.network.volleymanager;
import com.jx.jyhd.R;
import com.tsgame.tsgame_niuniu.system.Myapplication;


public class ImageCacheManager{
	
	

	//getRunTime.maxMemory/8
	private static final int MEMORY_CACHE_MAX_SIZE = 1024*1024*((ActivityManager)Myapplication.application.getSystemService(Context.ACTIVITY_SERVICE)).getMemoryClass()/8;
	private static LruImageCache imageCache = new LruImageCache(
			"imagecache",
			1024*1024*30,//外置存储缓存最大值
			MEMORY_CACHE_MAX_SIZE);//内存缓存最大值
	
	public static ImageLoader mImagerLoader = new ImageLoader(
			volleymanager.getInstance().getmRequestQueue(), 
			imageCache);
	
	public static ImageContainer loadImage(String url,ImageLoader.ImageListener listener){
		ImageListener listener1=ImageLoader.getImageListener(null, R.drawable.ic_launcher, R.drawable.ic_launcher);
	
		return mImagerLoader.get(url, listener);
	}

}
