mirror of
https://github.com/antebudimir/tempus.git
synced 2025-12-31 17:43:32 +00:00
Redefined glide cache
This commit is contained in:
parent
90df6e5fc9
commit
56701463e4
1 changed files with 3 additions and 4 deletions
|
|
@ -8,6 +8,7 @@ import com.bumptech.glide.GlideBuilder;
|
|||
import com.bumptech.glide.annotation.GlideModule;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
|
||||
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.cappielloantonio.play.util.Preferences;
|
||||
|
|
@ -18,10 +19,8 @@ import java.io.File;
|
|||
public class CustomGlideModule extends AppGlideModule {
|
||||
@Override
|
||||
public void applyOptions(@NonNull Context context, GlideBuilder builder) {
|
||||
File file = new File(context.getCacheDir() + "glide");
|
||||
int size = Preferences.getImageCacheSize();
|
||||
|
||||
builder.setDiskCache(new DiskLruCacheFactory(() -> file, size));
|
||||
int diskCacheSize = Preferences.getImageCacheSize() * 1024 * 1024;
|
||||
builder.setDiskCache(new InternalCacheDiskCacheFactory(context, "cache", diskCacheSize));
|
||||
builder.setDefaultRequestOptions(new RequestOptions().format(DecodeFormat.PREFER_RGB_565));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue