当前位置: 首页>>代码示例>>Java>>正文


Java ImageLoaderConfiguration类代码示例

本文整理汇总了Java中com.nostra13.universalimageloader.core.ImageLoaderConfiguration的典型用法代码示例。如果您正苦于以下问题:Java ImageLoaderConfiguration类的具体用法?Java ImageLoaderConfiguration怎么用?Java ImageLoaderConfiguration使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ImageLoaderConfiguration类属于com.nostra13.universalimageloader.core包,在下文中一共展示了ImageLoaderConfiguration类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
@SuppressWarnings("deprecation")
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this)
            .memoryCacheExtraOptions(480, 800)
            // default = device screen dimensions
            .threadPoolSize(3)
            // default
            .threadPriority(Thread.NORM_PRIORITY - 1)
            // default
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13) // default
            .discCacheSize(50 * 1024 * 1024) // 缓冲大小
            .discCacheFileCount(100) // 缓冲文件数目
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
            .writeDebugLogs().build();

    // 2.单例ImageLoader类的初始化
    ImageLoader imageLoader = ImageLoader.getInstance();
    imageLoader.init(config);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:27,代码来源:MainActivity.java

示例2: getImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
public static ImageLoader getImageLoader(Context context) {
  if (sImageLoader == null) {
    DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
        .showImageOnLoading(Drawables.sPlaceholderDrawable)
        .showImageOnFail(Drawables.sErrorDrawable)
        .cacheInMemory(true)
        .cacheOnDisk(true)
        .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
        .defaultDisplayImageOptions(displayImageOptions)
        .diskCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE)
        .memoryCacheSize(ConfigConstants.MAX_MEMORY_CACHE_SIZE)
        .build();
    sImageLoader = ImageLoader.getInstance();
    sImageLoader.init(config);
  }
  return sImageLoader;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:SampleUilFactory.java

示例3: 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());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:UILApplication.java

示例4: onCreate

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main); // main activity
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); // toolbar
    setSupportActionBar(toolbar);

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(
            this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    drawer.addDrawerListener(toggle);
    toggle.syncState();

    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);

    getSupportFragmentManager().beginTransaction().replace(R.id.contentframe, new main_fragment()).commit();

    Settings.verifyStoragePermissions(this); // make sure we can access settings


    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
            .build();
    ImageLoader.getInstance().init(config);
}
 
开发者ID:xkik-dev,项目名称:XKik,代码行数:26,代码来源:MainActivity.java

示例5: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
public void initImageLoader() {
        File cacheDir = StorageUtils.getCacheDirectory(this);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiskCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
开发者ID:rsetkus,项目名称:rx-twitter-stream-android,代码行数:18,代码来源:RxTwitterApplication.java

示例6: onCreate

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    LogUtils.i(TAG, "onCreate");

    enableStrictMode();

    sContext = getApplicationContext();

    ImageLoaderConfiguration localImageLoaderConfiguration = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(localImageLoaderConfiguration);

    if (LeakCanary.isInAnalyzerProcess(this)) {
        // This process is dedicated to LeakCanary for heap analysis.
        // You should not init your app in this process.
        return;
    }
    LeakCanary.install(this);
}
 
开发者ID:komamj,项目名称:KomaMusic,代码行数:21,代码来源:MusicApplication.java

示例7: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
private void initImageLoader() {
    File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils
            .getOwnCacheDirectory(getActivity(),
                    IMAGE_CACHE_PATH);

    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true).cacheOnDisc(true).build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            getActivity()).defaultDisplayImageOptions(defaultOptions)
            .memoryCache(new LruMemoryCache(12 * 1024 * 1024))
            .memoryCacheSize(12 * 1024 * 1024)
            .discCacheSize(32 * 1024 * 1024).discCacheFileCount(100)
            .discCache(new UnlimitedDiscCache(cacheDir))
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.LIFO).build();

    ImageLoader.getInstance().init(config);
}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:20,代码来源:Recommend.java

示例8: 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());
  
}
 
开发者ID:fikyair,项目名称:musicplayer,代码行数:18,代码来源:BaseApplication.java

示例9: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
/**
     * 初始化imageloader,请在application中调用此方法
     */
    public static void initImageLoader(Context context) {
//        File cacheDir = StorageUtils.getOwnCacheDirectory(context,
//                "AppDir/cache/images");
        File cacheDir = new File(context.getCacheDir(), "images/cache/");
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
                context).threadPriority(Thread.NORM_PRIORITY - 2) //降低线程的优先级保证主UI线程不受太大影响
                .denyCacheImageMultipleSizesInMemory()
                .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //图片名称使用md5加密
                .tasksProcessingOrder(QueueProcessingType.LIFO)
                .diskCacheSize(1024 * 1024 * 50) // 硬盘存储缓存大小
                .memoryCache(new LruMemoryCache(10 * 1024 * 1024)) //内存缓存
                .memoryCacheSize(10 * 1024 * 1024)//内存缓存
                .diskCache(new UnlimitedDiskCache(cacheDir))
                .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)
                .taskExecutor(taskExecutor)
                .taskExecutorForCachedImages(executorForCachedImages)
                .threadPriority(Thread.NORM_PRIORITY - 1)
                .writeDebugLogs()
                .build();
        com.nostra13.universalimageloader.core.ImageLoader.getInstance().init(config);
    }
 
