本文整理匯總了Java中com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator類的典型用法代碼示例。如果您正苦於以下問題:Java Md5FileNameGenerator類的具體用法?Java Md5FileNameGenerator怎麽用?Java Md5FileNameGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Md5FileNameGenerator類屬於com.nostra13.universalimageloader.cache.disc.naming包,在下文中一共展示了Md5FileNameGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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());
}
示例2: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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());
}
示例3: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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);
}
示例4: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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);
}
示例5: downloadImage
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
private void downloadImage() {
MobclickAgent.onEvent(getActivity(), Event.STATUS_SAVE_IMAGE_OK);
this.imageLoader.loadImage(this.imageUrl, new SimpleImageLoadingListener() {
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
if (!HomePopView.this.isRemoved()) {
String result = FileUtil.downloadImage2Gallery(HomePopView.this.getActivity()
, loadedImage, new Md5FileNameGenerator().generate(HomePopView.this
.imageUrl));
if (TextUtils.isEmpty(result)) {
Helper.showToast((CharSequence) "保存圖片失敗,請重新保存~~");
} else {
Helper.showToast("圖片已保存到" + result);
}
HomePopView.this.ivDownload.setEnabled(true);
}
}
});
}
示例6: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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());
}
示例7: getDefaultConfig
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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;
}
示例8: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
private void initImageLoader() {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(false)
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.defaultDisplayImageOptions(defaultOptions)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCache(new UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, Constant.APP_IMAGE)))
.diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO)
.memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024)
.threadPoolSize(3)
.build();
ImageLoader.getInstance().init(config);
}
示例9: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
private 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());
}
示例10: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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());
}
示例11: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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);
}
示例12: onCreate
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的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);
}
示例13: init
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
private void init(Context context) {
imageLoaderconfig = new ImageLoaderConfiguration.Builder(
context)
.memoryCacheExtraOptions(720, 1280)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCacheSize(50 * 1024 * 1024)
// 50 Mb
.tasksProcessingOrder(QueueProcessingType.LIFO)
.build();
if (!_imageLoader.isInited())
_imageLoader.init(imageLoaderconfig);
}
示例14: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
private void initImageLoader() {
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(false)
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPriority(Thread.NORM_PRIORITY - 2)
.defaultDisplayImageOptions(defaultOptions)
.denyCacheImageMultipleSizesInMemory()
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCache(new UnlimitedDiskCache(StorageUtils.getOwnCacheDirectory(this, AppConstants.APP_IMAGE)))
.diskCacheSize(100 * 1024 * 1024).tasksProcessingOrder(QueueProcessingType.LIFO)
.memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSize(2 * 1024 * 1024)
.threadPoolSize(3)
.build();
ImageLoader.getInstance().init(config);
}
示例15: UILKit
import com.nostra13.universalimageloader.cache.disc.naming.Md5FileNameGenerator; //導入依賴的package包/類
/**
* 初始化
*
* @param context
*/
private UILKit(Context context) {
File cacheDir = getDiskCacheDir(context, "img");
ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.memoryCacheSize(10 * 1024 * 1024)
.diskCache(new UnlimitedDiskCache(cacheDir))
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.diskCacheSize(50 * 1024 * 1024) // 50 MiB
.tasksProcessingOrder(QueueProcessingType.LIFO);
ImageLoader.getInstance().init(config.build());
picOptions = new DisplayImageOptions.Builder()
.imageScaleType(ImageScaleType.EXACTLY)
.cacheOnDisk(false).cacheInMemory(false)
.resetViewBeforeLoading(true)
.displayer(new FadeInBitmapDisplayer(500)).build();
}