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);
}
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);
}
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);
}
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);
}
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();
}
Aggregations