Search in sources :

Example 1 with LruMemoryCache

use of com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache in project 9GAG by stormzhang.

the class App method initImageLoader.

// 初始化ImageLoader
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).discCacheSize(10 * 1024 * 1024).discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
}
Also used : Md5FileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 2 with LruMemoryCache

use of com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache in project cardslib by gabrielemariotti.

the class UniversalImageLoaderFragment method initUniversalImageLoaderLibrary.

/**
     * Android-Universal-Image-Loader config.
     *
     * DON'T COPY THIS CODE TO YOUR REAL PROJECT!     *
     * I would recommend doing it in an overloaded Application.onCreate().
     * It is just for test purpose
     *
     *
     */
private void initUniversalImageLoaderLibrary() {
    File cacheDir = StorageUtils.getCacheDirectory(getActivity());
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getActivity()).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).defaultDisplayImageOptions(DisplayImageOptions.createSimple()).writeDebugLogs().build();
    ImageLoader.getInstance().init(config);
    options = new DisplayImageOptions.Builder().cacheInMemory(true).displayer(new SimpleBitmapDisplayer()).showImageOnFail(R.drawable.ic_error_loadingsmall).build();
}
Also used : SimpleBitmapDisplayer(com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) File(java.io.File) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration) DisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions)

Example 3 with LruMemoryCache

use of com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache in project android-page-transition by xmuSistone.

the class MainActivity method initImageLoader.

@SuppressWarnings("deprecation")
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
    13).discCacheSize(// 缓冲大小
    50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
    100).discCacheFileNameGenerator(// default
    new HashCodeFileNameGenerator()).imageDownloader(// default
    new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
    DisplayImageOptions.createSimple()).writeDebugLogs().build();
    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
Also used : HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 4 with LruMemoryCache

use of com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache in project android-card-slide-panel by xmuSistone.

the class MainActivity method initImageLoader.

@SuppressWarnings("deprecation")
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCacheExtraOptions(480, 800).threadPoolSize(3).threadPriority(Thread.NORM_PRIORITY - 1).tasksProcessingOrder(QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(// default
    13).discCacheSize(// 缓冲大小
    50 * 1024 * 1024).discCacheFileCount(// 缓冲文件数目
    100).discCacheFileNameGenerator(// default
    new HashCodeFileNameGenerator()).imageDownloader(// default
    new BaseImageDownloader(this)).defaultDisplayImageOptions(// default
    DisplayImageOptions.createSimple()).writeDebugLogs().build();
    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
Also used : HashCodeFileNameGenerator(com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) BaseImageDownloader(com.nostra13.universalimageloader.core.download.BaseImageDownloader) ImageLoader(com.nostra13.universalimageloader.core.ImageLoader) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 5 with LruMemoryCache

use of com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache in project DanmakuFlameMaster by Bilibili.

the class UglyViewCacheStufferSampleActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // Create global configuration and initialize ImageLoader with this config
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13).build();
    ImageLoader.getInstance().init(config);
    setContentView(R.layout.activity_main);
    findViews();
}
Also used : SpannableStringBuilder(android.text.SpannableStringBuilder) LruMemoryCache(com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Aggregations

LruMemoryCache (com.nostra13.universalimageloader.cache.memory.impl.LruMemoryCache)13 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)12 DisplayImageOptions (com.nostra13.universalimageloader.core.DisplayImageOptions)8 File (java.io.File)6 HashCodeFileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator)4 BaseImageDownloader (com.nostra13.universalimageloader.core.download.BaseImageDownloader)4 UnlimitedDiscCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiscCache)3 UnlimitedDiskCache (com.nostra13.universalimageloader.cache.disc.impl.UnlimitedDiskCache)3 FadeInBitmapDisplayer (com.nostra13.universalimageloader.core.display.FadeInBitmapDisplayer)3 Md5FileNameGenerator (com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator)2 ImageLoader (com.nostra13.universalimageloader.core.ImageLoader)2 BaseImageDecoder (com.nostra13.universalimageloader.core.decode.BaseImageDecoder)2 ActivityManager (android.app.ActivityManager)1 SpannableStringBuilder (android.text.SpannableStringBuilder)1 SimpleBitmapDisplayer (com.nostra13.universalimageloader.core.display.SimpleBitmapDisplayer)1