本文整理汇总了Java中com.nostra13.universalimageloader.core.ImageLoaderConfiguration.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLoaderConfiguration.Builder方法的具体用法?Java ImageLoaderConfiguration.Builder怎么用?Java ImageLoaderConfiguration.Builder使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nostra13.universalimageloader.core.ImageLoaderConfiguration
的用法示例。
在下文中一共展示了ImageLoaderConfiguration.Builder方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例2: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.discCacheFileNameGenerator(new Md5FileNameGenerator());
config.discCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例3: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
b = new DisplayImageOptions.Builder();
b.cacheOnDisc(true)
.cacheInMemory(false)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
.bitmapConfig(Bitmap.Config.RGB_565);
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.discCacheFileNameGenerator(new Md5FileNameGenerator());
config.memoryCacheSize(20 * 1024 * 1024); // 20 MiB
config.discCacheSize(100 * 1024 * 1024); // 100 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.defaultDisplayImageOptions(b.build());
config.writeDebugLogs();
ImageLoader.getInstance().init(config.build());
}
示例4: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
private void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例5: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 4);
// config.memoryCache(new WeakMemoryCache());
config.memoryCacheExtraOptions(480, 800);
config.memoryCacheSize(2 * 1024 * 1024);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.diskCacheExtraOptions(480, 800, null);
config.tasksProcessingOrder(QueueProcessingType.LIFO);
// config.writeDebugLogs(); // Remove for release app
config.imageDownloader(new BaseImageDownloader(context, 5 * 1000, 10 * 1000));
config.threadPoolSize(1);
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例6: UILKit
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
/**
* 初始化
*
* @param context
*/
private UILKit(Context context) {
File cacheDir = getDiskCacheDir(context, "img");
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.memoryCacheSize(10 * 1024 * 1024)
.diskCache(new UnlimitedDiskCache(cacheDir))
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCacheSize(50 * 1024 * 1024) // 50 MiB
.tasksProcessingOrder(QueueProcessingType.LIFO);
ImageLoader.getInstance().init(config.build());
picOptions = new DisplayImageOptions.Builder()
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(false).cacheInMemory(false)
.resetViewBeforeLoading(true)
.displayer(new FadeInBitmapDisplayer(500)).build();
}
示例7: initEbConfig
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public void initEbConfig(String type) {
Log4jLog.i(LONG_TAG, "initEbConfig start, type=" + type);
CrashHandler crashHandler = CrashHandler.getInstance();
crashHandler.init(getApplicationContext());
Log4jLog.i(LONG_TAG, "initEbConfig 1");
Entboost.setServiceListener(crashHandler);
Log4jLog.i(LONG_TAG, "initEbConfig 2");
Entboost.init(getApplicationContext());
Log4jLog.i(LONG_TAG, "initEbConfig 3");
Entboost.showSotpLog(false);
Log4jLog.i(LONG_TAG, "initEbConfig 4");
Builder imgConfig = new ImageLoaderConfiguration.Builder(this);
imgConfig.threadPriority(Thread.NORM_PRIORITY - 2);// 设置线程的优先级
imgConfig.diskCacheFileNameGenerator(new Md5FileNameGenerator());// 设置缓存文件的名字
imgConfig.diskCacheSize(50 * 1024 * 1024); // 50 MiB
imgConfig.denyCacheImageMultipleSizesInMemory();// 当同一个Uri获取不同大小的图片,缓存到内存时,只缓存一个。默认会缓存多个不同的大小的相同图片
imgConfig.tasksProcessingOrder(QueueProcessingType.LIFO);// 设置图片下载和显示的工作队列排序
ImageLoader.getInstance().init(imgConfig.build());
defaultImgOptions = createImgOptions(R.drawable.entboost_logo, R.drawable.entboost_logo, R.drawable.entboost_logo);
userImgOptions = createImgOptions(0, R.drawable.default_user, R.drawable.default_user);
funcInfoImgOptions = createImgOptions(0, R.drawable.default_app, R.drawable.default_app);
}
示例8: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
private void initImageLoader(Context context) {
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheSize(50 * 1024 * 1024);
config.tasksProcessingOrder(QueueProcessingType.LIFO);
ImageLoader.getInstance().init(config.build());
defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(false)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_INT)//设置图片以如何的编码方式显示
.showImageOnLoading(R.mipmap.loading)
.bitmapConfig(Bitmap.Config.RGB_565)
.showImageOnFail(R.mipmap.loading)
.showImageForEmptyUri(R.mipmap.loading)
.build();
ImageLoader.getInstance().clearDiskCache();
ImageLoader.getInstance().clearMemoryCache();
}
示例9: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例10: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
//config.writeDebugLogs(); // Remove for release app
ImageLoader.getInstance().init(config.build());
}
示例11: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
private void initImageLoader(Context context) {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
//.showImageForEmptyUri(R.drawable.ic_empty)
//.showImageOnFail(R.drawable.ic_error)
.resetViewBeforeLoading(true)
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565)
.considerExifParams(true)
.displayer(new FadeInBitmapDisplayer(300))
.build();
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.defaultDisplayImageOptions(defaultOptions);
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例12: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
private void initImageLoader()
{
final String CACHE_DIR = App.getWorkingDirectory() + File.separator + ".temp";
File file = new File(CACHE_DIR);
if(!file.exists())
file.mkdirs();
try
{
File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(), CACHE_DIR);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheOnDisc(true)
.imageScaleType(ImageScaleType.EXACTLY).bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(getBaseContext())
.defaultDisplayImageOptions(defaultOptions).discCache(new UnlimitedDiskCache(cacheDir))
.memoryCache(new WeakMemoryCache());
ImageLoaderConfiguration config = builder.build();
imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
}
catch(Exception e)
{
e.printStackTrace();
}
}
示例13: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY);
config.denyCacheImageMultipleSizesInMemory();
config.memoryCacheSize((int) Runtime.getRuntime().maxMemory() / 4);
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(100 * 1024 * 1024); // 100 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
//修改连接超时时间5秒,下载超时时间5秒
config.imageDownloader(new BaseImageDownloader(appContext, 5 * 1000, 5 * 1000));
// config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例14: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
private static void initImageLoader() {
// This configuration tuning is custom. You can tune every option, you may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(mApplicationContext);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
if (Debug.SHOW_DEVELOP_LOG) {
// Remove for release app
config.writeDebugLogs();
}
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
// ************** How to use **************
// "http://site.com/image.png" // from Web
// "file:///mnt/sdcard/image.png" // from SD card
// "file:///mnt/sdcard/video.mp4" // from SD card (video thumbnail)
// "content://media/external/images/media/13" // from content provider
// "content://media/external/video/media/13" // from content provider (video thumbnail)
// "assets://image.png" // from assets
// "drawable://" + R.drawable.img // from drawables (non-9patch images)
//
// ImageLoader.getInstance().displayImage("uri", (ImageAware) null);
}
示例15: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入方法依赖的package包/类
public static void initImageLoader(Context context) {
ImageLoaderConfiguration.Builder build = new ImageLoaderConfiguration.Builder(context);
build.tasksProcessingOrder(QueueProcessingType.LIFO);
build.diskCacheSize(MAX_DISK_CACHE);
build.memoryCacheSize(MAX_MEMORY_CACHE);
build.memoryCache(new LruMemoryCache(MAX_MEMORY_CACHE));
if (BuildConfig.DEBUG && isShowLog) {
build.writeDebugLogs();
}
getImageLoader().init(build.build());
}