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


Java BaseImageDownloader类代码示例

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


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

示例1: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的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: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的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

示例3: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的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

示例4: b

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
private static boolean b(String str) {
    long currentTimeMillis = System.currentTimeMillis();
    try {
        b.a("ConnectivityTest: begin to connect to " + str);
        Socket socket = new Socket();
        socket.connect(Host.b(str, 5222), BaseImageDownloader.DEFAULT_HTTP_CONNECT_TIMEOUT);
        socket.setTcpNoDelay(true);
        b.a("ConnectivityTest: connect to " + str + " in " + (System.currentTimeMillis() -
                currentTimeMillis));
        socket.close();
        return true;
    } catch (Throwable th) {
        b.d("ConnectivityTest: could not connect to:" + str + " exception: " + th.getClass()
                .getSimpleName() + " description: " + th.getMessage());
        return false;
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:18,代码来源:u.java

示例5: getDefaultConfig

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
private ImageLoaderConfiguration getDefaultConfig() throws IOException {
    int MAX_CACHE_MEMORY_SIZE = (int) (Runtime.getRuntime().maxMemory() / 8);
    File cacheDir = StorageUtils.getOwnCacheDirectory(context, context.getPackageName() + "/cache/image/");

    LogUtil.i(TAG, "ImageLoader memory cache size = " + MAX_CACHE_MEMORY_SIZE / M + "M");
    LogUtil.i(TAG, "ImageLoader disk cache directory = " + cacheDir.getAbsolutePath());

    ImageLoaderConfiguration config = new ImageLoaderConfiguration
            .Builder(context)
            .threadPoolSize(3) // 线程池内加载的数量
            .threadPriority(Thread.NORM_PRIORITY - 2) // 降低线程的优先级,减小对UI主线程的影响
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(MAX_CACHE_MEMORY_SIZE))
            .discCache(new LruDiskCache(cacheDir, new Md5FileNameGenerator(), 0))
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple())
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs()
            .build();

    return config;
}
 
开发者ID:LegendKe,项目名称:MyTravelingDiary,代码行数:22,代码来源:ImageLoaderKit.java

示例6: tryLoadBitmap

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
    Bitmap bitmap = null;
    try {
        java.io.File imageFile = diskCache.get(getMessage().get_id());
        if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
            ViewScaleType viewScaleType = imageAware.getScaleType();
            ImageSize imageSize = ImageSizeUtils.defineTargetSizeForView(imageAware, new ImageSize(MainApp.CONTEXT.getResources().getDisplayMetrics().widthPixels, MainApp.CONTEXT.getResources().getDisplayMetrics().heightPixels));
            ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),
                    ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()), getMessage().get_id(), imageSize, viewScaleType,
                    new BaseImageDownloader(MainApp.CONTEXT), options);
            bitmap = decoder.decode(decodingInfo);
            MainApp.memoryCache.put(getMessage().get_id(), bitmap);
        }
    } catch (Exception ignored) {
        ignored.printStackTrace();
    }
    return bitmap;
}
 
开发者ID:jianliaoim,项目名称:talk-android,代码行数:19,代码来源:VideoRow.java

示例7: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
/**
     * 初始化ImageLoader
     *
     * @param context 上下文对象
     */
    private void initImageLoader(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
//                .taskExecutor(...)
//        .taskExecutorForCachedImages(...)
                .threadPoolSize(3) // default
                .threadPriority(Thread.NORM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .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)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
//                .imageDecoder(new BaseImageDecoder()) // default
                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .writeDebugLogs()
                .build();
        ImageLoader.getInstance().init(config);
    }
 
开发者ID:291700351,项目名称:WeCharEnglish,代码行数:31,代码来源:WeCharApplication.java

示例8: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
/**
 * 初始化ImageLoader
 */
