本文整理汇总了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);
}
示例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);
}