public static Downloader createCacheDownloader(Context context) { try { Class.forName("com.squareup.okhttp.OkHttpClient"); File cacheDir = createDefaultCacheDir(context, CACHE_PATH); long cacheSize = calculateDiskCacheSize(cacheDir); return new OkHttpDownloader(cacheDir, cacheSize); } catch (ClassNotFoundException e) { return new UrlConnectionDownloader(context); } }
private static Downloader createDefaultDownloader(Context context) { try { Class.forName("com.squareup.okhttp.OkHttpClient"); return OkHttpLoaderCreator.create(context); } catch (ClassNotFoundException e) { return new UrlConnectionDownloader(context); } }
private void initPicasso() { mPicasso = new Picasso.Builder(mContext) .downloader(new UrlConnectionDownloader(mContext)) .loggingEnabled(WriteLog.IsEnabled()) .build(); }