98 lines
3.6 KiB
Java
98 lines
3.6 KiB
Java
package com.bumptech.glide;
|
|
|
|
import android.content.Context;
|
|
import androidx.collection.ArrayMap;
|
|
import com.bumptech.glide.load.engine.Engine;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPoolAdapter;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.LruArrayPool;
|
|
import com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool;
|
|
import com.bumptech.glide.load.engine.cache.DiskCache;
|
|
import com.bumptech.glide.load.engine.cache.InternalCacheDiskCacheFactory;
|
|
import com.bumptech.glide.load.engine.cache.LruResourceCache;
|
|
import com.bumptech.glide.load.engine.cache.MemoryCache;
|
|
import com.bumptech.glide.load.engine.cache.MemorySizeCalculator;
|
|
import com.bumptech.glide.load.engine.executor.GlideExecutor;
|
|
import com.bumptech.glide.manager.ConnectivityMonitorFactory;
|
|
import com.bumptech.glide.manager.DefaultConnectivityMonitorFactory;
|
|
import com.bumptech.glide.manager.RequestManagerRetriever;
|
|
import com.bumptech.glide.request.RequestOptions;
|
|
import java.util.Map;
|
|
|
|
/* loaded from: classes.dex */
|
|
public final class GlideBuilder {
|
|
private Engine b;
|
|
private BitmapPool c;
|
|
private ArrayPool d;
|
|
private MemoryCache e;
|
|
private GlideExecutor f;
|
|
private GlideExecutor g;
|
|
private DiskCache.Factory h;
|
|
private MemorySizeCalculator i;
|
|
private ConnectivityMonitorFactory j;
|
|
private RequestManagerRetriever.RequestManagerFactory m;
|
|
private GlideExecutor n;
|
|
private boolean o;
|
|
private final Map<Class<?>, TransitionOptions<?, ?>> a = new ArrayMap();
|
|
private int k = 4;
|
|
private RequestOptions l = new RequestOptions();
|
|
|
|
public GlideBuilder a(DiskCache.Factory factory) {
|
|
this.h = factory;
|
|
return this;
|
|
}
|
|
|
|
void a(RequestManagerRetriever.RequestManagerFactory requestManagerFactory) {
|
|
this.m = requestManagerFactory;
|
|
}
|
|
|
|
Glide a(Context context) {
|
|
if (this.f == null) {
|
|
this.f = GlideExecutor.d();
|
|
}
|
|
if (this.g == null) {
|
|
this.g = GlideExecutor.c();
|
|
}
|
|
if (this.n == null) {
|
|
this.n = GlideExecutor.b();
|
|
}
|
|
if (this.i == null) {
|
|
this.i = new MemorySizeCalculator.Builder(context).a();
|
|
}
|
|
if (this.j == null) {
|
|
this.j = new DefaultConnectivityMonitorFactory();
|
|
}
|
|
if (this.c == null) {
|
|
int b = this.i.b();
|
|
if (b > 0) {
|
|
this.c = new LruBitmapPool(b);
|
|
} else {
|
|
this.c = new BitmapPoolAdapter();
|
|
}
|
|
}
|
|
if (this.d == null) {
|
|
this.d = new LruArrayPool(this.i.a());
|
|
}
|
|
if (this.e == null) {
|
|
this.e = new LruResourceCache(this.i.c());
|
|
}
|
|
if (this.h == null) {
|
|
this.h = new InternalCacheDiskCacheFactory(context);
|
|
}
|
|
if (this.b == null) {
|
|
this.b = new Engine(this.e, this.h, this.g, this.f, GlideExecutor.e(), GlideExecutor.b(), this.o);
|
|
}
|
|
RequestManagerRetriever requestManagerRetriever = new RequestManagerRetriever(this.m);
|
|
Engine engine = this.b;
|
|
MemoryCache memoryCache = this.e;
|
|
BitmapPool bitmapPool = this.c;
|
|
ArrayPool arrayPool = this.d;
|
|
ConnectivityMonitorFactory connectivityMonitorFactory = this.j;
|
|
int i = this.k;
|
|
RequestOptions requestOptions = this.l;
|
|
requestOptions.J();
|
|
return new Glide(context, engine, memoryCache, bitmapPool, arrayPool, requestManagerRetriever, connectivityMonitorFactory, i, requestOptions, this.a);
|
|
}
|
|
}
|