Search in sources :

Example 46 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project android-ui-design-pattern by MathieuCalba.

the class UIDesignPatternApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    final DisplayImageOptions defaultDisplayImageOptions = // 
    new DisplayImageOptions.Builder().cacheInMemory().cacheOnDisc().displayer(// 
    new FadeInBitmapDisplayer(250)).showImageForEmptyUri(// 
    R.drawable.ic_launcher).showStubImage(// 
    R.drawable.ic_launcher).build();
    final File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(), "YANA/ImageCache");
    final ImageLoaderConfiguration config = // 
    new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(// 
    defaultDisplayImageOptions).discCache(// 
    new TotalSizeLimitedDiscCache(cacheDir, new Md5FileNameGenerator(), 10 * 1024 * 1024)).imageDownloader(// 
    new URLConnectionImageDownloader()).memoryCacheSize(// 2 Mb
    2 * 1024 * 1024).tasksProcessingOrder(// 
    QueueProcessingType.LIFO).threadPoolSize(// 
    3).threadPriority(// 
    Thread.NORM_PRIORITY - 2).build();
    ImageLoader.getInstance().init(config);
}
Also used : TotalSizeLimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.TotalSizeLimitedDiscCache) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) URLConnectionImageDownloader(com.nostra13.universalimageloader.core.download.URLConnectionImageDownloader) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 47 with ImageLoaderConfiguration

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

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // rongcloud 初始化
    RongIM.init(this);
    if (getApplicationInfo().packageName.equals(getCurProcessName(getApplicationContext()))) {
        RongCloudEvent.init(this);
        RongIM.registerMessageType(AgreedFriendRequestMessage.class);
        RongIM.registerMessageTemplate(new ContactNotificationMessageProvider());
    }
    // BugTags 初始化
    Bugtags.start(BUGTAGS_APPKEY, this, Bugtags.BTGInvocationEventBubble);
    // 友盟session时间间隔
    MobclickAgent.setSessionContinueMillis(30 * 60 * 1000);
    // oneCore 打印参数
    NLog.setDebug(true);
    options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.rp_default_head).showImageOnFail(R.drawable.rp_default_head).showImageOnLoading(R.drawable.rp_default_head).displayer(new FadeInBitmapDisplayer(300)).cacheInMemory(true).cacheOnDisk(true).build();
    // 初始化图片下载组件
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(200).diskCacheFileNameGenerator(new Md5FileNameGenerator()).defaultDisplayImageOptions(options).build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
Also used : ContactNotificationMessageProvider(com.rongseal.message.ContactNotificationMessageProvider) FadeInBitmapDisplayer(com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 48 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ImagePicker by jeasonlzy.

the class GApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    ImageLoaderConfiguration config = ImageLoaderConfiguration.createDefault(this);
    // UniversalImageLoader初始化
    ImageLoader.getInstance().init(config);
    // xUtils3初始化
    x.Ext.init(this);
}
Also used : ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 49 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project StickerCamera by Skykai521.

the class App method initImageLoader.

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 UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, AppConstants.APP_IMAGE))).diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).threadPoolSize(3).build();
    ImageLoader.getInstance().init(config);
}
Also used : UnlimitedDiskCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 50 with ImageLoaderConfiguration

use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project SimplifyReader by chentao0707.

the class ImageLoaderHelper method getImageLoaderConfiguration.

public ImageLoaderConfiguration getImageLoaderConfiguration(String filePath) {
    File cacheDir = null;
    if (!CommonUtils.isEmpty(filePath)) {
        cacheDir = StorageUtils.getOwnCacheDirectory(mContext, filePath);
    } else {
        cacheDir = StorageUtils.getCacheDirectory(mContext);
    }
    ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(mContext);
    builder.denyCacheImageMultipleSizesInMemory();
    builder.diskCacheSize(512 * 1024 * 1024);
    builder.diskCacheExtraOptions(720, 1280, null);
    builder.diskCache(new UnlimitedDiscCache(cacheDir));
    builder.diskCacheFileNameGenerator(new Md5FileNameGenerator());
    builder.memoryCacheSizePercentage(14);
    builder.memoryCacheSize(2 * 1024 * 1024);
    builder.memoryCacheExtraOptions(720, 1280);
    builder.memoryCache(new WeakMemoryCache());
    builder.threadPoolSize(3);
    builder.threadPriority(Thread.NORM_PRIORITY - 2);
    builder.defaultDisplayImageOptions(getDisplayOptions());
    return builder.build();
}
Also used : UnlimitedDiscCache(com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache) Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) WeakMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)52 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)25 File (java.io.File)21 LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)18 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)14 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)13 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)10 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)10 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)9 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)6 WeakMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.WeakMemoryCache)4 ImageLoader (com.nostra13.universalimageloader.core.ImageLoader)4 IOException (java.io.IOException)4 DiskCache (com.nostra13.universalimageloader.cache.disc.DiskCache)3 LruDiskCache (com.nostra13.universalimageloader.cache.disc.impl.ext.LruDiskCache)3 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)3 Intent (android.content.Intent)2 Handler (android.os.Handler)2 SimpleBitmapDisplayer (com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer)2 NonViewAware (com.nostra13.universalimageloader.core.imageaware.NonViewAware)2