本文整理匯總了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());
}