本文整理匯總了Java中com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator類的典型用法代碼示例。如果您正苦於以下問題:Java HashCodeFileNameGenerator類的具體用法?Java HashCodeFileNameGenerator怎麽用?Java HashCodeFileNameGenerator使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
HashCodeFileNameGenerator類屬於com.nostra13.universalimageloader.cache.disc.naming包,在下文中一共展示了HashCodeFileNameGenerator類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例2: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例3: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例4: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例5: ImageUtil
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
private ImageUtil(Context ctx) {
this.context = ctx;
threadPool = Executors.newFixedThreadPool(5);
this.preferences = PreferenceManager.getDefaultSharedPreferences(ctx);
provider = ImageServiceProvider.values()[preferences.getInt(PREFERENCE_PROVIDER, ImageServiceProvider.GLIDE.ordinal())];
Fresco.initialize(context);
picasso = Picasso.with(ctx);
glide = Glide.with(ctx);
universalImageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.diskCache(new UnlimitedDiskCache(ctx.getCacheDir())) // default
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
// .writeDebugLogs()
.build();
universalImageLoader.init(config);
ion = Ion.getDefault(context);
}
示例6: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
/**
* 初始化ImageLoader
*/
public static void initImageLoader(Context context) {
// ImageLoader配置參數
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.threadPoolSize(3) // 線程池大小,默認為3
.threadPriority(Thread.NORM_PRIORITY - 1) // default
.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
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config); // 必須先初始化ImageLoader
}
示例7: initConfig
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例8: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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);
}
示例9: setupUIL
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
/**
* Universal Image Loader Setup
*/
private void setupUIL() {
File cacheDir = StorageUtils.getOwnCacheDirectory(
getApplicationContext(), "CafeCar/cache");
options = new DisplayImageOptions.Builder()
.cacheOnDisc(true).cacheInMemory(true).build();
cache = new TotalSizeLimitedDiscCache(cacheDir, 50 * 1024 * 1024);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
getApplicationContext()).threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 1)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024))
// You can pass your own memory cache implementation
.discCache(cache)
// You can pass your own disc cache implementation
.discCacheFileNameGenerator(new HashCodeFileNameGenerator())
.defaultDisplayImageOptions(options).build();
ImageLoader.getInstance().init(config);
}
示例10: getDefaultImageLoaderConfigurationBuilder
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的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;
}
示例11: getDefaultImageLoaderConfigurationBuilder
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
/**
* Get default ImageLoaderConfiguration.Builder,and you can easily change the builder.
* @param context
* @return
*/
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
.diskCache(new UnlimitedDiskCache(cacheDir)) // default
// .discCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(1000)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(context)) // default
.imageDecoder(new BaseImageDecoder(false)) // default
// .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.defaultDisplayImageOptions(getDefaultImageOptions());
return builder;
}
示例12: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
public static void initImageLoader(Context context) {
File cacheDir = StorageUtils.getCacheDirectory(context);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.denyCacheImageMultipleSizesInMemory()
.discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, 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
.discCache(new UnlimitedDiscCache(cacheDir)) // default
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(context)) // default
.imageDecoder(new BaseImageDecoder(true)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
示例13: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
/**
* @return void
* @Title: initImageLoader
* @Description: TODO
*/
private void initImageLoader() {
DisplayImageOptions imageOptions = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.default_background)
.showImageOnFail(R.drawable.default_background)
.cacheInMemory(true).cacheOnDisk(true)
.resetViewBeforeLoading(true).considerExifParams(false)
.bitmapConfig(Bitmap.Config.RGB_565).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.memoryCacheExtraOptions(480, 800)
.diskCacheExtraOptions(480, 800, null)
.threadPoolSize(5)
.threadPriority(Thread.NORM_PRIORITY)
.tasksProcessingOrder(QueueProcessingType.LIFO)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(10)
// .diskCache(
// new UnlimitedDiscCache(StorageUtils.getCacheDirectory(
// this, true)))
.diskCacheSize(50 * 1024 * 1024).diskCacheFileCount(100)
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator())
.imageDownloader(new BaseImageDownloader(this))
.imageDecoder(new BaseImageDecoder(false))
.defaultDisplayImageOptions(DisplayImageOptions.createSimple())
.defaultDisplayImageOptions(imageOptions).build();
ImageLoader.getInstance().init(config);
}
示例14: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
private void initImageLoader() {
File cacheDir = FileUtil.getCacheDirectory(this, FilePathConfig.PATH_IMAGEDOWNLOADER);
DisplayImageOptions options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.drawable.default_imageview_background) // resource or drawable
.showImageForEmptyUri(R.drawable.default_imageview_background) // resource or drawable
.showImageOnFail(R.drawable.default_imageview_background) // resource or drawable
.resetViewBeforeLoading(false) // default
.delayBeforeLoading(200)
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default
.bitmapConfig(Bitmap.Config.ARGB_8888) // default
.displayer(new SimpleBitmapDisplayer()) // default
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext())
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.diskCacheExtraOptions(480, 800, null)
.threadPoolSize(3) // default
.threadPriority(Thread.NORM_PRIORITY - 2) // default
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(20 * 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(getApplicationContext())) // default
.imageDecoder(new BaseImageDecoder(false)) // default
.defaultDisplayImageOptions(options)
.build();
ImageLoader.getInstance().init(config);
}
示例15: initImageLoader
import com.nostra13.universalimageloader.cache.disc.naming.HashCodeFileNameGenerator; //導入依賴的package包/類
/**
* 初始化 ImageLoader
*
* @param context
*/
public static ImageLoader initImageLoader(Context context) {
DisplayImageOptions options = getDefaultDisplayImageOptions();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context.getApplicationContext())
.threadPoolSize(10)
.threadPriority(Thread.NORM_PRIORITY - 2)
.tasksProcessingOrder(QueueProcessingType.FIFO)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024))
.discCache(new UnlimitedDiskCache(getDefaultCacheDir()))
.discCacheFileNameGenerator(new HashCodeFileNameGenerator())
.imageDownloader(
new BaseImageDownloader(context.getApplicationContext()))
.defaultDisplayImageOptions(options)
// .writeDebugLogs()
.build();
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
return imageLoader;
}