Search in sources :

Example 11 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration 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 12 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project UltimateAndroid by cymcsg.

the class CommonApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // Create global configuration and initialize ImageLoader with this configuration
    ImageLoaderConfiguration config = UniversalImageLoader.getDefaultImageLoaderConfiguration(getApplicationContext());
    ImageLoader.getInstance().init(config);
    ActiveAndroid.initialize(this);
}
Also used : ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 13 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project UltimateAndroid by cymcsg.

the class UniversalImageLoader method getDefaultImageLoaderConfiguration.

public static ImageLoaderConfiguration getDefaultImageLoaderConfiguration(Context context, boolean isWriteLog) {
    ImageLoaderConfiguration.Builder builder = getDefaultImageLoaderConfigurationBuilder(context);
    if (isWriteLog) {
        builder.writeDebugLogs();
    }
    ImageLoaderConfiguration config = builder.build();
    return config;
}
Also used : ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 14 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project SeaStar by 13120241790.

the class SealFragment method configImageLoader.

private void configImageLoader() {
    // 初始化ImageLoader
    DisplayImageOptions options = // 设置图片下载期间显示的图片
    new DisplayImageOptions.Builder().showStubImage(drawable.icon_stub).showImageForEmptyUri(// 设置图片Uri为空或是错误的时候显示的图片
    drawable.icon_stub).showImageOnFail(// 设置图片加载或解码过程中发生错误显示的图片
    drawable.icon_stub).cacheInMemory(// 设置下载的图片是否缓存在内存中
    true).cacheOnDisc(// 设置下载的图片是否缓存在SD卡中
    true).build();
    // 创建配置过得DisplayImageOption对象
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getContext()).defaultDisplayImageOptions(options).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
}
Also used : Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 15 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project PhotoNoter by yydcdut.

the class ImageLoaderManager method init.

public static void init(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
    sOptions = new DisplayImageOptions.Builder().cacheInMemory(//设置下载的图片是否缓存在内存中
    true).considerExifParams(//是否考虑JPEG图像EXIF参数(旋转,翻转)
    true).bitmapConfig(//设置图片的解码类型//
    Bitmap.Config.RGB_565).build();
//构建完成
}
Also used : Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Aggregations

ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)33 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)16 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)12 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)10 File (java.io.File)8 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)6 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)4 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)4 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)4 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)3 Intent (android.content.Intent)2 ImageLoader (com.nostra13.universalimageloader.core.ImageLoader)2 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)2 SimpleBitmapDisplayer (com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer)2 SharedPreferences (android.content.SharedPreferences)1 Handler (android.os.Handler)1 ActionBar (android.support.v7.app.ActionBar)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 View (android.view.View)1 ListView (android.widget.ListView)1