Search in sources :

Example 1 with UnlimitedDiscCache

use of com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache in project UltimateAndroid by cymcsg.

the class UniversalImageLoader method getDefaultImageLoaderConfigurationBuilder.

public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
    File cacheDir = StorageUtils.getCacheDirectory(context);
    ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default
    3).threadPriority(// default
    Thread.NORM_PRIORITY - 1).tasksProcessingOrder(// default
    QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCacheSizePercentage(// default
    13).discCache(// default
    new UnlimitedDiscCache(cacheDir)).discCacheFileCount(1000).discCacheFileNameGenerator(// default
    new HashCodeFileNameGenerator()).imageDownloader(// default
    new BaseImageDownloader(context)).imageDecoder(// default
    new BaseImageDecoder(false)).defaultDisplayImageOptions(getDefaultImageOptions());
    return builder;
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) BaseImageDecoder(com.nostra13.universalimageloader.core.decode.BaseImageDecoder)

Example 2 with UnlimitedDiscCache

use of com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache in project BaseProject by fly803.

the class AppApplication method initImageLoader.

private void initImageLoader() {
    // 初始化 Image-Loader
    DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).memoryCache(new LruMemoryCache(MEMORY_SIZE)).diskCache(new UnlimitedDiscCache(new File(getCacheDir(), "caches"))).diskCacheSize(DISK_SIZE).defaultDisplayImageOptions(options).build();
    ImageLoader.getInstance().init(configuration);
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) File(java.io.File) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 3 with UnlimitedDiscCache

use of com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache in project ABPlayer by winkstu.

the class HomePageFragment method initImageLoader.

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);
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 4 with UnlimitedDiscCache

use of com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache in project KenBurnsView by flavioarfaria.

the class FromURLActivity method loadImage.

private void loadImage() {
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
        String cacheDirName = "." + getString(R.string.app_name);
        cacheDir = new File(Environment.getExternalStorageDirectory(), cacheDirName);
    } else {
        cacheDir = getCacheDir();
    }
    if (!cacheDir.exists()) {
        cacheDir.mkdirs();
    }
    config = new ImageLoaderConfiguration.Builder(this).memoryCache(new WeakMemoryCache()).denyCacheImageMultipleSizesInMemory().diskCache(new UnlimitedDiscCache(cacheDir)).threadPoolSize(5).build();
    options = new DisplayImageOptions.Builder().bitmapConfig(Bitmap.Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_INT).cacheOnDisk(true).cacheInMemory(true).build();
    imageLoader.init(config);
    imageLoader.displayImage("http://i.imgur.com/gysR4Ee.jpg", mImg, options, this);
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) WeakMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache) File(java.io.File)

Example 5 with UnlimitedDiscCache

use of com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache in project ABPlayer by winkstu.

the class VideoInfoFragment method initImageLoader.

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);
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Aggregations

UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)7 File (java.io.File)7 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)6 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)4 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)4 WeakMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache)2 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)1 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)1 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)1 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)1