Search in sources :

Example 1 with HashCodeFileNameGenerator

use of com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator in project android-page-transition by xmuSistone.

the class MainActivity method initImageLoader.

@SuppressWarnings("deprecation")
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
    13).discCacheSize(// 缓冲大小
    50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
    100).discCacheFileNameGenerator(// default
    new HashCodeFileNameGenerator()).imageDownloader(// default
    new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
    DisplayImageOptions.createSimple()).writeDebugLogs().build();
    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
Also used : HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 2 with HashCodeFileNameGenerator

use of com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator in project android-card-slide-panel by xmuSistone.

the class MainActivity method initImageLoader.

@SuppressWarnings("deprecation")
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
    13).discCacheSize(// 缓冲大小
    50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
    100).discCacheFileNameGenerator(// default
    new HashCodeFileNameGenerator()).imageDownloader(// default
    new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
    DisplayImageOptions.createSimple()).writeDebugLogs().build();
    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
Also used : HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 3 with HashCodeFileNameGenerator

use of com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator in project QuickAndroid by ImKarl.

the class QAImageLoaderConfig method getConfig.

/**
     * 获取加载配置
     * @param context
     * @param imageOnLoading 加载中显示的图片
     * @param imageOnFail 加载失败显示的图片
     * @return
     */
public static ImageLoaderConfiguration getConfig(Context context, Drawable imageOnLoading, Drawable imageOnFail) {
    DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(// 加载中
    imageOnLoading).showImageForEmptyUri(// 图片Uri为空或是错误的时候显示的图片
    imageOnFail).showImageOnFail(// resource or drawable
    imageOnFail).resetViewBeforeLoading(// default
    false).delayBeforeLoading(// 加载前延迟时长
    50).cacheInMemory(// default = false 是否使用内存缓存
    true).cacheOnDisk(// default = false 是否使用文件缓存
    true).considerExifParams(// default = false
    false).imageScaleType(// default
    ImageScaleType.IN_SAMPLE_POWER_OF_2).bitmapConfig(// default
    Bitmap.Config.ARGB_8888).displayer(// default = new SimpleBitmapDisplayer()
    new FadeInBitmapDisplayer(100)).build();
    File cacheDir = new File(QAFileManager.getUsableDir(context.getPackageName()));
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default 线程池大小
    3).threadPriority(// default 线程优先级
    Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(// 内存缓存
    new LruMemoryCache(8 * 1024 * 1024)).diskCache(// default 磁盘缓存
    new UnlimitedDiskCache(cacheDir)).diskCacheSize(// 磁盘缓存大小
    30 * 1024 * 1024).diskCacheFileNameGenerator(// default 磁盘缓存文件名
    new HashCodeFileNameGenerator()).imageDownloader(// default 图片下载器
    new BaseImageDownloader(context)).imageDecoder(// default 图片解码器
    new BaseImageDecoder(QACore.isDebug())).defaultDisplayImageOptions(// default=DisplayImageOptions.createSimple() 图片显示选项
    options).build();
    return config;
}
Also used : UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) BaseImageDecoder(com.nostra13.universalimageloader.core.decode.BaseImageDecoder)

Example 4 with HashCodeFileNameGenerator

use of com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator 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 5 with HashCodeFileNameGenerator

use of com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator in project QuickAndroid by ImKarl.

the class QAImageLoaderConfig method getConfig.

/**
     * 获取加载配置
     * @param context
     * @param imageOnLoadingRes 加载中显示的图片
     * @param imageOnFailRes 加载失败显示的图片
     * @return
     */
public static ImageLoaderConfiguration getConfig(Context context, int imageOnLoadingRes, int imageOnFailRes) {
    DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(// 加载中
    imageOnLoadingRes).showImageForEmptyUri(// 图片Uri为空或是错误的时候显示的图片
    imageOnFailRes).showImageOnFail(// resource or drawable
    imageOnFailRes).resetViewBeforeLoading(// default
    false).delayBeforeLoading(// 加载前延迟时长
    50).cacheInMemory(// default = false 是否使用内存缓存
    true).cacheOnDisk(// default = false 是否使用文件缓存
    true).considerExifParams(// default = false
    false).imageScaleType(// default
    ImageScaleType.IN_SAMPLE_POWER_OF_2).bitmapConfig(// default
    Bitmap.Config.ARGB_8888).displayer(// default = new SimpleBitmapDisplayer()
    new FadeInBitmapDisplayer(100)).build();
    File cacheDir = new File(QAFileManager.getUsableDir(context.getPackageName()));
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default 线程池大小
    3).threadPriority(// default 线程优先级
    Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(// 内存缓存
    new LruMemoryCache(8 * 1024 * 1024)).diskCache(// default 磁盘缓存
    new UnlimitedDiskCache(cacheDir)).diskCacheSize(// 磁盘缓存大小
    30 * 1024 * 1024).diskCacheFileNameGenerator(// default 磁盘缓存文件名
    new HashCodeFileNameGenerator()).imageDownloader(// default 图片下载器
    new BaseImageDownloader(context)).imageDecoder(// default 图片解码器
    new BaseImageDecoder(QACore.isDebug())).defaultDisplayImageOptions(// default=DisplayImageOptions.createSimple() 图片显示选项
    options).build();
    return config;
}
Also used : UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) BaseImageDecoder(com.nostra13.universalimageloader.core.decode.BaseImageDecoder)

Aggregations

HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)5 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)5 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)5 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)4 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)3 File (java.io.File)3 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)2 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)2 ImageLoader (com.nostra13.universalimageloader.core.ImageLoader)2 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)2 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)1