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); // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config.build()); }
@Provides @Singleton public ImageLoader imageLoader(SharedPreferencesWrapper preferences, MediaDownloader downloader) { final ImageLoader loader = ImageLoader.getInstance(); final ImageLoaderConfiguration.Builder cb = new ImageLoaderConfiguration.Builder(application); cb.threadPriority(Thread.NORM_PRIORITY - 2); cb.denyCacheImageMultipleSizesInMemory(); cb.tasksProcessingOrder(QueueProcessingType.LIFO); // cb.memoryCache(new ImageMemoryCache(40)); cb.diskCache(createDiskCache("images", preferences)); cb.imageDownloader(new TwidereImageDownloader(application, downloader)); L.writeDebugLogs(BuildConfig.DEBUG); loader.init(cb.build()); return loader; }
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()); }
/** * Loads the imageLoader question required for downloading the images * * @param context the application context * @return the image loader */ public static ImageLoader loadImageLoader(Context context) { DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder().cacheOnDisk(true).cacheInMemory(true).build(); ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.threadPriority(Thread.NORM_PRIORITY - 2); config.defaultDisplayImageOptions(displayImageOptions); config.denyCacheImageMultipleSizesInMemory(); config.diskCacheFileNameGenerator(new Md5FileNameGenerator()); config.diskCacheSize(50 * 1024 * 1024); // 50 MiB config.memoryCacheSize(50 * 1024 * 1024); config.tasksProcessingOrder(QueueProcessingType.LIFO); config.writeDebugLogs(); // Remove for release app ImageLoader.getInstance().init(config.build()); return ImageLoader.getInstance(); }
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.MAX_PRIORITY); config.threadPoolSize(10); config.denyCacheImageMultipleSizesInMemory(); config.memoryCacheSizePercentage(20); // % of available app memory.. config.tasksProcessingOrder(QueueProcessingType.FIFO); // config.writeDebugLogs(); // Remove for release app // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config.build()); sDisplayImageLoaderOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); }