congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DiskLruCacheFactory
Code IndexAdd Tabnine to your IDE (free)

How to use
DiskLruCacheFactory
in
com.bumptech.glide.load.engine.cache

Best Java code snippets using com.bumptech.glide.load.engine.cache.DiskLruCacheFactory (Showing top 5 results out of 315)

origin: Naoki2015/CircleDemo

@Override
public void applyOptions(final Context context, GlideBuilder builder) {
  builder.setDiskCache(new DiskLruCacheFactory(new DiskLruCacheFactory.CacheDirectoryGetter
      () {
    @Override
    public File getCacheDirectory() {
      return context.getExternalCacheDir();
    }
  }, DiskCache.Factory.DEFAULT_DISK_CACHE_SIZE));
}
origin: waynell/VideoListPlayer

@Override
public void applyOptions(final Context context, GlideBuilder builder) {
  ViewTarget.setTagId(R.id.glide_loader);
  builder.setDiskCache(new DiskLruCacheFactory(new DiskLruCacheFactory.CacheDirectoryGetter
      () {
    @Override
    public File getCacheDirectory() {
      return context.getExternalCacheDir();
    }
  }, DiskCache.Factory.DEFAULT_DISK_CACHE_SIZE));
}
origin: zhujian1989/gank.io

@Override
public void applyOptions(Context context, GlideBuilder builder) {
  int maxMemory = (int) Runtime.getRuntime().maxMemory();//获取系统分配给应用的总内存大小
  int memoryCacheSize = maxMemory / 8;//设置图片内存缓存占用八分之一
  //设置内存缓存大小
  builder.setMemoryCache(new LruResourceCache(memoryCacheSize));
  File cacheDir = context.getExternalCacheDir();//指定的是数据的缓存地址
  int diskCacheSize = 1024 * 1024 * 30;//最多可以缓存多少字节的数据
  //设置磁盘缓存大小
  builder.setDiskCache(new DiskLruCacheFactory(cacheDir.getPath(), "glide", diskCacheSize));
  //存放在data/data/xxxx/cache/
  //builder.setDiskCache(new InternalCacheDiskCacheFactory(context, "glide", diskCacheSize));
  //存放在外置文件浏览器
  // builder.setDiskCache(new ExternalCacheDiskCacheFactory(context, "glide", diskCacheSize));
  builder.setBitmapPool(new LruBitmapPool(memoryCacheSize));
  builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
}
origin: leftcoding/GankLy

  @Override
  public void applyOptions(Context context, GlideBuilder builder) {
    super.applyOptions(context, builder);
    String diskCache = FileUtils.getGlideDefaultPath(context);
    builder.setDiskCache(new DiskLruCacheFactory(diskCache, 100 * 1024 * 1024));
//        builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
    builder.setDefaultRequestOptions(new RequestOptions()
            .format(DecodeFormat.PREFER_ARGB_8888)
    );
  }

origin: xujianhui404/livewallpaper

@Override
public void applyOptions(Context context, GlideBuilder builder) {
  //设置加载的图片质量
  builder.setDecodeFormat(DecodeFormat.PREFER_ARGB_8888);
  //根据已经得到的加载的图片的内存策略进行更改
  MemorySizeCalculator memorySizeCalculator = new MemorySizeCalculator(context);
  int bitmapPoolSize = memorySizeCalculator.getBitmapPoolSize();
  int memoryCacheSize = memorySizeCalculator.getMemoryCacheSize();
  builder.setMemoryCache(new LruResourceCache((int) (memoryCacheSize * 1.1)));
  builder.setBitmapPool(new LruBitmapPool((int) (bitmapPoolSize * 1.1)));
  //更改磁盘缓存路径
  int size = 10 * 1024 * 1024;
  //1.1私有缓存data/data/应用包名/cache/mydir
  builder.setDiskCache(new InternalCacheDiskCacheFactory(context, "mydir", size));//10MB
  //1.2外部缓存SDCard/Android/data/应用包名/cache/mydir
  builder.setDiskCache(new ExternalCacheDiskCacheFactory(context, "mydir", size));
  //1.3自定义缓存路径
  builder.setDiskCache(new DiskLruCacheFactory("folder", "cacheName", size));
}
com.bumptech.glide.load.engine.cacheDiskLruCacheFactory

Javadoc

Creates an com.bumptech.glide.disklrucache.DiskLruCache based disk cache in the specified disk cache directory.

If you need to make I/O access before returning the cache directory use the DiskLruCacheFactory#DiskLruCacheFactory(CacheDirectoryGetter,int) constructor variant.

Most used methods

  • <init>

Popular in Java

  • Finding current android device location
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • addToBackStack (FragmentTransaction)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Notification (javax.management)
  • JComboBox (javax.swing)
  • Best plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now