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


Java HttpClientImageDownloader类代码示例

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


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

示例1: configUIL

import com.nostra13.universalimageloader.core.download.HttpClientImageDownloader; //导入依赖的package包/类
public static void configUIL(Context context) {
	File cacheDir = new File(context.getExternalCacheDir(), UIL_CACHE);
	
	DisplayImageOptions defaultOptions = defaultImageOptions();
	
	HttpClientImageDownloader downloader = new HttpClientImageDownloader(context, 
			BuddycloudHTTPHelper.createHttpClient(context));
	
	ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
			.discCache(new TotalSizeLimitedDiscCache(cacheDir, 50 * 1024 * 1024))
			.imageDownloader(downloader)
			.defaultDisplayImageOptions(defaultOptions)
			.writeDebugLogs()
			.build();
	
	ImageLoader.getInstance().init(config);
}
 
开发者ID:buddycloud,项目名称:buddycloud-android,代码行数:18,代码来源:ImageHelper.java

示例2: DobroNetwork

import com.nostra13.universalimageloader.core.download.HttpClientImageDownloader; //导入依赖的package包/类
public DobroNetwork(DobroApplication context) {

		BasicHttpParams httpParams = new BasicHttpParams();

        ConnManagerParams.setTimeout(httpParams, 10000);
        ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(20));
        ConnManagerParams.setMaxTotalConnections(httpParams, 20);

        HttpConnectionParams.setSoTimeout(httpParams, 10000);
        HttpConnectionParams.setTcpNoDelay(httpParams, true);
        HttpConnectionParams.setSocketBufferSize(httpParams, 8192);

        HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1);
        HttpProtocolParams.setUserAgent(httpParams, getUserAgent());
        
        SchemeRegistry schemeRegistry = new SchemeRegistry();
        schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443));
        ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry);

        m_http_context = new SyncBasicHttpContext(new BasicHttpContext());
        m_httpclient = new DefaultHttpClient(cm, httpParams);

		m_cookie_store = new BasicCookieStore();
		loadCookies();
		m_http_context.setAttribute(ClientContext.COOKIE_STORE, m_cookie_store);
		createDownloadReceiver();
		

		File cacheDir = StorageUtils.getIndividualCacheDirectory(context);
		disc_cache = new TotalSizeLimitedDiscCache(cacheDir, 30 * 1024 * 1024);
		memory_cache = new UsingFreqLimitedMemoryCache(2 * 1024 * 1024);
		ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
		        .threadPoolSize(5)
		        .threadPriority(Thread.NORM_PRIORITY - 2)
		        .memoryCache(memory_cache)
		        .discCache(disc_cache)
		        .imageDownloader(new HttpClientImageDownloader(context, m_httpclient))
		        .tasksProcessingOrder(QueueProcessingType.LIFO)
		        .defaultDisplayImageOptions(new DisplayImageOptions.Builder()
		        	.cacheInMemory()
		        	.cacheOnDisc()
		        	.imageScaleType(ImageScaleType.IN_SAMPLE_INT)
		        	.bitmapConfig(Bitmap.Config.ARGB_8888)
		        	.displayer(new SimpleBitmapDisplayer())
		        	.build())
		        .enableLogging()
		        .build();
		ImageLoader.getInstance().init(config);
	}
 
开发者ID:rdmwfs,项目名称:dobroreader-mod,代码行数:51,代码来源:DobroNetwork.java


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