开发者ID:Datatellit,项目名称:xlight_android_native,代码行数:25,代码来源:ImageLoaderUtils.java

示例10: CachingUrlTileProvider

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
public CachingUrlTileProvider(Context ctx, int mTileWidth, int mTileHeight) {
    this.mTileWidth = mTileWidth;
    this.mTileHeight = mTileHeight;

    // if ImageLoader has not been instantiated by parent application yet
    if (!ImageLoader.getInstance().isInited()) {
        // Create global configuration and initialize ImageLoader with this config
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(ctx).build();
        ImageLoader.getInstance().init(config);
    }

    // init ImageLoader display options
    DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
    builder.cacheInMemory(true).cacheOnDisk(true);
    setDisplayImageOptions(builder);
    mOptions = builder.build();
}
 
开发者ID:Ubudu,项目名称:GoogleMapsLayout-Android,代码行数:18,代码来源:CachingUrlTileProvider.java

示例11: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
/**
 * init UIL ImageLoader
 */
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 config = new ImageLoaderConfiguration.Builder(
            context).threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new Md5FileNameGenerator())
            .tasksProcessingOrder(QueueProcessingType.LIFO)
            .writeDebugLogs() // Remove for release app
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
 
开发者ID:Evan-Galvin,项目名称:FreeStreams-TVLauncher,代码行数:20,代码来源:ClientApplication.java

示例12: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
/**
 * 初始化图片载入框架
 */
private void initImageLoader() {
    File cacheDir = StorageUtils.getCacheDirectory(this);
    int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
    // System.out.println("dsa-->"+MAXMEMONRY+"   "+(MAXMEMONRY/5));//.memoryCache(new
    // LruMemoryCache(50 * 1024 * 1024))
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .build();
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
            this).memoryCacheExtraOptions(480, 800).defaultDisplayImageOptions(defaultOptions)
            .diskCacheExtraOptions(480, 800, null).threadPoolSize(3)
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .tasksProcessingOrder(QueueProcessingType.FIFO)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
            .diskCache(new UnlimitedDiskCache(cacheDir))
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(this)) // default
            .imageDecoder(new BaseImageDecoder(false)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()).build();

    ImageLoader.getInstance().init(config);
}
 
开发者ID:viseator,项目名称:MontageCam,代码行数:28,代码来源:BaseActivity.java

示例13: onCreate

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    sContext = this;
    appComponent = DaggerAppComponent.builder()
            .baseComponent(baseComponent)
            .build();

    Fresco.initialize(getApplicationContext(),
            ImagePipelineFactory.imagePipelineConfig(getApplicationContext()
                    , getAppComponent().okHttpClient()
                    , getCacheDir().getAbsolutePath()));

    //ImageLoader初始化
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(configuration);

    DBManager.init(this);
    if (AccountHelper.isLogin())
        DBManager.initDefaultRealm(AccountHelper.getCurrentUid(), APPRealmMigration.VERSION, new APPRealmMigration());
    startService(new Intent(this, InitializeIntentService.class));
}
 
开发者ID:Jusenr,项目名称:androidgithub,代码行数:23,代码来源:PTApplication.java

示例14: initImageLoader

import com.nostra13.universalimageloader.core.ImageLoaderConfiguration; //导入依赖的package包/类
private void initImageLoader() {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
    .threadPoolSize(5)
    .threadPriority(Thread.NORM_PRIORITY - 2)
    .denyCacheImageMultipleSizesInMemory()
    .memoryCache(new LruMemoryCache(2 * 1024))
    .memoryCacheSize(2 * 1024)
    .defaultDisplayImageOptions(new DisplayImageOptions.Builder()
    .showImageForEmptyUri(R.drawable.no_photo_group)
    .showImageOnFail(R.drawable.no_photo_group)
    .resetViewBeforeLoading(true)
    .displayer(new FadeInBitmapDisplayer(300)).build())
    .tasksProcessingOrder(QueueProcessingType.LIFO).build();
    ImageLoader.getInstance().init(config);
    com.nostra13.universalimageloader.utils.L.writeLogs(false);
}
 
开发者ID:WorldBank-Transport,项目名称:RoadLab-Pro,代码行数:17,代码来源:RAApplication.java

示例15: 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());
}
 
开发者ID:shenhuanet,项目名称:OpenEyesReading-android,代码行数:18,代码来源:App.java


注:本文中的com.nostra13.universalimageloader.core.ImageLoaderConfiguration类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。