Tabnine Logo
DiskLruCacheFactory.<init>
Code IndexAdd Tabnine to your IDE (free)

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

Best Java code snippets using com.bumptech.glide.load.engine.cache.DiskLruCacheFactory.<init> (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<init>

Javadoc

When using this constructor CacheDirectoryGetter#getCacheDirectory() will be called out of UI thread, allowing to do I/O access without performance impacts.

Popular methods of DiskLruCacheFactory

    Popular in Java

    • Making http requests using okhttp
    • getOriginalFilename (MultipartFile)
      Return the original filename in the client's filesystem.This may contain path information depending
    • findViewById (Activity)
    • requestLocationUpdates (LocationManager)
    • Rectangle (java.awt)
      A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
    • FileReader (java.io)
      A specialized Reader that reads from a file in the file system. All read requests made by calling me
    • Date (java.util)
      A specific moment in time, with millisecond precision. Values typically come from System#currentTime
    • Callable (java.util.concurrent)
      A task that returns a result and may throw an exception. Implementors define a single method with no
    • ExecutorService (java.util.concurrent)
      An Executor that provides methods to manage termination and methods that can produce a Future for tr
    • Get (org.apache.hadoop.hbase.client)
      Used to perform Get operations on a single row. To get everything for a row, instantiate a Get objec
    • Top Sublime Text plugins
    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