public static void initImageLoader(Context context) {
    //缓存文件的目录
    File cacheDir = CacheUtil.getDiskCacheDir(context, "images");
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // max width, max height,即保存的每个缓存文件的最大长宽
            .threadPoolSize(3) //线程池内加载的数量
            .threadPriority(Thread.NORM_PRIORITY - 2)
            .denyCacheImageMultipleSizesInMemory()
            .diskCacheFileNameGenerator(new Md5FileNameGenerator()) //将保存的时候的URI名称用MD5 加密
            .memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通过自己的内存缓存实现
            .memoryCacheSize(2 * 1024 * 1024) // 内存缓存的最大值
            .diskCacheSize(50 * 1024 * 1024)  // 50 Mb sd卡(本地)缓存的最大值
            .tasksProcessingOrder(QueueProcessingType.LIFO)
                    // 由原先的discCache -> diskCache
            .diskCache(new UnlimitedDiscCache(cacheDir))//自定义缓存路径
            .imageDownloader(new BaseImageDownloader(context, 5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
            .writeDebugLogs() // Remove for release app
            .build();
    //全局初始化此配置
    ImageLoader.getInstance().init(config);

}
 
开发者ID:CarpOrange,项目名称:CloudMusic,代码行数:26,代码来源:ToolImage.java

示例9: onCreate

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
@Override
	public void onCreate() {
		super.onCreate();
		//初始化ImageLoader
//		ImageLoaderConfiguration configuration=ImageLoaderConfiguration.createDefault(getApplicationContext());
//		ImageLoader.getInstance().init(configuration);
		File cacheDir = StorageUtils.getOwnCacheDirectory(this, "Hungry and hurry/Cache");
		ImageLoaderConfiguration config = new ImageLoaderConfiguration
				.Builder(this)
				.memoryCacheExtraOptions(480, 800) // maxwidth, max height,即保存的每个缓存文件的最大长宽
				.threadPoolSize(3)//线程池内加载的数量
				.threadPriority(Thread.NORM_PRIORITY - 2)
				.denyCacheImageMultipleSizesInMemory()
				.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024)) // You can pass your own memory cache implementation/你可以通过自己的内存缓存实现
				.memoryCacheSize(2 * 1024 * 1024)
				.tasksProcessingOrder(QueueProcessingType.LIFO)
				.diskCache(new UnlimitedDiskCache(cacheDir))//自定义缓存路径
				.diskCacheFileCount(70)
				.diskCacheFileNameGenerator(new Md5FileNameGenerator())//将保存的时候的URI名称用MD5 加密
				.defaultDisplayImageOptions(DisplayImageOptions.createSimple())
				.imageDownloader(new BaseImageDownloader(this,5 * 1000, 30 * 1000)) // connectTimeout (5 s), readTimeout (30 s)超时时间
				.writeDebugLogs() // Remove for releaseapp
				.build();//开始构建
		ImageLoader.getInstance().init(config);
	}
 
开发者ID:CKTim,项目名称:MyApplication,代码行数:26,代码来源:MyApplication.java

示例10: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
public static void initImageLoader(Context context) {
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
            .diskCacheExtraOptions(480, 800, null)
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .diskCacheSize(50 * 1024 * 1024)
            .diskCacheFileCount(100)
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();
    // Initialize ImageLoader with configuration.
    ImageLoader.getInstance().init(config);
}
 
开发者ID:davyjoneswang,项目名称:AndroidLearnDemos,代码行数:20,代码来源:MainActivity.java

示例11: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的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());
    }
 
开发者ID:wanliyang1990,项目名称:WliveTV,代码行数:22,代码来源:MyApplication.java

示例12: configUniversalImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
/**
 * 初始化UniversalImageLoader
 */
private void configUniversalImageLoader() {
    DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
            .cacheInMemory().cacheOnDisc()
            .bitmapConfig(Bitmap.Config.RGB_565)
            .displayer(new FadeInBitmapDisplayer(500))
            .build();

    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).
            diskCacheFileCount(500)
            .diskCacheSize(50 * 1024 * 1024).
                    imageDownloader(new BaseImageDownloader(this, 10 * 1000, 20 * 1000))
            .memoryCacheSize((int) Runtime.getRuntime().maxMemory() / 8)
            .defaultDisplayImageOptions(defaultOptions).build();
    ImageLoader.getInstance().init(config);
}
 
开发者ID:hehonghui,项目名称:commonadapter,代码行数:19,代码来源:MultiImageActivity.java

示例13: initConfig

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
private void initConfig() {
    DisplayImageOptions localDisplayImageOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisk(true).build();
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory());
    //用最大内存的1/8来存储图片
    final int cacheSize = maxMemory / 8;
    ImageLoaderConfiguration configuration = new ImageLoaderConfiguration.Builder(getApplicationContext())
            .memoryCacheExtraOptions(W, H) // default = device screen dimensions
            .threadPoolSize(2) // default
            .threadPriority(Thread.NORM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(cacheSize))
            .memoryCacheSize(cacheSize)
            .memoryCacheSizePercentage(13) // default
            .diskCache(new UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(getApplicationContext(), config.PATH.CHACHE_PATH))) // default
            .diskCacheSize(10 * 1024 * 1024)
            .diskCacheFileCount(100)//.writeDebugLogs()
            .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(getApplicationContext())) // default
            .defaultDisplayImageOptions(localDisplayImageOptions)
            .build();
    ImageLoader.getInstance().init(configuration);
}
 
开发者ID:qbeenslee,项目名称:Nepenthes-Android,代码行数:24,代码来源:NeApp.java

示例14: initImageLoader

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
private void initImageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .threadPriority(Thread.NORM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
开发者ID:snowdream,项目名称:snowdream-books-android,代码行数:25,代码来源:MainApplication.java

示例15: getDefaultImageLoaderConfigurationBuilder

import com.nostra13.universalimageloader.core.download.BaseImageDownloader; //导入依赖的package包/类
public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
//                .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
                .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
                .discCache(new UnlimitedDiscCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .discCacheFileCount(1000)
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                        //   .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .defaultDisplayImageOptions(getDefaultImageOptions());
        return builder;
    }
 
开发者ID:cymcsg,项目名称:UltimateAndroid,代码行数:23,代码来源:UniversalImageLoader.java


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