use of com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory in project glide by bumptech.
the class GlideBuilder method createGlide.
Glide createGlide(Context context) {
if (sourceExecutor == null) {
sourceExecutor = GlideExecutor.newSourceExecutor();
}
if (diskCacheExecutor == null) {
diskCacheExecutor = GlideExecutor.newDiskCacheExecutor();
}
if (memorySizeCalculator == null) {
memorySizeCalculator = new MemorySizeCalculator.Builder(context).build();
}
if (connectivityMonitorFactory == null) {
connectivityMonitorFactory = new DefaultConnectivityMonitorFactory();
}
if (bitmapPool == null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
int size = memorySizeCalculator.getBitmapPoolSize();
bitmapPool = new LruBitmapPool(size);
} else {
bitmapPool = new BitmapPoolAdapter();
}
}
if (arrayPool == null) {
arrayPool = new LruArrayPool(memorySizeCalculator.getArrayPoolSizeInBytes());
}
if (memoryCache == null) {
memoryCache = new LruResourceCache(memorySizeCalculator.getMemoryCacheSize());
}
if (diskCacheFactory == null) {
diskCacheFactory = new InternalCacheDiskCacheFactory(context);
}
if (engine == null) {
engine = new Engine(memoryCache, diskCacheFactory, diskCacheExecutor, sourceExecutor, GlideExecutor.newUnlimitedSourceExecutor());
}
return new Glide(context, engine, memoryCache, bitmapPool, arrayPool, connectivityMonitorFactory, logLevel, defaultRequestOptions.lock());
}
use of com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory in project open-event-orga-app by fossasia.
the class GlideAPI method applyOptions.
// TODO: Modify the options here according to the need
@Override
public void applyOptions(Context context, GlideBuilder builder) {
// 10mb
int diskCacheSizeBytes = 1024 * 1024 * 10;
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, diskCacheSizeBytes));
}
use of com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory in project AntennaPod by AntennaPod.
the class ApGlideModule method applyOptions.
@Override
public void applyOptions(@NonNull Context context, @NonNull GlideBuilder builder) {
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_ARGB_8888));
@SuppressLint("UsableSpace") long spaceAvailable = context.getCacheDir().getUsableSpace();
long imageCacheSize = (spaceAvailable > 2 * GIGABYTES) ? (250 * MEGABYTES) : (50 * MEGABYTES);
Log.d(TAG, "Free space on cache dir: " + spaceAvailable + ", using image cache size: " + imageCacheSize);
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, imageCacheSize));
}
use of com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory in project LeafPic by HoraApps.
the class CustomGlideModule method applyOptions.
@Override
public void applyOptions(Context context, GlideBuilder builder) {
// Apply options to the builder here.
builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
MemorySizeCalculator calculator = new MemorySizeCalculator(context);
int defaultMemoryCacheSize = calculator.getMemoryCacheSize();
int defaultBitmapPoolSize = calculator.getBitmapPoolSize();
int customMemoryCacheSize = (int) (1.2 * defaultMemoryCacheSize);
int customBitmapPoolSize = (int) (1.2 * defaultBitmapPoolSize);
builder.setMemoryCache(new LruResourceCache(customMemoryCacheSize));
builder.setBitmapPool(new LruBitmapPool(customBitmapPoolSize));
int cacheSize100MegaBytes = 104857600;
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, cacheSize100MegaBytes));
}
use of com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory in project smartmodule by carozhu.
the class SmartGlideModule method applyOptions.
@Override
public void applyOptions(Context context, GlideBuilder builder) {
// TODO: 16/6/24 Apply options to the builder here.
// 设置别的get/set tag id,以免占用View默认的
ViewTarget.setTagId(R.id.glide_tag_id);
// 设置图片质量为高质量
builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
// 100M
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, DEFAULT_SAVE_IMAGE_PATH, 100 * 1024 * 1024));
}
Aggregations