本文整理匯總了Java中com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache類的典型用法代碼示例。如果您正苦於以下問題:Java UnlimitedDiscCache類的具體用法?Java UnlimitedDiscCache怎麽用?Java UnlimitedDiscCache使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
UnlimitedDiscCache類屬於com.nostra13.universalimageloader.cache.disc.impl包,在下文中一共展示了UnlimitedDiscCache類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader() {
File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
.getOwnCacheDirectory(getActivity(),
IMAGE_CACHE_PATH);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true).cacheOnDisc(true).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
getActivity()).defaultDisplayImageOptions(defaultOptions)
.memoryCache(new LruMemoryCache(12 * 1024 * 1024))
.memoryCacheSize(12 * 1024 * 1024)
.discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
.discCache(new UnlimitedDiscCache(cacheDir))
.threadPriority(Thread.NORM_PRIORITY - 2)
.tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
示例2: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/**
* 初始化ImageLoader
*/
public static void initImageLoader(Context context) {
//緩存文件的目錄
File cacheDir = CacheUtil.getDiskCacheDir(context, "images");
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // max width, max height,即保存的每個緩存文件的最大長寬
.threadPoolSize(3) //線程池內加載的數量
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator()) //將保存的時候的URI名稱用MD5 加密
.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通過自己的內存緩存實現
.memoryCacheSize(2 * 1024 * 1024) // 內存緩存的最大值
.diskCacheSize(50 * 1024 * 1024) // 50 Mb sd卡(本地)緩存的最大值
.tasksProcessingOrder(QueueProcessingType.LIFO)
// 由原先的discCache -> diskCache
.diskCache(new UnlimitedDiscCache(cacheDir))//自定義緩存路徑
.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超時時間
.writeDebugLogs() // Remove for release app
.build();
//全局初始化此配置
ImageLoader.getInstance().init(config);
}
示例3: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
"beautynote/cache");// 獲取到緩存的目錄地址
// 創建配置ImageLoader(所有的選項都是可選的,隻使用那些你真的想定製),這個可以設定在APPLACATION裏麵,設置為全局的配置參數
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
// 線程池內加載的數量
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
// 將保存的時候的URI名稱用MD5 加密
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCache(new UnlimitedDiscCache(cacheDir))// 自定義緩存路徑
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);// 全局初始化此配置
}
示例4: createDiskCache
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/**
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
try {
return new LruDiscCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
// continue and create unlimited cache
}
}
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiscCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
示例5: onCreate
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
@Override
public void onCreate() {
super.onCreate();
File cacheDir = StorageUtils.getCacheDirectory(this);
ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCache(new UnlimitedDiscCache(cacheDir))
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13)
.tasksProcessingOrder(QueueProcessingType.LIFO)
.build();
ImageLoader.getInstance().init(configuration);
}
示例6: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/**
* ��ʼ��ImageLoader
*
* @param applicationContext
*/
private static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
"bmobchat/Cache");// ��ȡ�������Ŀ¼��ַ
// ��������ImageLoader(���е�ѡ��ǿ�ѡ��,ֻʹ����Щ������붨��)����������趨��APPLACATION���棬����Ϊȫ�ֵ����ò���
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
// �̳߳��ڼ��ص�����
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
// �������ʱ���URI������MD5 ����
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCache(new UnlimitedDiscCache(cacheDir))// �Զ��建��·��
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);// ȫ�ֳ�ʼ��������
}
示例7: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
"bmobim/Cache");// 獲取到緩存的目錄地址
// 創建配置ImageLoader(所有的選項都是可選的,隻使用那些你真的想定製),這個可以設定在APPLACATION裏麵,設置為全局的配置參數
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
// 線程池內加載的數量
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
// 將保存的時候的URI名稱用MD5 加密
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCache(new UnlimitedDiscCache(cacheDir))// 自定義緩存路徑
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);// 全局初始化此配置
}
示例8: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/** ��ʼ��ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context,
"bmobim/Cache");// ��ȡ�������Ŀ¼��ַ
// ��������ImageLoader(���е�ѡ��ǿ�ѡ��,ֻʹ����Щ������붨��)����������趨��APPLACATION���棬����Ϊȫ�ֵ����ò���
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
// �̳߳��ڼ��ص�����
.threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 2)
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
// �������ʱ���URI������MD5 ����
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCache(new UnlimitedDiscCache(cacheDir))// �Զ��建��·��
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);// ȫ�ֳ�ʼ��������
}
示例9: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader() {
try {
String CACHE_DIR = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/.temp_tmp";
new File(CACHE_DIR).mkdirs();
File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(),
CACHE_DIR);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
getBaseContext())
.defaultDisplayImageOptions(defaultOptions)
.discCache(new UnlimitedDiscCache(cacheDir))
.memoryCache(new WeakMemoryCache());
ImageLoaderConfiguration config = builder.build();
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
} catch (Exception e) {
}
}
示例10: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader() {
try {
String CACHE_DIR = Environment.getExternalStorageDirectory()
.getAbsolutePath() + "/.temp_tmp";
new File(CACHE_DIR).mkdirs();
File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(),
CACHE_DIR);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(
getBaseContext())
.defaultDisplayImageOptions(defaultOptions)
.discCache(new UnlimitedDiscCache(cacheDir))
.memoryCache(new WeakMemoryCache());
ImageLoaderConfiguration config = builder.build();
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
} catch (Exception e) {
}
}
示例11: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader() {
File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
.getOwnCacheDirectory(this.getActivity().getApplicationContext(),
IMAGE_CACHE_PATH);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true).cacheOnDisc(true).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
this.getActivity()).defaultDisplayImageOptions(defaultOptions)
.memoryCache(new LruMemoryCache(12 * 1024 * 1024))
.memoryCacheSize(12 * 1024 * 1024)
.discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
.discCache(new UnlimitedDiscCache(cacheDir))
.threadPriority(Thread.NORM_PRIORITY - 2)
.tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
示例12: iniImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/**
* http://seniorzhai.github.io/2014/10/14/UIL%E5%9B%BE%E7%89%87%E5%BC%82%E6%AD%A5%E5%8A%A0%E8%BD%BD%E5%BA%93%E7%9A%84%E4%BD%BF%E7%94%A8/
* */
private void iniImageLoader()
{
File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(),"doubanonlineimageloader/Cache");
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.memoryCache(new WeakMemoryCache())
.denyCacheImageMultipleSizesInMemory()
.offOutOfMemoryHandling()
.discCacheExtraOptions(720, 480, CompressFormat.JPEG, 75)
.discCache(new UnlimitedDiscCache(cacheDir))
.imageDownloader(new URLConnectionImageDownloader(120 * 1000, 120 * 1000))
.enableLogging()
.build();
ImageLoader.getInstance().init(config);
imageLoader = ImageLoader.getInstance();
}
示例13: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
/** 初始化ImageLoader */
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getOwnCacheDirectory(context, "taijiquan/Cache");//獲取到緩存的目錄地址
TLog.logd(cacheDir.getPath());
DisplayImageOptions displayOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.bitmapConfig(Bitmap.Config.RGB_565)
.showImageOnLoading(R.drawable.ic_full_image_failed)
.showImageOnFail(R.drawable.ic_full_image_failed)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration
.Builder(context)
.threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation你可以通過自己的內存緩存實現
.memoryCacheSize(2 * 1024 * 1024)
.discCacheSize(50 * 1024 * 1024)
.discCacheFileNameGenerator(new Md5FileNameGenerator())//將保存的時候的URI名稱用MD5 加密
.tasksProcessingOrder(QueueProcessingType.LIFO)
.discCacheFileCount(100)
.discCache(new UnlimitedDiscCache(cacheDir))
.defaultDisplayImageOptions(displayOptions)
.build();
ImageLoader.getInstance().init(config);
}
示例14: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader() {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(false)
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.defaultDisplayImageOptions(defaultOptions)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCache(new UnlimitedDiscCache(StorageUtils.getOwnCacheDirectory(this, Environment.getExternalStorageDirectory()
+ "/sky")))
.diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO)
.memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024)
.threadPoolSize(3)
.build();
ImageLoader.getInstance().init(config);
}
示例15: initImageLoader
import com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache; //導入依賴的package包/類
private void initImageLoader(){
Context context = getApplicationContext();
File cacheDir = StorageUtils.getCacheDirectory(context);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.diskCacheExtraOptions(480, 800, null)
.threadPriority(Thread.NORM_PRIORITY - 2) // default
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
.diskCache(new UnlimitedDiscCache(cacheDir)) // default
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(context)) // default
.imageDecoder(new BaseImageDecoder(false)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
// .writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}