Initial commit
This commit is contained in:
17
sources/com/bumptech/glide/GeneratedAppGlideModule.java
Normal file
17
sources/com/bumptech/glide/GeneratedAppGlideModule.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import com.bumptech.glide.manager.RequestManagerRetriever;
|
||||
import com.bumptech.glide.module.AppGlideModule;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class GeneratedAppGlideModule extends AppGlideModule {
|
||||
GeneratedAppGlideModule() {
|
||||
}
|
||||
|
||||
abstract Set<Class<?>> a();
|
||||
|
||||
RequestManagerRetriever.RequestManagerFactory b() {
|
||||
return null;
|
||||
}
|
||||
}
|
5
sources/com/bumptech/glide/GenericTransitionOptions.java
Normal file
5
sources/com/bumptech/glide/GenericTransitionOptions.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class GenericTransitionOptions<TranscodeType> extends TransitionOptions<GenericTransitionOptions<TranscodeType>, TranscodeType> {
|
||||
}
|
413
sources/com/bumptech/glide/Glide.java
Normal file
413
sources/com/bumptech/glide/Glide.java
Normal file
@@ -0,0 +1,413 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentCallbacks2;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.content.res.Configuration;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import com.bumptech.glide.gifdecoder.GifDecoder;
|
||||
import com.bumptech.glide.load.DecodeFormat;
|
||||
import com.bumptech.glide.load.ImageHeaderParser;
|
||||
import com.bumptech.glide.load.ResourceDecoder;
|
||||
import com.bumptech.glide.load.ResourceEncoder;
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.data.InputStreamRewinder;
|
||||
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.cache.MemoryCache;
|
||||
import com.bumptech.glide.load.engine.prefill.BitmapPreFiller;
|
||||
import com.bumptech.glide.load.model.AssetUriLoader;
|
||||
import com.bumptech.glide.load.model.ByteArrayLoader;
|
||||
import com.bumptech.glide.load.model.ByteBufferEncoder;
|
||||
import com.bumptech.glide.load.model.ByteBufferFileLoader;
|
||||
import com.bumptech.glide.load.model.DataUrlLoader;
|
||||
import com.bumptech.glide.load.model.FileLoader;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.model.MediaStoreFileLoader;
|
||||
import com.bumptech.glide.load.model.ResourceLoader;
|
||||
import com.bumptech.glide.load.model.StreamEncoder;
|
||||
import com.bumptech.glide.load.model.StringLoader;
|
||||
import com.bumptech.glide.load.model.UnitModelLoader;
|
||||
import com.bumptech.glide.load.model.UriLoader;
|
||||
import com.bumptech.glide.load.model.UrlUriLoader;
|
||||
import com.bumptech.glide.load.model.stream.HttpGlideUrlLoader;
|
||||
import com.bumptech.glide.load.model.stream.HttpUriLoader;
|
||||
import com.bumptech.glide.load.model.stream.MediaStoreImageThumbLoader;
|
||||
import com.bumptech.glide.load.model.stream.MediaStoreVideoThumbLoader;
|
||||
import com.bumptech.glide.load.model.stream.UrlLoader;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapDrawableDecoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapDrawableEncoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapEncoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.ByteBufferBitmapDecoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.DefaultImageHeaderParser;
|
||||
import com.bumptech.glide.load.resource.bitmap.Downsampler;
|
||||
import com.bumptech.glide.load.resource.bitmap.ResourceBitmapDecoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.StreamBitmapDecoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.UnitBitmapDecoder;
|
||||
import com.bumptech.glide.load.resource.bitmap.VideoDecoder;
|
||||
import com.bumptech.glide.load.resource.bytes.ByteBufferRewinder;
|
||||
import com.bumptech.glide.load.resource.drawable.ResourceDrawableDecoder;
|
||||
import com.bumptech.glide.load.resource.drawable.UnitDrawableDecoder;
|
||||
import com.bumptech.glide.load.resource.file.FileDecoder;
|
||||
import com.bumptech.glide.load.resource.gif.ByteBufferGifDecoder;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawableEncoder;
|
||||
import com.bumptech.glide.load.resource.gif.GifFrameResourceDecoder;
|
||||
import com.bumptech.glide.load.resource.gif.StreamGifDecoder;
|
||||
import com.bumptech.glide.load.resource.transcode.BitmapBytesTranscoder;
|
||||
import com.bumptech.glide.load.resource.transcode.BitmapDrawableTranscoder;
|
||||
import com.bumptech.glide.load.resource.transcode.DrawableBytesTranscoder;
|
||||
import com.bumptech.glide.load.resource.transcode.GifDrawableBytesTranscoder;
|
||||
import com.bumptech.glide.manager.ConnectivityMonitorFactory;
|
||||
import com.bumptech.glide.manager.RequestManagerRetriever;
|
||||
import com.bumptech.glide.module.GlideModule;
|
||||
import com.bumptech.glide.module.ManifestParser;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.ImageViewTargetFactory;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.net.URL;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Glide implements ComponentCallbacks2 {
|
||||
private static volatile Glide j;
|
||||
private static volatile boolean k;
|
||||
private final Engine a;
|
||||
private final BitmapPool b;
|
||||
private final MemoryCache c;
|
||||
private final GlideContext d;
|
||||
private final Registry e;
|
||||
private final ArrayPool f;
|
||||
private final RequestManagerRetriever g;
|
||||
private final ConnectivityMonitorFactory h;
|
||||
private final List<RequestManager> i = new ArrayList();
|
||||
|
||||
Glide(Context context, Engine engine, MemoryCache memoryCache, BitmapPool bitmapPool, ArrayPool arrayPool, RequestManagerRetriever requestManagerRetriever, ConnectivityMonitorFactory connectivityMonitorFactory, int i, RequestOptions requestOptions, Map<Class<?>, TransitionOptions<?, ?>> map) {
|
||||
MemoryCategory memoryCategory = MemoryCategory.NORMAL;
|
||||
this.a = engine;
|
||||
this.b = bitmapPool;
|
||||
this.f = arrayPool;
|
||||
this.c = memoryCache;
|
||||
this.g = requestManagerRetriever;
|
||||
this.h = connectivityMonitorFactory;
|
||||
new BitmapPreFiller(memoryCache, bitmapPool, (DecodeFormat) requestOptions.p().a(Downsampler.f));
|
||||
Resources resources = context.getResources();
|
||||
this.e = new Registry();
|
||||
this.e.a((ImageHeaderParser) new DefaultImageHeaderParser());
|
||||
Downsampler downsampler = new Downsampler(this.e.a(), resources.getDisplayMetrics(), bitmapPool, arrayPool);
|
||||
ByteBufferGifDecoder byteBufferGifDecoder = new ByteBufferGifDecoder(context, this.e.a(), bitmapPool, arrayPool);
|
||||
ResourceDecoder<ParcelFileDescriptor, Bitmap> b = VideoDecoder.b(bitmapPool);
|
||||
ByteBufferBitmapDecoder byteBufferBitmapDecoder = new ByteBufferBitmapDecoder(downsampler);
|
||||
StreamBitmapDecoder streamBitmapDecoder = new StreamBitmapDecoder(downsampler, arrayPool);
|
||||
ResourceDrawableDecoder resourceDrawableDecoder = new ResourceDrawableDecoder(context);
|
||||
ResourceLoader.StreamFactory streamFactory = new ResourceLoader.StreamFactory(resources);
|
||||
ResourceLoader.UriFactory uriFactory = new ResourceLoader.UriFactory(resources);
|
||||
ResourceLoader.FileDescriptorFactory fileDescriptorFactory = new ResourceLoader.FileDescriptorFactory(resources);
|
||||
ResourceLoader.AssetFileDescriptorFactory assetFileDescriptorFactory = new ResourceLoader.AssetFileDescriptorFactory(resources);
|
||||
BitmapEncoder bitmapEncoder = new BitmapEncoder(arrayPool);
|
||||
BitmapBytesTranscoder bitmapBytesTranscoder = new BitmapBytesTranscoder();
|
||||
GifDrawableBytesTranscoder gifDrawableBytesTranscoder = new GifDrawableBytesTranscoder();
|
||||
ContentResolver contentResolver = context.getContentResolver();
|
||||
Registry registry = this.e;
|
||||
registry.a(ByteBuffer.class, new ByteBufferEncoder());
|
||||
registry.a(InputStream.class, new StreamEncoder(arrayPool));
|
||||
registry.a("Bitmap", ByteBuffer.class, Bitmap.class, byteBufferBitmapDecoder);
|
||||
registry.a("Bitmap", InputStream.class, Bitmap.class, streamBitmapDecoder);
|
||||
registry.a("Bitmap", ParcelFileDescriptor.class, Bitmap.class, b);
|
||||
registry.a("Bitmap", AssetFileDescriptor.class, Bitmap.class, VideoDecoder.a(bitmapPool));
|
||||
registry.a(Bitmap.class, Bitmap.class, UnitModelLoader.Factory.b());
|
||||
registry.a("Bitmap", Bitmap.class, Bitmap.class, new UnitBitmapDecoder());
|
||||
registry.a(Bitmap.class, (ResourceEncoder) bitmapEncoder);
|
||||
registry.a("BitmapDrawable", ByteBuffer.class, BitmapDrawable.class, new BitmapDrawableDecoder(resources, byteBufferBitmapDecoder));
|
||||
registry.a("BitmapDrawable", InputStream.class, BitmapDrawable.class, new BitmapDrawableDecoder(resources, streamBitmapDecoder));
|
||||
registry.a("BitmapDrawable", ParcelFileDescriptor.class, BitmapDrawable.class, new BitmapDrawableDecoder(resources, b));
|
||||
registry.a(BitmapDrawable.class, (ResourceEncoder) new BitmapDrawableEncoder(bitmapPool, bitmapEncoder));
|
||||
registry.a("Gif", InputStream.class, GifDrawable.class, new StreamGifDecoder(this.e.a(), byteBufferGifDecoder, arrayPool));
|
||||
registry.a("Gif", ByteBuffer.class, GifDrawable.class, byteBufferGifDecoder);
|
||||
registry.a(GifDrawable.class, (ResourceEncoder) new GifDrawableEncoder());
|
||||
registry.a(GifDecoder.class, GifDecoder.class, UnitModelLoader.Factory.b());
|
||||
registry.a("Bitmap", GifDecoder.class, Bitmap.class, new GifFrameResourceDecoder(bitmapPool));
|
||||
registry.a(Uri.class, Drawable.class, resourceDrawableDecoder);
|
||||
registry.a(Uri.class, Bitmap.class, new ResourceBitmapDecoder(resourceDrawableDecoder, bitmapPool));
|
||||
registry.a((DataRewinder.Factory<?>) new ByteBufferRewinder.Factory());
|
||||
registry.a(File.class, ByteBuffer.class, new ByteBufferFileLoader.Factory());
|
||||
registry.a(File.class, InputStream.class, new FileLoader.StreamFactory());
|
||||
registry.a(File.class, File.class, new FileDecoder());
|
||||
registry.a(File.class, ParcelFileDescriptor.class, new FileLoader.FileDescriptorFactory());
|
||||
registry.a(File.class, File.class, UnitModelLoader.Factory.b());
|
||||
registry.a((DataRewinder.Factory<?>) new InputStreamRewinder.Factory(arrayPool));
|
||||
registry.a(Integer.TYPE, InputStream.class, streamFactory);
|
||||
registry.a(Integer.TYPE, ParcelFileDescriptor.class, fileDescriptorFactory);
|
||||
registry.a(Integer.class, InputStream.class, streamFactory);
|
||||
registry.a(Integer.class, ParcelFileDescriptor.class, fileDescriptorFactory);
|
||||
registry.a(Integer.class, Uri.class, uriFactory);
|
||||
registry.a(Integer.TYPE, AssetFileDescriptor.class, assetFileDescriptorFactory);
|
||||
registry.a(Integer.class, AssetFileDescriptor.class, assetFileDescriptorFactory);
|
||||
registry.a(Integer.TYPE, Uri.class, uriFactory);
|
||||
registry.a(String.class, InputStream.class, new DataUrlLoader.StreamFactory());
|
||||
registry.a(Uri.class, InputStream.class, new DataUrlLoader.StreamFactory());
|
||||
registry.a(String.class, InputStream.class, new StringLoader.StreamFactory());
|
||||
registry.a(String.class, ParcelFileDescriptor.class, new StringLoader.FileDescriptorFactory());
|
||||
registry.a(String.class, AssetFileDescriptor.class, new StringLoader.AssetFileDescriptorFactory());
|
||||
registry.a(Uri.class, InputStream.class, new HttpUriLoader.Factory());
|
||||
registry.a(Uri.class, InputStream.class, new AssetUriLoader.StreamFactory(context.getAssets()));
|
||||
registry.a(Uri.class, ParcelFileDescriptor.class, new AssetUriLoader.FileDescriptorFactory(context.getAssets()));
|
||||
registry.a(Uri.class, InputStream.class, new MediaStoreImageThumbLoader.Factory(context));
|
||||
registry.a(Uri.class, InputStream.class, new MediaStoreVideoThumbLoader.Factory(context));
|
||||
registry.a(Uri.class, InputStream.class, new UriLoader.StreamFactory(contentResolver));
|
||||
registry.a(Uri.class, ParcelFileDescriptor.class, new UriLoader.FileDescriptorFactory(contentResolver));
|
||||
registry.a(Uri.class, AssetFileDescriptor.class, new UriLoader.AssetFileDescriptorFactory(contentResolver));
|
||||
registry.a(Uri.class, InputStream.class, new UrlUriLoader.StreamFactory());
|
||||
registry.a(URL.class, InputStream.class, new UrlLoader.StreamFactory());
|
||||
registry.a(Uri.class, File.class, new MediaStoreFileLoader.Factory(context));
|
||||
registry.a(GlideUrl.class, InputStream.class, new HttpGlideUrlLoader.Factory());
|
||||
registry.a(byte[].class, ByteBuffer.class, new ByteArrayLoader.ByteBufferFactory());
|
||||
registry.a(byte[].class, InputStream.class, new ByteArrayLoader.StreamFactory());
|
||||
registry.a(Uri.class, Uri.class, UnitModelLoader.Factory.b());
|
||||
registry.a(Drawable.class, Drawable.class, UnitModelLoader.Factory.b());
|
||||
registry.a(Drawable.class, Drawable.class, new UnitDrawableDecoder());
|
||||
registry.a(Bitmap.class, BitmapDrawable.class, new BitmapDrawableTranscoder(resources));
|
||||
registry.a(Bitmap.class, byte[].class, bitmapBytesTranscoder);
|
||||
registry.a(Drawable.class, byte[].class, new DrawableBytesTranscoder(bitmapPool, bitmapBytesTranscoder, gifDrawableBytesTranscoder));
|
||||
registry.a(GifDrawable.class, byte[].class, gifDrawableBytesTranscoder);
|
||||
this.d = new GlideContext(context, arrayPool, this.e, new ImageViewTargetFactory(), requestOptions, map, engine, i);
|
||||
}
|
||||
|
||||
private static void a(Context context) {
|
||||
if (k) {
|
||||
throw new IllegalStateException("You cannot call Glide.get() in registerComponents(), use the provided Glide instance instead");
|
||||
}
|
||||
k = true;
|
||||
d(context);
|
||||
k = false;
|
||||
}
|
||||
|
||||
public static Glide b(Context context) {
|
||||
if (j == null) {
|
||||
synchronized (Glide.class) {
|
||||
if (j == null) {
|
||||
a(context);
|
||||
}
|
||||
}
|
||||
}
|
||||
return j;
|
||||
}
|
||||
|
||||
private static void d(Context context) {
|
||||
a(context, new GlideBuilder());
|
||||
}
|
||||
|
||||
private static GeneratedAppGlideModule j() {
|
||||
try {
|
||||
return (GeneratedAppGlideModule) Class.forName("com.bumptech.glide.GeneratedAppGlideModuleImpl").getDeclaredConstructor(new Class[0]).newInstance(new Object[0]);
|
||||
} catch (ClassNotFoundException unused) {
|
||||
if (Log.isLoggable("Glide", 5)) {
|
||||
Log.w("Glide", "Failed to find GeneratedAppGlideModule. You should include an annotationProcessor compile dependency on com.github.bumptech.glide:compiler in your application and a @GlideModule annotated AppGlideModule implementation or LibraryGlideModules will be silently ignored");
|
||||
}
|
||||
return null;
|
||||
} catch (IllegalAccessException e) {
|
||||
a(e);
|
||||
throw null;
|
||||
} catch (InstantiationException e2) {
|
||||
a(e2);
|
||||
throw null;
|
||||
} catch (NoSuchMethodException e3) {
|
||||
a(e3);
|
||||
throw null;
|
||||
} catch (InvocationTargetException e4) {
|
||||
a(e4);
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
|
||||
public ArrayPool c() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
ConnectivityMonitorFactory e() {
|
||||
return this.h;
|
||||
}
|
||||
|
||||
public Context f() {
|
||||
return this.d.getBaseContext();
|
||||
}
|
||||
|
||||
GlideContext g() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public Registry h() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
public RequestManagerRetriever i() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
@Override // android.content.ComponentCallbacks
|
||||
public void onConfigurationChanged(Configuration configuration) {
|
||||
}
|
||||
|
||||
@Override // android.content.ComponentCallbacks
|
||||
public void onLowMemory() {
|
||||
b();
|
||||
}
|
||||
|
||||
@Override // android.content.ComponentCallbacks2
|
||||
public void onTrimMemory(int i) {
|
||||
a(i);
|
||||
}
|
||||
|
||||
private static RequestManagerRetriever c(Context context) {
|
||||
Preconditions.a(context, "You cannot start a load on a not yet attached View or a Fragment where getActivity() returns null (which usually occurs when getActivity() is called before the Fragment is attached or after the Fragment is destroyed).");
|
||||
return b(context).i();
|
||||
}
|
||||
|
||||
public static RequestManager e(Context context) {
|
||||
return c(context).a(context);
|
||||
}
|
||||
|
||||
public BitmapPool d() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
private static void a(Context context, GlideBuilder glideBuilder) {
|
||||
Context applicationContext = context.getApplicationContext();
|
||||
GeneratedAppGlideModule j2 = j();
|
||||
List<GlideModule> emptyList = Collections.emptyList();
|
||||
if (j2 == null || j2.isManifestParsingEnabled()) {
|
||||
emptyList = new ManifestParser(applicationContext).a();
|
||||
}
|
||||
if (j2 != null && !j2.a().isEmpty()) {
|
||||
Set<Class<?>> a = j2.a();
|
||||
Iterator<GlideModule> it = emptyList.iterator();
|
||||
while (it.hasNext()) {
|
||||
GlideModule next = it.next();
|
||||
if (a.contains(next.getClass())) {
|
||||
if (Log.isLoggable("Glide", 3)) {
|
||||
Log.d("Glide", "AppGlideModule excludes manifest GlideModule: " + next);
|
||||
}
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Log.isLoggable("Glide", 3)) {
|
||||
Iterator<GlideModule> it2 = emptyList.iterator();
|
||||
while (it2.hasNext()) {
|
||||
Log.d("Glide", "Discovered GlideModule from manifest: " + it2.next().getClass());
|
||||
}
|
||||
}
|
||||
glideBuilder.a(j2 != null ? j2.b() : null);
|
||||
Iterator<GlideModule> it3 = emptyList.iterator();
|
||||
while (it3.hasNext()) {
|
||||
it3.next().applyOptions(applicationContext, glideBuilder);
|
||||
}
|
||||
if (j2 != null) {
|
||||
j2.applyOptions(applicationContext, glideBuilder);
|
||||
}
|
||||
Glide a2 = glideBuilder.a(applicationContext);
|
||||
Iterator<GlideModule> it4 = emptyList.iterator();
|
||||
while (it4.hasNext()) {
|
||||
it4.next().registerComponents(applicationContext, a2, a2.e);
|
||||
}
|
||||
if (j2 != null) {
|
||||
j2.registerComponents(applicationContext, a2, a2.e);
|
||||
}
|
||||
applicationContext.registerComponentCallbacks(a2);
|
||||
j = a2;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
Util.b();
|
||||
this.c.a();
|
||||
this.b.a();
|
||||
this.f.a();
|
||||
}
|
||||
|
||||
void b(RequestManager requestManager) {
|
||||
synchronized (this.i) {
|
||||
if (this.i.contains(requestManager)) {
|
||||
this.i.remove(requestManager);
|
||||
} else {
|
||||
throw new IllegalStateException("Cannot unregister not yet registered manager");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(Exception exc) {
|
||||
throw new IllegalStateException("GeneratedAppGlideModuleImpl is implemented incorrectly. If you've manually implemented this class, remove your implementation. The Annotation processor will generate a correct implementation.", exc);
|
||||
}
|
||||
|
||||
public void a(int i) {
|
||||
Util.b();
|
||||
this.c.a(i);
|
||||
this.b.a(i);
|
||||
this.f.a(i);
|
||||
}
|
||||
|
||||
public void a() {
|
||||
Util.a();
|
||||
this.a.a();
|
||||
}
|
||||
|
||||
public static RequestManager a(Activity activity) {
|
||||
return c(activity).a(activity);
|
||||
}
|
||||
|
||||
public static RequestManager a(FragmentActivity fragmentActivity) {
|
||||
return c(fragmentActivity).a(fragmentActivity);
|
||||
}
|
||||
|
||||
public static RequestManager a(Fragment fragment) {
|
||||
return c(fragment.getActivity()).a(fragment);
|
||||
}
|
||||
|
||||
public static RequestManager a(View view) {
|
||||
return c(view.getContext()).a(view);
|
||||
}
|
||||
|
||||
boolean a(Target<?> target) {
|
||||
synchronized (this.i) {
|
||||
Iterator<RequestManager> it = this.i.iterator();
|
||||
while (it.hasNext()) {
|
||||
if (it.next().b(target)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void a(RequestManager requestManager) {
|
||||
synchronized (this.i) {
|
||||
if (!this.i.contains(requestManager)) {
|
||||
this.i.add(requestManager);
|
||||
} else {
|
||||
throw new IllegalStateException("Cannot register already registered manager");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
97
sources/com/bumptech/glide/GlideBuilder.java
Normal file
97
sources/com/bumptech/glide/GlideBuilder.java
Normal file
@@ -0,0 +1,97 @@
|
||||
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);
|
||||
}
|
||||
}
|
73
sources/com/bumptech/glide/GlideContext.java
Normal file
73
sources/com/bumptech/glide/GlideContext.java
Normal file
@@ -0,0 +1,73 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.widget.ImageView;
|
||||
import com.bumptech.glide.load.engine.Engine;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.ImageViewTargetFactory;
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GlideContext extends ContextWrapper {
|
||||
static final TransitionOptions<?, ?> h = new GenericTransitionOptions();
|
||||
private final ArrayPool a;
|
||||
private final Registry b;
|
||||
private final ImageViewTargetFactory c;
|
||||
private final RequestOptions d;
|
||||
private final Map<Class<?>, TransitionOptions<?, ?>> e;
|
||||
private final Engine f;
|
||||
private final int g;
|
||||
|
||||
public GlideContext(Context context, ArrayPool arrayPool, Registry registry, ImageViewTargetFactory imageViewTargetFactory, RequestOptions requestOptions, Map<Class<?>, TransitionOptions<?, ?>> map, Engine engine, int i) {
|
||||
super(context.getApplicationContext());
|
||||
this.a = arrayPool;
|
||||
this.b = registry;
|
||||
this.c = imageViewTargetFactory;
|
||||
this.d = requestOptions;
|
||||
this.e = map;
|
||||
this.f = engine;
|
||||
this.g = i;
|
||||
new Handler(Looper.getMainLooper());
|
||||
}
|
||||
|
||||
public <T> TransitionOptions<?, T> a(Class<T> cls) {
|
||||
TransitionOptions<?, T> transitionOptions = (TransitionOptions) this.e.get(cls);
|
||||
if (transitionOptions == null) {
|
||||
for (Map.Entry<Class<?>, TransitionOptions<?, ?>> entry : this.e.entrySet()) {
|
||||
if (entry.getKey().isAssignableFrom(cls)) {
|
||||
transitionOptions = (TransitionOptions) entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return transitionOptions == null ? (TransitionOptions<?, T>) h : transitionOptions;
|
||||
}
|
||||
|
||||
public RequestOptions b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public Engine c() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public Registry e() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public <X> ViewTarget<ImageView, X> a(ImageView imageView, Class<X> cls) {
|
||||
return this.c.a(imageView, cls);
|
||||
}
|
||||
|
||||
public ArrayPool a() {
|
||||
return this.a;
|
||||
}
|
||||
}
|
18
sources/com/bumptech/glide/MemoryCategory.java
Normal file
18
sources/com/bumptech/glide/MemoryCategory.java
Normal file
@@ -0,0 +1,18 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum MemoryCategory {
|
||||
LOW(0.5f),
|
||||
NORMAL(1.0f),
|
||||
HIGH(1.5f);
|
||||
|
||||
private final float multiplier;
|
||||
|
||||
MemoryCategory(float f) {
|
||||
this.multiplier = f;
|
||||
}
|
||||
|
||||
public float getMultiplier() {
|
||||
return this.multiplier;
|
||||
}
|
||||
}
|
5
sources/com/bumptech/glide/ModelTypes.java
Normal file
5
sources/com/bumptech/glide/ModelTypes.java
Normal file
@@ -0,0 +1,5 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface ModelTypes<T> {
|
||||
}
|
9
sources/com/bumptech/glide/Priority.java
Normal file
9
sources/com/bumptech/glide/Priority.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum Priority {
|
||||
IMMEDIATE,
|
||||
HIGH,
|
||||
NORMAL,
|
||||
LOW
|
||||
}
|
214
sources/com/bumptech/glide/Registry.java
Normal file
214
sources/com/bumptech/glide/Registry.java
Normal file
@@ -0,0 +1,214 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.load.Encoder;
|
||||
import com.bumptech.glide.load.ImageHeaderParser;
|
||||
import com.bumptech.glide.load.ResourceDecoder;
|
||||
import com.bumptech.glide.load.ResourceEncoder;
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.data.DataRewinderRegistry;
|
||||
import com.bumptech.glide.load.engine.DecodePath;
|
||||
import com.bumptech.glide.load.engine.LoadPath;
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import com.bumptech.glide.load.model.ModelLoaderFactory;
|
||||
import com.bumptech.glide.load.model.ModelLoaderRegistry;
|
||||
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
|
||||
import com.bumptech.glide.load.resource.transcode.TranscoderRegistry;
|
||||
import com.bumptech.glide.provider.EncoderRegistry;
|
||||
import com.bumptech.glide.provider.ImageHeaderParserRegistry;
|
||||
import com.bumptech.glide.provider.LoadPathCache;
|
||||
import com.bumptech.glide.provider.ModelToResourceClassCache;
|
||||
import com.bumptech.glide.provider.ResourceDecoderRegistry;
|
||||
import com.bumptech.glide.provider.ResourceEncoderRegistry;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Registry {
|
||||
private final ModelToResourceClassCache h = new ModelToResourceClassCache();
|
||||
private final LoadPathCache i = new LoadPathCache();
|
||||
private final Pools$Pool<List<Throwable>> j = FactoryPools.b();
|
||||
private final ModelLoaderRegistry a = new ModelLoaderRegistry(this.j);
|
||||
private final EncoderRegistry b = new EncoderRegistry();
|
||||
private final ResourceDecoderRegistry c = new ResourceDecoderRegistry();
|
||||
private final ResourceEncoderRegistry d = new ResourceEncoderRegistry();
|
||||
private final DataRewinderRegistry e = new DataRewinderRegistry();
|
||||
private final TranscoderRegistry f = new TranscoderRegistry();
|
||||
private final ImageHeaderParserRegistry g = new ImageHeaderParserRegistry();
|
||||
|
||||
public static class MissingComponentException extends RuntimeException {
|
||||
public MissingComponentException(String str) {
|
||||
super(str);
|
||||
}
|
||||
}
|
||||
|
||||
public static final class NoImageHeaderParserException extends MissingComponentException {
|
||||
public NoImageHeaderParserException() {
|
||||
super("Failed to find image header parser.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class NoModelLoaderAvailableException extends MissingComponentException {
|
||||
public NoModelLoaderAvailableException(Object obj) {
|
||||
super("Failed to find any ModelLoaders for model: " + obj);
|
||||
}
|
||||
|
||||
public NoModelLoaderAvailableException(Class<?> cls, Class<?> cls2) {
|
||||
super("Failed to find any ModelLoaders for model: " + cls + " and data: " + cls2);
|
||||
}
|
||||
}
|
||||
|
||||
public static class NoResultEncoderAvailableException extends MissingComponentException {
|
||||
public NoResultEncoderAvailableException(Class<?> cls) {
|
||||
super("Failed to find result encoder for resource class: " + cls + ", you may need to consider registering a new Encoder for the requested type or DiskCacheStrategy.DATA/DiskCacheStrategy.NONE if caching your transformed resource is unnecessary.");
|
||||
}
|
||||
}
|
||||
|
||||
public static class NoSourceEncoderAvailableException extends MissingComponentException {
|
||||
public NoSourceEncoderAvailableException(Class<?> cls) {
|
||||
super("Failed to find source encoder for data class: " + cls);
|
||||
}
|
||||
}
|
||||
|
||||
public Registry() {
|
||||
a(Arrays.asList("Gif", "Bitmap", "BitmapDrawable"));
|
||||
}
|
||||
|
||||
private <Data, TResource, Transcode> List<DecodePath<Data, TResource, Transcode>> c(Class<Data> cls, Class<TResource> cls2, Class<Transcode> cls3) {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
for (Class cls4 : this.c.b(cls, cls2)) {
|
||||
for (Class cls5 : this.f.b(cls4, cls3)) {
|
||||
arrayList.add(new DecodePath(cls, cls4, cls5, this.c.a(cls, cls4), this.f.a(cls4, cls5), this.j));
|
||||
}
|
||||
}
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public <Data> Registry a(Class<Data> cls, Encoder<Data> encoder) {
|
||||
this.b.a(cls, encoder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Model, Data> Registry b(Class<Model> cls, Class<Data> cls2, ModelLoaderFactory<? extends Model, ? extends Data> modelLoaderFactory) {
|
||||
this.a.b(cls, cls2, modelLoaderFactory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Data, TResource> Registry a(Class<Data> cls, Class<TResource> cls2, ResourceDecoder<Data, TResource> resourceDecoder) {
|
||||
a("legacy_append", cls, cls2, resourceDecoder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Model, TResource, Transcode> List<Class<?>> b(Class<Model> cls, Class<TResource> cls2, Class<Transcode> cls3) {
|
||||
List<Class<?>> a = this.h.a(cls, cls2);
|
||||
if (a == null) {
|
||||
a = new ArrayList<>();
|
||||
Iterator<Class<?>> it = this.a.a((Class<?>) cls).iterator();
|
||||
while (it.hasNext()) {
|
||||
for (Class<?> cls4 : this.c.b(it.next(), cls2)) {
|
||||
if (!this.f.b(cls4, cls3).isEmpty() && !a.contains(cls4)) {
|
||||
a.add(cls4);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.h.a(cls, cls2, Collections.unmodifiableList(a));
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public <Data, TResource> Registry a(String str, Class<Data> cls, Class<TResource> cls2, ResourceDecoder<Data, TResource> resourceDecoder) {
|
||||
this.c.a(str, resourceDecoder, cls, cls2);
|
||||
return this;
|
||||
}
|
||||
|
||||
public final Registry a(List<String> list) {
|
||||
ArrayList arrayList = new ArrayList(list);
|
||||
arrayList.add(0, "legacy_prepend_all");
|
||||
arrayList.add("legacy_append");
|
||||
this.c.a(arrayList);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <TResource> Registry a(Class<TResource> cls, ResourceEncoder<TResource> resourceEncoder) {
|
||||
this.d.a(cls, resourceEncoder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Registry a(DataRewinder.Factory<?> factory) {
|
||||
this.e.a(factory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <TResource, Transcode> Registry a(Class<TResource> cls, Class<Transcode> cls2, ResourceTranscoder<TResource, Transcode> resourceTranscoder) {
|
||||
this.f.a(cls, cls2, resourceTranscoder);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Registry a(ImageHeaderParser imageHeaderParser) {
|
||||
this.g.a(imageHeaderParser);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Model, Data> Registry a(Class<Model> cls, Class<Data> cls2, ModelLoaderFactory<Model, Data> modelLoaderFactory) {
|
||||
this.a.a(cls, cls2, modelLoaderFactory);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Data, TResource, Transcode> LoadPath<Data, TResource, Transcode> a(Class<Data> cls, Class<TResource> cls2, Class<Transcode> cls3) {
|
||||
LoadPath<Data, TResource, Transcode> a = this.i.a(cls, cls2, cls3);
|
||||
if (this.i.a(a)) {
|
||||
return null;
|
||||
}
|
||||
if (a == null) {
|
||||
List<DecodePath<Data, TResource, Transcode>> c = c(cls, cls2, cls3);
|
||||
a = c.isEmpty() ? null : new LoadPath<>(cls, cls2, cls3, c, this.j);
|
||||
this.i.a(cls, cls2, cls3, a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public <X> Encoder<X> c(X x) throws NoSourceEncoderAvailableException {
|
||||
Encoder<X> a = this.b.a(x.getClass());
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
throw new NoSourceEncoderAvailableException(x.getClass());
|
||||
}
|
||||
|
||||
public boolean b(Resource<?> resource) {
|
||||
return this.d.a(resource.b()) != null;
|
||||
}
|
||||
|
||||
public <X> DataRewinder<X> b(X x) {
|
||||
return this.e.a((DataRewinderRegistry) x);
|
||||
}
|
||||
|
||||
public <X> ResourceEncoder<X> a(Resource<X> resource) throws NoResultEncoderAvailableException {
|
||||
ResourceEncoder<X> a = this.d.a(resource.b());
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
throw new NoResultEncoderAvailableException(resource.b());
|
||||
}
|
||||
|
||||
public <Model> List<ModelLoader<Model, ?>> a(Model model) {
|
||||
List<ModelLoader<Model, ?>> a = this.a.a((ModelLoaderRegistry) model);
|
||||
if (a.isEmpty()) {
|
||||
throw new NoModelLoaderAvailableException(model);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public List<ImageHeaderParser> a() {
|
||||
List<ImageHeaderParser> a = this.g.a();
|
||||
if (a.isEmpty()) {
|
||||
throw new NoImageHeaderParserException();
|
||||
}
|
||||
return a;
|
||||
}
|
||||
}
|
326
sources/com/bumptech/glide/RequestBuilder.java
Normal file
326
sources/com/bumptech/glide/RequestBuilder.java
Normal file
@@ -0,0 +1,326 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.request.ErrorRequestCoordinator;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.bumptech.glide.request.RequestCoordinator;
|
||||
import com.bumptech.glide.request.RequestListener;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.SingleRequest;
|
||||
import com.bumptech.glide.request.ThumbnailRequestCoordinator;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.request.target.ViewTarget;
|
||||
import com.bumptech.glide.signature.ApplicationVersionSignature;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RequestBuilder<TranscodeType> implements Cloneable, ModelTypes<RequestBuilder<TranscodeType>> {
|
||||
private final Context a;
|
||||
private final RequestManager b;
|
||||
private final Class<TranscodeType> c;
|
||||
private final RequestOptions d;
|
||||
private final GlideContext e;
|
||||
protected RequestOptions f;
|
||||
private TransitionOptions<?, ? super TranscodeType> g;
|
||||
private Object h;
|
||||
private RequestListener<TranscodeType> i;
|
||||
private RequestBuilder<TranscodeType> j;
|
||||
private RequestBuilder<TranscodeType> k;
|
||||
private Float l;
|
||||
private boolean m = true;
|
||||
private boolean n;
|
||||
private boolean o;
|
||||
|
||||
/* renamed from: com.bumptech.glide.RequestBuilder$2, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass2 {
|
||||
static final /* synthetic */ int[] a;
|
||||
static final /* synthetic */ int[] b = new int[Priority.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
b[Priority.LOW.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
b[Priority.NORMAL.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
b[Priority.HIGH.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
b[Priority.IMMEDIATE.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
a = new int[ImageView.ScaleType.values().length];
|
||||
try {
|
||||
a[ImageView.ScaleType.CENTER_CROP.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.CENTER_INSIDE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_CENTER.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_START.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused8) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_END.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused9) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.FIT_XY.ordinal()] = 6;
|
||||
} catch (NoSuchFieldError unused10) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.CENTER.ordinal()] = 7;
|
||||
} catch (NoSuchFieldError unused11) {
|
||||
}
|
||||
try {
|
||||
a[ImageView.ScaleType.MATRIX.ordinal()] = 8;
|
||||
} catch (NoSuchFieldError unused12) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
new RequestOptions().a(DiskCacheStrategy.c).a(Priority.LOW).a(true);
|
||||
}
|
||||
|
||||
protected RequestBuilder(Glide glide, RequestManager requestManager, Class<TranscodeType> cls, Context context) {
|
||||
this.b = requestManager;
|
||||
this.c = cls;
|
||||
this.d = requestManager.f();
|
||||
this.a = context;
|
||||
this.g = requestManager.b(cls);
|
||||
this.f = this.d;
|
||||
this.e = glide.g();
|
||||
}
|
||||
|
||||
private RequestBuilder<TranscodeType> b(Object obj) {
|
||||
this.h = obj;
|
||||
this.n = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(RequestOptions requestOptions) {
|
||||
Preconditions.a(requestOptions);
|
||||
this.f = a().a(requestOptions);
|
||||
return this;
|
||||
}
|
||||
|
||||
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
||||
public RequestBuilder<TranscodeType> m4clone() {
|
||||
try {
|
||||
RequestBuilder<TranscodeType> requestBuilder = (RequestBuilder) super.clone();
|
||||
requestBuilder.f = requestBuilder.f.m6clone();
|
||||
requestBuilder.g = (TransitionOptions<?, ? super TranscodeType>) requestBuilder.g.m5clone();
|
||||
return requestBuilder;
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private <Y extends Target<TranscodeType>> Y b(Y y, RequestListener<TranscodeType> requestListener, RequestOptions requestOptions) {
|
||||
Util.b();
|
||||
Preconditions.a(y);
|
||||
if (this.n) {
|
||||
requestOptions.a();
|
||||
Request a = a(y, requestListener, requestOptions);
|
||||
Request c = y.c();
|
||||
if (a.a(c) && !a(requestOptions, c)) {
|
||||
a.a();
|
||||
Preconditions.a(c);
|
||||
if (!c.isRunning()) {
|
||||
c.e();
|
||||
}
|
||||
return y;
|
||||
}
|
||||
this.b.a((Target<?>) y);
|
||||
y.a(a);
|
||||
this.b.a(y, a);
|
||||
return y;
|
||||
}
|
||||
throw new IllegalArgumentException("You must call #load() before calling #into()");
|
||||
}
|
||||
|
||||
protected RequestOptions a() {
|
||||
RequestOptions requestOptions = this.d;
|
||||
RequestOptions requestOptions2 = this.f;
|
||||
return requestOptions == requestOptions2 ? requestOptions2.m6clone() : requestOptions2;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(RequestListener<TranscodeType> requestListener) {
|
||||
this.i = requestListener;
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(float f) {
|
||||
if (f >= 0.0f && f <= 1.0f) {
|
||||
this.l = Float.valueOf(f);
|
||||
return this;
|
||||
}
|
||||
throw new IllegalArgumentException("sizeMultiplier must be between 0 and 1");
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(Object obj) {
|
||||
b(obj);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(Drawable drawable) {
|
||||
b(drawable);
|
||||
a(RequestOptions.b(DiskCacheStrategy.b));
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(String str) {
|
||||
b(str);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(File file) {
|
||||
b(file);
|
||||
return this;
|
||||
}
|
||||
|
||||
public RequestBuilder<TranscodeType> a(Integer num) {
|
||||
b(num);
|
||||
a(RequestOptions.b(ApplicationVersionSignature.b(this.a)));
|
||||
return this;
|
||||
}
|
||||
|
||||
public <Y extends Target<TranscodeType>> Y a(Y y) {
|
||||
a((RequestBuilder<TranscodeType>) y, (RequestListener) null);
|
||||
return y;
|
||||
}
|
||||
|
||||
<Y extends Target<TranscodeType>> Y a(Y y, RequestListener<TranscodeType> requestListener) {
|
||||
b(y, requestListener, a());
|
||||
return y;
|
||||
}
|
||||
|
||||
private boolean a(RequestOptions requestOptions, Request request) {
|
||||
return !requestOptions.C() && request.g();
|
||||
}
|
||||
|
||||
public ViewTarget<ImageView, TranscodeType> a(ImageView imageView) {
|
||||
Util.b();
|
||||
Preconditions.a(imageView);
|
||||
RequestOptions requestOptions = this.f;
|
||||
if (!requestOptions.H() && requestOptions.F() && imageView.getScaleType() != null) {
|
||||
switch (AnonymousClass2.a[imageView.getScaleType().ordinal()]) {
|
||||
case 1:
|
||||
requestOptions = requestOptions.m6clone().K();
|
||||
break;
|
||||
case 2:
|
||||
requestOptions = requestOptions.m6clone().L();
|
||||
break;
|
||||
case 3:
|
||||
case 4:
|
||||
case 5:
|
||||
requestOptions = requestOptions.m6clone().M();
|
||||
break;
|
||||
case 6:
|
||||
requestOptions = requestOptions.m6clone().L();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ViewTarget<ImageView, TranscodeType> a = this.e.a(imageView, this.c);
|
||||
b(a, null, requestOptions);
|
||||
return a;
|
||||
}
|
||||
|
||||
private Request b(Target<TranscodeType> target, RequestListener<TranscodeType> requestListener, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int i, int i2, RequestOptions requestOptions) {
|
||||
RequestBuilder<TranscodeType> requestBuilder = this.j;
|
||||
if (requestBuilder != null) {
|
||||
if (!this.o) {
|
||||
TransitionOptions<?, ? super TranscodeType> transitionOptions2 = requestBuilder.m ? transitionOptions : requestBuilder.g;
|
||||
Priority u = this.j.f.D() ? this.j.f.u() : a(priority);
|
||||
int r = this.j.f.r();
|
||||
int q = this.j.f.q();
|
||||
if (Util.b(i, i2) && !this.j.f.I()) {
|
||||
r = requestOptions.r();
|
||||
q = requestOptions.q();
|
||||
}
|
||||
ThumbnailRequestCoordinator thumbnailRequestCoordinator = new ThumbnailRequestCoordinator(requestCoordinator);
|
||||
Request a = a(target, requestListener, requestOptions, thumbnailRequestCoordinator, transitionOptions, priority, i, i2);
|
||||
this.o = true;
|
||||
RequestBuilder<TranscodeType> requestBuilder2 = this.j;
|
||||
Request a2 = requestBuilder2.a(target, requestListener, thumbnailRequestCoordinator, transitionOptions2, u, r, q, requestBuilder2.f);
|
||||
this.o = false;
|
||||
thumbnailRequestCoordinator.a(a, a2);
|
||||
return thumbnailRequestCoordinator;
|
||||
}
|
||||
throw new IllegalStateException("You cannot use a request as both the main request and a thumbnail, consider using clone() on the request(s) passed to thumbnail()");
|
||||
}
|
||||
if (this.l != null) {
|
||||
ThumbnailRequestCoordinator thumbnailRequestCoordinator2 = new ThumbnailRequestCoordinator(requestCoordinator);
|
||||
thumbnailRequestCoordinator2.a(a(target, requestListener, requestOptions, thumbnailRequestCoordinator2, transitionOptions, priority, i, i2), a(target, requestListener, requestOptions.m6clone().a(this.l.floatValue()), thumbnailRequestCoordinator2, transitionOptions, a(priority), i, i2));
|
||||
return thumbnailRequestCoordinator2;
|
||||
}
|
||||
return a(target, requestListener, requestOptions, requestCoordinator, transitionOptions, priority, i, i2);
|
||||
}
|
||||
|
||||
private Priority a(Priority priority) {
|
||||
int i = AnonymousClass2.b[priority.ordinal()];
|
||||
if (i == 1) {
|
||||
return Priority.NORMAL;
|
||||
}
|
||||
if (i == 2) {
|
||||
return Priority.HIGH;
|
||||
}
|
||||
if (i != 3 && i != 4) {
|
||||
throw new IllegalArgumentException("unknown priority: " + this.f.u());
|
||||
}
|
||||
return Priority.IMMEDIATE;
|
||||
}
|
||||
|
||||
private Request a(Target<TranscodeType> target, RequestListener<TranscodeType> requestListener, RequestOptions requestOptions) {
|
||||
return a(target, requestListener, (RequestCoordinator) null, this.g, requestOptions.u(), requestOptions.r(), requestOptions.q(), requestOptions);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private Request a(Target<TranscodeType> target, RequestListener<TranscodeType> requestListener, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int i, int i2, RequestOptions requestOptions) {
|
||||
RequestCoordinator requestCoordinator2;
|
||||
RequestCoordinator requestCoordinator3;
|
||||
if (this.k != null) {
|
||||
requestCoordinator3 = new ErrorRequestCoordinator(requestCoordinator);
|
||||
requestCoordinator2 = requestCoordinator3;
|
||||
} else {
|
||||
requestCoordinator2 = null;
|
||||
requestCoordinator3 = requestCoordinator;
|
||||
}
|
||||
Request b = b(target, requestListener, requestCoordinator3, transitionOptions, priority, i, i2, requestOptions);
|
||||
if (requestCoordinator2 == null) {
|
||||
return b;
|
||||
}
|
||||
int r = this.k.f.r();
|
||||
int q = this.k.f.q();
|
||||
if (Util.b(i, i2) && !this.k.f.I()) {
|
||||
r = requestOptions.r();
|
||||
q = requestOptions.q();
|
||||
}
|
||||
RequestBuilder<TranscodeType> requestBuilder = this.k;
|
||||
ErrorRequestCoordinator errorRequestCoordinator = requestCoordinator2;
|
||||
errorRequestCoordinator.a(b, requestBuilder.a(target, requestListener, requestCoordinator2, requestBuilder.g, requestBuilder.f.u(), r, q, this.k.f));
|
||||
return errorRequestCoordinator;
|
||||
}
|
||||
|
||||
private Request a(Target<TranscodeType> target, RequestListener<TranscodeType> requestListener, RequestOptions requestOptions, RequestCoordinator requestCoordinator, TransitionOptions<?, ? super TranscodeType> transitionOptions, Priority priority, int i, int i2) {
|
||||
Context context = this.a;
|
||||
GlideContext glideContext = this.e;
|
||||
return SingleRequest.b(context, glideContext, this.h, this.c, requestOptions, i, i2, priority, target, requestListener, this.i, requestCoordinator, glideContext.c(), transitionOptions.a());
|
||||
}
|
||||
}
|
232
sources/com/bumptech/glide/RequestManager.java
Normal file
232
sources/com/bumptech/glide/RequestManager.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import com.bumptech.glide.load.engine.DiskCacheStrategy;
|
||||
import com.bumptech.glide.load.resource.gif.GifDrawable;
|
||||
import com.bumptech.glide.manager.ConnectivityMonitor;
|
||||
import com.bumptech.glide.manager.ConnectivityMonitorFactory;
|
||||
import com.bumptech.glide.manager.Lifecycle;
|
||||
import com.bumptech.glide.manager.LifecycleListener;
|
||||
import com.bumptech.glide.manager.RequestManagerTreeNode;
|
||||
import com.bumptech.glide.manager.RequestTracker;
|
||||
import com.bumptech.glide.manager.TargetTracker;
|
||||
import com.bumptech.glide.request.Request;
|
||||
import com.bumptech.glide.request.RequestOptions;
|
||||
import com.bumptech.glide.request.target.Target;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.io.File;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class RequestManager implements LifecycleListener, ModelTypes<RequestBuilder<Drawable>> {
|
||||
private static final RequestOptions k;
|
||||
protected final Glide a;
|
||||
protected final Context b;
|
||||
final Lifecycle c;
|
||||
private final RequestTracker d;
|
||||
private final RequestManagerTreeNode e;
|
||||
private final TargetTracker f;
|
||||
private final Runnable g;
|
||||
private final Handler h;
|
||||
private final ConnectivityMonitor i;
|
||||
private RequestOptions j;
|
||||
|
||||
private static class RequestManagerConnectivityListener implements ConnectivityMonitor.ConnectivityListener {
|
||||
private final RequestTracker a;
|
||||
|
||||
RequestManagerConnectivityListener(RequestTracker requestTracker) {
|
||||
this.a = requestTracker;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.manager.ConnectivityMonitor.ConnectivityListener
|
||||
public void a(boolean z) {
|
||||
if (z) {
|
||||
this.a.c();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
RequestOptions b = RequestOptions.b((Class<?>) Bitmap.class);
|
||||
b.J();
|
||||
k = b;
|
||||
RequestOptions.b((Class<?>) GifDrawable.class).J();
|
||||
RequestOptions.b(DiskCacheStrategy.c).a(Priority.LOW).a(true);
|
||||
}
|
||||
|
||||
public RequestManager(Glide glide, Lifecycle lifecycle, RequestManagerTreeNode requestManagerTreeNode, Context context) {
|
||||
this(glide, lifecycle, requestManagerTreeNode, new RequestTracker(), glide.e(), context);
|
||||
}
|
||||
|
||||
private void c(Target<?> target) {
|
||||
if (b(target) || this.a.a(target) || target.c() == null) {
|
||||
return;
|
||||
}
|
||||
Request c = target.c();
|
||||
target.a((Request) null);
|
||||
c.clear();
|
||||
}
|
||||
|
||||
protected void a(RequestOptions requestOptions) {
|
||||
RequestOptions m6clone = requestOptions.m6clone();
|
||||
m6clone.a();
|
||||
this.j = m6clone;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.manager.LifecycleListener
|
||||
public void b() {
|
||||
g();
|
||||
this.f.b();
|
||||
}
|
||||
|
||||
public RequestBuilder<Bitmap> d() {
|
||||
RequestBuilder<Bitmap> a = a(Bitmap.class);
|
||||
a.a(k);
|
||||
return a;
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> e() {
|
||||
return a(Drawable.class);
|
||||
}
|
||||
|
||||
RequestOptions f() {
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public void g() {
|
||||
Util.b();
|
||||
this.d.b();
|
||||
}
|
||||
|
||||
public void h() {
|
||||
Util.b();
|
||||
this.d.d();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.manager.LifecycleListener
|
||||
public void onStart() {
|
||||
h();
|
||||
this.f.onStart();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return super.toString() + "{tracker=" + this.d + ", treeNode=" + this.e + "}";
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.manager.LifecycleListener
|
||||
public void a() {
|
||||
this.f.a();
|
||||
Iterator<Target<?>> it = this.f.e().iterator();
|
||||
while (it.hasNext()) {
|
||||
a(it.next());
|
||||
}
|
||||
this.f.d();
|
||||
this.d.a();
|
||||
this.c.b(this);
|
||||
this.c.b(this.i);
|
||||
this.h.removeCallbacks(this.g);
|
||||
this.a.b(this);
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> d(Drawable drawable) {
|
||||
RequestBuilder<Drawable> e = e();
|
||||
e.a(drawable);
|
||||
return e;
|
||||
}
|
||||
|
||||
boolean b(Target<?> target) {
|
||||
Request c = target.c();
|
||||
if (c == null) {
|
||||
return true;
|
||||
}
|
||||
if (!this.d.a(c)) {
|
||||
return false;
|
||||
}
|
||||
this.f.b(target);
|
||||
target.a((Request) null);
|
||||
return true;
|
||||
}
|
||||
|
||||
RequestManager(Glide glide, Lifecycle lifecycle, RequestManagerTreeNode requestManagerTreeNode, RequestTracker requestTracker, ConnectivityMonitorFactory connectivityMonitorFactory, Context context) {
|
||||
this.f = new TargetTracker();
|
||||
this.g = new Runnable() { // from class: com.bumptech.glide.RequestManager.1
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
RequestManager requestManager = RequestManager.this;
|
||||
requestManager.c.a(requestManager);
|
||||
}
|
||||
};
|
||||
this.h = new Handler(Looper.getMainLooper());
|
||||
this.a = glide;
|
||||
this.c = lifecycle;
|
||||
this.e = requestManagerTreeNode;
|
||||
this.d = requestTracker;
|
||||
this.b = context;
|
||||
this.i = connectivityMonitorFactory.a(context.getApplicationContext(), new RequestManagerConnectivityListener(requestTracker));
|
||||
if (Util.c()) {
|
||||
this.h.post(this.g);
|
||||
} else {
|
||||
lifecycle.a(this);
|
||||
}
|
||||
lifecycle.a(this.i);
|
||||
a(glide.g().b());
|
||||
glide.a(this);
|
||||
}
|
||||
|
||||
<T> TransitionOptions<?, T> b(Class<T> cls) {
|
||||
return this.a.g().a(cls);
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> a(String str) {
|
||||
RequestBuilder<Drawable> e = e();
|
||||
e.a(str);
|
||||
return e;
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> a(File file) {
|
||||
RequestBuilder<Drawable> e = e();
|
||||
e.a(file);
|
||||
return e;
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> a(Integer num) {
|
||||
RequestBuilder<Drawable> e = e();
|
||||
e.a(num);
|
||||
return e;
|
||||
}
|
||||
|
||||
public RequestBuilder<Drawable> a(Object obj) {
|
||||
RequestBuilder<Drawable> e = e();
|
||||
e.a(obj);
|
||||
return e;
|
||||
}
|
||||
|
||||
public <ResourceType> RequestBuilder<ResourceType> a(Class<ResourceType> cls) {
|
||||
return new RequestBuilder<>(this.a, this, cls, this.b);
|
||||
}
|
||||
|
||||
public void a(final Target<?> target) {
|
||||
if (target == null) {
|
||||
return;
|
||||
}
|
||||
if (Util.d()) {
|
||||
c(target);
|
||||
} else {
|
||||
this.h.post(new Runnable() { // from class: com.bumptech.glide.RequestManager.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
RequestManager.this.a(target);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void a(Target<?> target, Request request) {
|
||||
this.f.a(target);
|
||||
this.d.b(request);
|
||||
}
|
||||
}
|
23
sources/com/bumptech/glide/TransitionOptions.java
Normal file
23
sources/com/bumptech/glide/TransitionOptions.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package com.bumptech.glide;
|
||||
|
||||
import com.bumptech.glide.TransitionOptions;
|
||||
import com.bumptech.glide.request.transition.NoTransition;
|
||||
import com.bumptech.glide.request.transition.TransitionFactory;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class TransitionOptions<CHILD extends TransitionOptions<CHILD, TranscodeType>, TranscodeType> implements Cloneable {
|
||||
private TransitionFactory<? super TranscodeType> a = NoTransition.a();
|
||||
|
||||
final TransitionFactory<? super TranscodeType> a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
/* renamed from: clone, reason: merged with bridge method [inline-methods] */
|
||||
public final CHILD m5clone() {
|
||||
try {
|
||||
return (CHILD) super.clone();
|
||||
} catch (CloneNotSupportedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
560
sources/com/bumptech/glide/disklrucache/DiskLruCache.java
Normal file
560
sources/com/bumptech/glide/disklrucache/DiskLruCache.java
Normal file
@@ -0,0 +1,560 @@
|
||||
package com.bumptech.glide.disklrucache;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.Closeable;
|
||||
import java.io.EOFException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class DiskLruCache implements Closeable {
|
||||
private final File a;
|
||||
private final File b;
|
||||
private final File c;
|
||||
private final File d;
|
||||
private final int e;
|
||||
private long f;
|
||||
private final int g;
|
||||
private Writer i;
|
||||
private int k;
|
||||
private long h = 0;
|
||||
private final LinkedHashMap<String, Entry> j = new LinkedHashMap<>(0, 0.75f, true);
|
||||
private long l = 0;
|
||||
final ThreadPoolExecutor m = new ThreadPoolExecutor(0, 1, 60, TimeUnit.SECONDS, new LinkedBlockingQueue(), new DiskLruCacheThreadFactory());
|
||||
private final Callable<Void> n = new Callable<Void>() { // from class: com.bumptech.glide.disklrucache.DiskLruCache.1
|
||||
@Override // java.util.concurrent.Callable
|
||||
public Void call() throws Exception {
|
||||
synchronized (DiskLruCache.this) {
|
||||
if (DiskLruCache.this.i == null) {
|
||||
return null;
|
||||
}
|
||||
DiskLruCache.this.g();
|
||||
if (DiskLruCache.this.c()) {
|
||||
DiskLruCache.this.f();
|
||||
DiskLruCache.this.k = 0;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
private static final class DiskLruCacheThreadFactory implements ThreadFactory {
|
||||
private DiskLruCacheThreadFactory() {
|
||||
}
|
||||
|
||||
@Override // java.util.concurrent.ThreadFactory
|
||||
public synchronized Thread newThread(Runnable runnable) {
|
||||
Thread thread;
|
||||
thread = new Thread(runnable, "glide-disk-lru-cache-thread");
|
||||
thread.setPriority(1);
|
||||
return thread;
|
||||
}
|
||||
}
|
||||
|
||||
public final class Editor {
|
||||
private final Entry a;
|
||||
private final boolean[] b;
|
||||
private boolean c;
|
||||
|
||||
public void c() throws IOException {
|
||||
DiskLruCache.this.a(this, true);
|
||||
this.c = true;
|
||||
}
|
||||
|
||||
private Editor(Entry entry) {
|
||||
this.a = entry;
|
||||
this.b = entry.e ? null : new boolean[DiskLruCache.this.g];
|
||||
}
|
||||
|
||||
public File a(int i) throws IOException {
|
||||
File b;
|
||||
synchronized (DiskLruCache.this) {
|
||||
if (this.a.f != this) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (!this.a.e) {
|
||||
this.b[i] = true;
|
||||
}
|
||||
b = this.a.b(i);
|
||||
if (!DiskLruCache.this.a.exists()) {
|
||||
DiskLruCache.this.a.mkdirs();
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
public void b() {
|
||||
if (this.c) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
a();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
|
||||
public void a() throws IOException {
|
||||
DiskLruCache.this.a(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
private final class Entry {
|
||||
private final String a;
|
||||
private final long[] b;
|
||||
File[] c;
|
||||
File[] d;
|
||||
private boolean e;
|
||||
private Editor f;
|
||||
private long g;
|
||||
|
||||
private Entry(String str) {
|
||||
this.a = str;
|
||||
this.b = new long[DiskLruCache.this.g];
|
||||
this.c = new File[DiskLruCache.this.g];
|
||||
this.d = new File[DiskLruCache.this.g];
|
||||
StringBuilder sb = new StringBuilder(str);
|
||||
sb.append('.');
|
||||
int length = sb.length();
|
||||
for (int i = 0; i < DiskLruCache.this.g; i++) {
|
||||
sb.append(i);
|
||||
this.c[i] = new File(DiskLruCache.this.a, sb.toString());
|
||||
sb.append(".tmp");
|
||||
this.d[i] = new File(DiskLruCache.this.a, sb.toString());
|
||||
sb.setLength(length);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void b(String[] strArr) throws IOException {
|
||||
if (strArr.length != DiskLruCache.this.g) {
|
||||
a(strArr);
|
||||
throw null;
|
||||
}
|
||||
for (int i = 0; i < strArr.length; i++) {
|
||||
try {
|
||||
this.b[i] = Long.parseLong(strArr[i]);
|
||||
} catch (NumberFormatException unused) {
|
||||
a(strArr);
|
||||
throw null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String a() throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (long j : this.b) {
|
||||
sb.append(' ');
|
||||
sb.append(j);
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public File b(int i) {
|
||||
return this.d[i];
|
||||
}
|
||||
|
||||
private IOException a(String[] strArr) throws IOException {
|
||||
throw new IOException("unexpected journal line: " + Arrays.toString(strArr));
|
||||
}
|
||||
|
||||
public File a(int i) {
|
||||
return this.c[i];
|
||||
}
|
||||
}
|
||||
|
||||
public final class Value {
|
||||
private final File[] a;
|
||||
|
||||
public File a(int i) {
|
||||
return this.a[i];
|
||||
}
|
||||
|
||||
private Value(DiskLruCache diskLruCache, String str, long j, File[] fileArr, long[] jArr) {
|
||||
this.a = fileArr;
|
||||
}
|
||||
}
|
||||
|
||||
private DiskLruCache(File file, int i, int i2, long j) {
|
||||
this.a = file;
|
||||
this.e = i;
|
||||
this.b = new File(file, "journal");
|
||||
this.c = new File(file, "journal.tmp");
|
||||
this.d = new File(file, "journal.bkp");
|
||||
this.g = i2;
|
||||
this.f = j;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public void g() throws IOException {
|
||||
while (this.h > this.f) {
|
||||
c(this.j.entrySet().iterator().next().getKey());
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||||
public synchronized void close() throws IOException {
|
||||
if (this.i == null) {
|
||||
return;
|
||||
}
|
||||
Iterator it = new ArrayList(this.j.values()).iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry entry = (Entry) it.next();
|
||||
if (entry.f != null) {
|
||||
entry.f.a();
|
||||
}
|
||||
}
|
||||
g();
|
||||
this.i.close();
|
||||
this.i = null;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public boolean c() {
|
||||
int i = this.k;
|
||||
return i >= 2000 && i >= this.j.size();
|
||||
}
|
||||
|
||||
private void d(String str) throws IOException {
|
||||
String substring;
|
||||
int indexOf = str.indexOf(32);
|
||||
if (indexOf == -1) {
|
||||
throw new IOException("unexpected journal line: " + str);
|
||||
}
|
||||
int i = indexOf + 1;
|
||||
int indexOf2 = str.indexOf(32, i);
|
||||
if (indexOf2 == -1) {
|
||||
substring = str.substring(i);
|
||||
if (indexOf == 6 && str.startsWith("REMOVE")) {
|
||||
this.j.remove(substring);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
substring = str.substring(i, indexOf2);
|
||||
}
|
||||
Entry entry = this.j.get(substring);
|
||||
if (entry == null) {
|
||||
entry = new Entry(substring);
|
||||
this.j.put(substring, entry);
|
||||
}
|
||||
if (indexOf2 != -1 && indexOf == 5 && str.startsWith("CLEAN")) {
|
||||
String[] split = str.substring(indexOf2 + 1).split(" ");
|
||||
entry.e = true;
|
||||
entry.f = null;
|
||||
entry.b(split);
|
||||
return;
|
||||
}
|
||||
if (indexOf2 == -1 && indexOf == 5 && str.startsWith("DIRTY")) {
|
||||
entry.f = new Editor(entry);
|
||||
return;
|
||||
}
|
||||
if (indexOf2 == -1 && indexOf == 4 && str.startsWith("READ")) {
|
||||
return;
|
||||
}
|
||||
throw new IOException("unexpected journal line: " + str);
|
||||
}
|
||||
|
||||
private void e() throws IOException {
|
||||
StrictLineReader strictLineReader = new StrictLineReader(new FileInputStream(this.b), Util.a);
|
||||
try {
|
||||
String b = strictLineReader.b();
|
||||
String b2 = strictLineReader.b();
|
||||
String b3 = strictLineReader.b();
|
||||
String b4 = strictLineReader.b();
|
||||
String b5 = strictLineReader.b();
|
||||
if (!"libcore.io.DiskLruCache".equals(b) || !"1".equals(b2) || !Integer.toString(this.e).equals(b3) || !Integer.toString(this.g).equals(b4) || !"".equals(b5)) {
|
||||
throw new IOException("unexpected journal header: [" + b + ", " + b2 + ", " + b4 + ", " + b5 + "]");
|
||||
}
|
||||
int i = 0;
|
||||
while (true) {
|
||||
try {
|
||||
d(strictLineReader.b());
|
||||
i++;
|
||||
} catch (EOFException unused) {
|
||||
this.k = i - this.j.size();
|
||||
if (strictLineReader.a()) {
|
||||
f();
|
||||
} else {
|
||||
this.i = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.b, true), Util.a));
|
||||
}
|
||||
Util.a(strictLineReader);
|
||||
return;
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
Util.a(strictLineReader);
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public synchronized void f() throws IOException {
|
||||
if (this.i != null) {
|
||||
this.i.close();
|
||||
}
|
||||
BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.c), Util.a));
|
||||
try {
|
||||
bufferedWriter.write("libcore.io.DiskLruCache");
|
||||
bufferedWriter.write("\n");
|
||||
bufferedWriter.write("1");
|
||||
bufferedWriter.write("\n");
|
||||
bufferedWriter.write(Integer.toString(this.e));
|
||||
bufferedWriter.write("\n");
|
||||
bufferedWriter.write(Integer.toString(this.g));
|
||||
bufferedWriter.write("\n");
|
||||
bufferedWriter.write("\n");
|
||||
for (Entry entry : this.j.values()) {
|
||||
if (entry.f != null) {
|
||||
bufferedWriter.write("DIRTY " + entry.a + '\n');
|
||||
} else {
|
||||
bufferedWriter.write("CLEAN " + entry.a + entry.a() + '\n');
|
||||
}
|
||||
}
|
||||
bufferedWriter.close();
|
||||
if (this.b.exists()) {
|
||||
a(this.b, this.d, true);
|
||||
}
|
||||
a(this.c, this.b, false);
|
||||
this.d.delete();
|
||||
this.i = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.b, true), Util.a));
|
||||
} catch (Throwable th) {
|
||||
bufferedWriter.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized Value b(String str) throws IOException {
|
||||
b();
|
||||
Entry entry = this.j.get(str);
|
||||
if (entry == null) {
|
||||
return null;
|
||||
}
|
||||
if (!entry.e) {
|
||||
return null;
|
||||
}
|
||||
for (File file : entry.c) {
|
||||
if (!file.exists()) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
this.k++;
|
||||
this.i.append((CharSequence) "READ");
|
||||
this.i.append(' ');
|
||||
this.i.append((CharSequence) str);
|
||||
this.i.append('\n');
|
||||
if (c()) {
|
||||
this.m.submit(this.n);
|
||||
}
|
||||
return new Value(str, entry.g, entry.c, entry.b);
|
||||
}
|
||||
|
||||
public static DiskLruCache a(File file, int i, int i2, long j) throws IOException {
|
||||
if (j <= 0) {
|
||||
throw new IllegalArgumentException("maxSize <= 0");
|
||||
}
|
||||
if (i2 > 0) {
|
||||
File file2 = new File(file, "journal.bkp");
|
||||
if (file2.exists()) {
|
||||
File file3 = new File(file, "journal");
|
||||
if (file3.exists()) {
|
||||
file2.delete();
|
||||
} else {
|
||||
a(file2, file3, false);
|
||||
}
|
||||
}
|
||||
DiskLruCache diskLruCache = new DiskLruCache(file, i, i2, j);
|
||||
if (diskLruCache.b.exists()) {
|
||||
try {
|
||||
diskLruCache.e();
|
||||
diskLruCache.d();
|
||||
return diskLruCache;
|
||||
} catch (IOException e) {
|
||||
System.out.println("DiskLruCache " + file + " is corrupt: " + e.getMessage() + ", removing");
|
||||
diskLruCache.a();
|
||||
}
|
||||
}
|
||||
file.mkdirs();
|
||||
DiskLruCache diskLruCache2 = new DiskLruCache(file, i, i2, j);
|
||||
diskLruCache2.f();
|
||||
return diskLruCache2;
|
||||
}
|
||||
throw new IllegalArgumentException("valueCount <= 0");
|
||||
}
|
||||
|
||||
public synchronized boolean c(String str) throws IOException {
|
||||
b();
|
||||
Entry entry = this.j.get(str);
|
||||
if (entry != null && entry.f == null) {
|
||||
for (int i = 0; i < this.g; i++) {
|
||||
File a = entry.a(i);
|
||||
if (a.exists() && !a.delete()) {
|
||||
throw new IOException("failed to delete " + a);
|
||||
}
|
||||
this.h -= entry.b[i];
|
||||
entry.b[i] = 0;
|
||||
}
|
||||
this.k++;
|
||||
this.i.append((CharSequence) "REMOVE");
|
||||
this.i.append(' ');
|
||||
this.i.append((CharSequence) str);
|
||||
this.i.append('\n');
|
||||
this.j.remove(str);
|
||||
if (c()) {
|
||||
this.m.submit(this.n);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void b() {
|
||||
if (this.i == null) {
|
||||
throw new IllegalStateException("cache is closed");
|
||||
}
|
||||
}
|
||||
|
||||
private void d() throws IOException {
|
||||
a(this.c);
|
||||
Iterator<Entry> it = this.j.values().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry next = it.next();
|
||||
int i = 0;
|
||||
if (next.f != null) {
|
||||
next.f = null;
|
||||
while (i < this.g) {
|
||||
a(next.a(i));
|
||||
a(next.b(i));
|
||||
i++;
|
||||
}
|
||||
it.remove();
|
||||
} else {
|
||||
while (i < this.g) {
|
||||
this.h += next.b[i];
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(File file) throws IOException {
|
||||
if (file.exists() && !file.delete()) {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
|
||||
private static void a(File file, File file2, boolean z) throws IOException {
|
||||
if (z) {
|
||||
a(file2);
|
||||
}
|
||||
if (!file.renameTo(file2)) {
|
||||
throw new IOException();
|
||||
}
|
||||
}
|
||||
|
||||
public Editor a(String str) throws IOException {
|
||||
return a(str, -1L);
|
||||
}
|
||||
|
||||
private synchronized Editor a(String str, long j) throws IOException {
|
||||
b();
|
||||
Entry entry = this.j.get(str);
|
||||
if (j != -1 && (entry == null || entry.g != j)) {
|
||||
return null;
|
||||
}
|
||||
if (entry != null) {
|
||||
if (entry.f != null) {
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
entry = new Entry(str);
|
||||
this.j.put(str, entry);
|
||||
}
|
||||
Editor editor = new Editor(entry);
|
||||
entry.f = editor;
|
||||
this.i.append((CharSequence) "DIRTY");
|
||||
this.i.append(' ');
|
||||
this.i.append((CharSequence) str);
|
||||
this.i.append('\n');
|
||||
this.i.flush();
|
||||
return editor;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: private */
|
||||
public synchronized void a(Editor editor, boolean z) throws IOException {
|
||||
Entry entry = editor.a;
|
||||
if (entry.f == editor) {
|
||||
if (z && !entry.e) {
|
||||
for (int i = 0; i < this.g; i++) {
|
||||
if (editor.b[i]) {
|
||||
if (!entry.b(i).exists()) {
|
||||
editor.a();
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
editor.a();
|
||||
throw new IllegalStateException("Newly created entry didn't create value for index " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i2 = 0; i2 < this.g; i2++) {
|
||||
File b = entry.b(i2);
|
||||
if (z) {
|
||||
if (b.exists()) {
|
||||
File a = entry.a(i2);
|
||||
b.renameTo(a);
|
||||
long j = entry.b[i2];
|
||||
long length = a.length();
|
||||
entry.b[i2] = length;
|
||||
this.h = (this.h - j) + length;
|
||||
}
|
||||
} else {
|
||||
a(b);
|
||||
}
|
||||
}
|
||||
this.k++;
|
||||
entry.f = null;
|
||||
if (!(entry.e | z)) {
|
||||
this.j.remove(entry.a);
|
||||
this.i.append((CharSequence) "REMOVE");
|
||||
this.i.append(' ');
|
||||
this.i.append((CharSequence) entry.a);
|
||||
this.i.append('\n');
|
||||
} else {
|
||||
entry.e = true;
|
||||
this.i.append((CharSequence) "CLEAN");
|
||||
this.i.append(' ');
|
||||
this.i.append((CharSequence) entry.a);
|
||||
this.i.append((CharSequence) entry.a());
|
||||
this.i.append('\n');
|
||||
if (z) {
|
||||
long j2 = this.l;
|
||||
this.l = 1 + j2;
|
||||
entry.g = j2;
|
||||
}
|
||||
}
|
||||
this.i.flush();
|
||||
if (this.h > this.f || c()) {
|
||||
this.m.submit(this.n);
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public void a() throws IOException {
|
||||
close();
|
||||
Util.a(this.a);
|
||||
}
|
||||
}
|
120
sources/com/bumptech/glide/disklrucache/StrictLineReader.java
Normal file
120
sources/com/bumptech/glide/disklrucache/StrictLineReader.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package com.bumptech.glide.disklrucache;
|
||||
|
||||
import com.ubt.jimu.unity.bluetooth.UnityActivity;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.Closeable;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class StrictLineReader implements Closeable {
|
||||
private final InputStream a;
|
||||
private final Charset b;
|
||||
private byte[] c;
|
||||
private int d;
|
||||
private int e;
|
||||
|
||||
public StrictLineReader(InputStream inputStream, Charset charset) {
|
||||
this(inputStream, UnityActivity.BLOCKLY_TYPE_NONE, charset);
|
||||
}
|
||||
|
||||
private void c() throws IOException {
|
||||
InputStream inputStream = this.a;
|
||||
byte[] bArr = this.c;
|
||||
int read = inputStream.read(bArr, 0, bArr.length);
|
||||
if (read == -1) {
|
||||
throw new EOFException();
|
||||
}
|
||||
this.d = 0;
|
||||
this.e = read;
|
||||
}
|
||||
|
||||
public String b() throws IOException {
|
||||
int i;
|
||||
int i2;
|
||||
synchronized (this.a) {
|
||||
if (this.c == null) {
|
||||
throw new IOException("LineReader is closed");
|
||||
}
|
||||
if (this.d >= this.e) {
|
||||
c();
|
||||
}
|
||||
for (int i3 = this.d; i3 != this.e; i3++) {
|
||||
if (this.c[i3] == 10) {
|
||||
if (i3 != this.d) {
|
||||
i2 = i3 - 1;
|
||||
if (this.c[i2] == 13) {
|
||||
String str = new String(this.c, this.d, i2 - this.d, this.b.name());
|
||||
this.d = i3 + 1;
|
||||
return str;
|
||||
}
|
||||
}
|
||||
i2 = i3;
|
||||
String str2 = new String(this.c, this.d, i2 - this.d, this.b.name());
|
||||
this.d = i3 + 1;
|
||||
return str2;
|
||||
}
|
||||
}
|
||||
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream((this.e - this.d) + 80) { // from class: com.bumptech.glide.disklrucache.StrictLineReader.1
|
||||
@Override // java.io.ByteArrayOutputStream
|
||||
public String toString() {
|
||||
int i4 = ((ByteArrayOutputStream) this).count;
|
||||
try {
|
||||
return new String(((ByteArrayOutputStream) this).buf, 0, (i4 <= 0 || ((ByteArrayOutputStream) this).buf[i4 + (-1)] != 13) ? ((ByteArrayOutputStream) this).count : i4 - 1, StrictLineReader.this.b.name());
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
throw new AssertionError(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
loop1: while (true) {
|
||||
byteArrayOutputStream.write(this.c, this.d, this.e - this.d);
|
||||
this.e = -1;
|
||||
c();
|
||||
i = this.d;
|
||||
while (i != this.e) {
|
||||
if (this.c[i] == 10) {
|
||||
break loop1;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
}
|
||||
if (i != this.d) {
|
||||
byteArrayOutputStream.write(this.c, this.d, i - this.d);
|
||||
}
|
||||
this.d = i + 1;
|
||||
return byteArrayOutputStream.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() throws IOException {
|
||||
synchronized (this.a) {
|
||||
if (this.c != null) {
|
||||
this.c = null;
|
||||
this.a.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public StrictLineReader(InputStream inputStream, int i, Charset charset) {
|
||||
if (inputStream == null || charset == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
if (i < 0) {
|
||||
throw new IllegalArgumentException("capacity <= 0");
|
||||
}
|
||||
if (!charset.equals(Util.a)) {
|
||||
throw new IllegalArgumentException("Unsupported encoding");
|
||||
}
|
||||
this.a = inputStream;
|
||||
this.b = charset;
|
||||
this.c = new byte[i];
|
||||
}
|
||||
|
||||
public boolean a() {
|
||||
return this.e == -1;
|
||||
}
|
||||
}
|
41
sources/com/bumptech/glide/disklrucache/Util.java
Normal file
41
sources/com/bumptech/glide/disklrucache/Util.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package com.bumptech.glide.disklrucache;
|
||||
|
||||
import java.io.Closeable;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.Charset;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class Util {
|
||||
static final Charset a = Charset.forName("US-ASCII");
|
||||
|
||||
static {
|
||||
Charset.forName("UTF-8");
|
||||
}
|
||||
|
||||
static void a(File file) throws IOException {
|
||||
File[] listFiles = file.listFiles();
|
||||
if (listFiles == null) {
|
||||
throw new IOException("not a readable directory: " + file);
|
||||
}
|
||||
for (File file2 : listFiles) {
|
||||
if (file2.isDirectory()) {
|
||||
a(file2);
|
||||
}
|
||||
if (!file2.delete()) {
|
||||
throw new IOException("failed to delete file: " + file2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void a(Closeable closeable) {
|
||||
if (closeable != null) {
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (RuntimeException e) {
|
||||
throw e;
|
||||
} catch (Exception unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
42
sources/com/bumptech/glide/gifdecoder/GifDecoder.java
Normal file
42
sources/com/bumptech/glide/gifdecoder/GifDecoder.java
Normal file
@@ -0,0 +1,42 @@
|
||||
package com.bumptech.glide.gifdecoder;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface GifDecoder {
|
||||
|
||||
public interface BitmapProvider {
|
||||
Bitmap a(int i, int i2, Bitmap.Config config);
|
||||
|
||||
void a(Bitmap bitmap);
|
||||
|
||||
void a(byte[] bArr);
|
||||
|
||||
void a(int[] iArr);
|
||||
|
||||
int[] a(int i);
|
||||
|
||||
byte[] b(int i);
|
||||
}
|
||||
|
||||
Bitmap a();
|
||||
|
||||
void a(Bitmap.Config config);
|
||||
|
||||
void b();
|
||||
|
||||
int c();
|
||||
|
||||
void clear();
|
||||
|
||||
int d();
|
||||
|
||||
ByteBuffer e();
|
||||
|
||||
void f();
|
||||
|
||||
int g();
|
||||
|
||||
int h();
|
||||
}
|
19
sources/com/bumptech/glide/gifdecoder/GifFrame.java
Normal file
19
sources/com/bumptech/glide/gifdecoder/GifFrame.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package com.bumptech.glide.gifdecoder;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GifFrame {
|
||||
int a;
|
||||
int b;
|
||||
int c;
|
||||
int d;
|
||||
boolean e;
|
||||
boolean f;
|
||||
int g;
|
||||
int h;
|
||||
int i;
|
||||
int j;
|
||||
int[] k;
|
||||
|
||||
GifFrame() {
|
||||
}
|
||||
}
|
37
sources/com/bumptech/glide/gifdecoder/GifHeader.java
Normal file
37
sources/com/bumptech/glide/gifdecoder/GifHeader.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.bumptech.glide.gifdecoder;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GifHeader {
|
||||
GifFrame d;
|
||||
int f;
|
||||
int g;
|
||||
boolean h;
|
||||
int i;
|
||||
int j;
|
||||
int k;
|
||||
int l;
|
||||
int m;
|
||||
int[] a = null;
|
||||
int b = 0;
|
||||
int c = 0;
|
||||
final List<GifFrame> e = new ArrayList();
|
||||
|
||||
public int a() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public int c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
public int d() {
|
||||
return this.f;
|
||||
}
|
||||
}
|
261
sources/com/bumptech/glide/gifdecoder/GifHeaderParser.java
Normal file
261
sources/com/bumptech/glide/gifdecoder/GifHeaderParser.java
Normal file
@@ -0,0 +1,261 @@
|
||||
package com.bumptech.glide.gifdecoder;
|
||||
|
||||
import android.util.Log;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubtrobot.jimu.robotapi.PeripheralType;
|
||||
import java.nio.BufferUnderflowException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class GifHeaderParser {
|
||||
private ByteBuffer b;
|
||||
private GifHeader c;
|
||||
private final byte[] a = new byte[DataDecryptTool.DECRYPT_ALL_FILE];
|
||||
private int d = 0;
|
||||
|
||||
private boolean c() {
|
||||
return this.c.b != 0;
|
||||
}
|
||||
|
||||
private int d() {
|
||||
try {
|
||||
return this.b.get() & 255;
|
||||
} catch (Exception unused) {
|
||||
this.c.b = 1;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void e() {
|
||||
this.c.d.a = l();
|
||||
this.c.d.b = l();
|
||||
this.c.d.c = l();
|
||||
this.c.d.d = l();
|
||||
int d = d();
|
||||
boolean z = (d & PeripheralType.SERVO) != 0;
|
||||
int pow = (int) Math.pow(2.0d, (d & 7) + 1);
|
||||
this.c.d.e = (d & 64) != 0;
|
||||
if (z) {
|
||||
this.c.d.k = a(pow);
|
||||
} else {
|
||||
this.c.d.k = null;
|
||||
}
|
||||
this.c.d.j = this.b.position();
|
||||
o();
|
||||
if (c()) {
|
||||
return;
|
||||
}
|
||||
GifHeader gifHeader = this.c;
|
||||
gifHeader.c++;
|
||||
gifHeader.e.add(gifHeader.d);
|
||||
}
|
||||
|
||||
private void f() {
|
||||
this.d = d();
|
||||
if (this.d > 0) {
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
while (i < this.d) {
|
||||
try {
|
||||
i2 = this.d - i;
|
||||
this.b.get(this.a, i, i2);
|
||||
i += i2;
|
||||
} catch (Exception e) {
|
||||
if (Log.isLoggable("GifHeaderParser", 3)) {
|
||||
Log.d("GifHeaderParser", "Error Reading Block n: " + i + " count: " + i2 + " blockSize: " + this.d, e);
|
||||
}
|
||||
this.c.b = 1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void g() {
|
||||
b(Integer.MAX_VALUE);
|
||||
}
|
||||
|
||||
private void h() {
|
||||
d();
|
||||
int d = d();
|
||||
GifFrame gifFrame = this.c.d;
|
||||
gifFrame.g = (d & 28) >> 2;
|
||||
if (gifFrame.g == 0) {
|
||||
gifFrame.g = 1;
|
||||
}
|
||||
this.c.d.f = (d & 1) != 0;
|
||||
int l = l();
|
||||
if (l < 2) {
|
||||
l = 10;
|
||||
}
|
||||
GifFrame gifFrame2 = this.c.d;
|
||||
gifFrame2.i = l * 10;
|
||||
gifFrame2.h = d();
|
||||
d();
|
||||
}
|
||||
|
||||
private void i() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
sb.append((char) d());
|
||||
}
|
||||
if (!sb.toString().startsWith("GIF")) {
|
||||
this.c.b = 1;
|
||||
return;
|
||||
}
|
||||
j();
|
||||
if (!this.c.h || c()) {
|
||||
return;
|
||||
}
|
||||
GifHeader gifHeader = this.c;
|
||||
gifHeader.a = a(gifHeader.i);
|
||||
GifHeader gifHeader2 = this.c;
|
||||
gifHeader2.l = gifHeader2.a[gifHeader2.j];
|
||||
}
|
||||
|
||||
private void j() {
|
||||
this.c.f = l();
|
||||
this.c.g = l();
|
||||
this.c.h = (d() & PeripheralType.SERVO) != 0;
|
||||
this.c.i = (int) Math.pow(2.0d, (r0 & 7) + 1);
|
||||
this.c.j = d();
|
||||
this.c.k = d();
|
||||
}
|
||||
|
||||
private void k() {
|
||||
do {
|
||||
f();
|
||||
byte[] bArr = this.a;
|
||||
if (bArr[0] == 1) {
|
||||
this.c.m = ((bArr[2] & 255) << 8) | (bArr[1] & 255);
|
||||
}
|
||||
if (this.d <= 0) {
|
||||
return;
|
||||
}
|
||||
} while (!c());
|
||||
}
|
||||
|
||||
private int l() {
|
||||
return this.b.getShort();
|
||||
}
|
||||
|
||||
private void m() {
|
||||
this.b = null;
|
||||
Arrays.fill(this.a, (byte) 0);
|
||||
this.c = new GifHeader();
|
||||
this.d = 0;
|
||||
}
|
||||
|
||||
private void n() {
|
||||
int d;
|
||||
do {
|
||||
d = d();
|
||||
this.b.position(Math.min(this.b.position() + d, this.b.limit()));
|
||||
} while (d > 0);
|
||||
}
|
||||
|
||||
private void o() {
|
||||
d();
|
||||
n();
|
||||
}
|
||||
|
||||
public GifHeaderParser a(ByteBuffer byteBuffer) {
|
||||
m();
|
||||
this.b = byteBuffer.asReadOnlyBuffer();
|
||||
this.b.position(0);
|
||||
this.b.order(ByteOrder.LITTLE_ENDIAN);
|
||||
return this;
|
||||
}
|
||||
|
||||
public GifHeader b() {
|
||||
if (this.b == null) {
|
||||
throw new IllegalStateException("You must call setData() before parseHeader()");
|
||||
}
|
||||
if (c()) {
|
||||
return this.c;
|
||||
}
|
||||
i();
|
||||
if (!c()) {
|
||||
g();
|
||||
GifHeader gifHeader = this.c;
|
||||
if (gifHeader.c < 0) {
|
||||
gifHeader.b = 1;
|
||||
}
|
||||
}
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
}
|
||||
|
||||
private int[] a(int i) {
|
||||
byte[] bArr = new byte[i * 3];
|
||||
int[] iArr = null;
|
||||
try {
|
||||
this.b.get(bArr);
|
||||
iArr = new int[DataDecryptTool.DECRYPT_ALL_FILE];
|
||||
int i2 = 0;
|
||||
int i3 = 0;
|
||||
while (i2 < i) {
|
||||
int i4 = i3 + 1;
|
||||
int i5 = i4 + 1;
|
||||
int i6 = i5 + 1;
|
||||
int i7 = i2 + 1;
|
||||
iArr[i2] = ((bArr[i3] & 255) << 16) | (-16777216) | ((bArr[i4] & 255) << 8) | (bArr[i5] & 255);
|
||||
i3 = i6;
|
||||
i2 = i7;
|
||||
}
|
||||
} catch (BufferUnderflowException e) {
|
||||
if (Log.isLoggable("GifHeaderParser", 3)) {
|
||||
Log.d("GifHeaderParser", "Format Error Reading Color Table", e);
|
||||
}
|
||||
this.c.b = 1;
|
||||
}
|
||||
return iArr;
|
||||
}
|
||||
|
||||
private void b(int i) {
|
||||
boolean z = false;
|
||||
while (!z && !c() && this.c.c <= i) {
|
||||
int d = d();
|
||||
if (d == 33) {
|
||||
int d2 = d();
|
||||
if (d2 == 1) {
|
||||
n();
|
||||
} else if (d2 == 249) {
|
||||
this.c.d = new GifFrame();
|
||||
h();
|
||||
} else if (d2 == 254) {
|
||||
n();
|
||||
} else if (d2 != 255) {
|
||||
n();
|
||||
} else {
|
||||
f();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i2 = 0; i2 < 11; i2++) {
|
||||
sb.append((char) this.a[i2]);
|
||||
}
|
||||
if (sb.toString().equals("NETSCAPE2.0")) {
|
||||
k();
|
||||
} else {
|
||||
n();
|
||||
}
|
||||
}
|
||||
} else if (d == 44) {
|
||||
GifHeader gifHeader = this.c;
|
||||
if (gifHeader.d == null) {
|
||||
gifHeader.d = new GifFrame();
|
||||
}
|
||||
e();
|
||||
} else if (d != 59) {
|
||||
this.c.b = 1;
|
||||
} else {
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
655
sources/com/bumptech/glide/gifdecoder/StandardGifDecoder.java
Normal file
655
sources/com/bumptech/glide/gifdecoder/StandardGifDecoder.java
Normal file
@@ -0,0 +1,655 @@
|
||||
package com.bumptech.glide.gifdecoder;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.gifdecoder.GifDecoder;
|
||||
import com.ijm.dataencryption.de.DataDecryptTool;
|
||||
import com.ubt.jimu.base.util.FileUtil;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StandardGifDecoder implements GifDecoder {
|
||||
private static final String u = "StandardGifDecoder";
|
||||
private int[] a;
|
||||
private final int[] b;
|
||||
private final GifDecoder.BitmapProvider c;
|
||||
private ByteBuffer d;
|
||||
private byte[] e;
|
||||
private short[] f;
|
||||
private byte[] g;
|
||||
private byte[] h;
|
||||
private byte[] i;
|
||||
private int[] j;
|
||||
private int k;
|
||||
private GifHeader l;
|
||||
private Bitmap m;
|
||||
private boolean n;
|
||||
private int o;
|
||||
private int p;
|
||||
private int q;
|
||||
private int r;
|
||||
private Boolean s;
|
||||
private Bitmap.Config t;
|
||||
|
||||
public StandardGifDecoder(GifDecoder.BitmapProvider bitmapProvider, GifHeader gifHeader, ByteBuffer byteBuffer, int i) {
|
||||
this(bitmapProvider);
|
||||
a(gifHeader, byteBuffer, i);
|
||||
}
|
||||
|
||||
private Bitmap i() {
|
||||
Boolean bool = this.s;
|
||||
Bitmap a = this.c.a(this.r, this.q, (bool == null || bool.booleanValue()) ? Bitmap.Config.ARGB_8888 : this.t);
|
||||
a.setHasAlpha(true);
|
||||
return a;
|
||||
}
|
||||
|
||||
private int j() {
|
||||
int k = k();
|
||||
if (k <= 0) {
|
||||
return k;
|
||||
}
|
||||
ByteBuffer byteBuffer = this.d;
|
||||
byteBuffer.get(this.e, 0, Math.min(k, byteBuffer.remaining()));
|
||||
return k;
|
||||
}
|
||||
|
||||
private int k() {
|
||||
return this.d.get() & 255;
|
||||
}
|
||||
|
||||
public int a(int i) {
|
||||
if (i >= 0) {
|
||||
GifHeader gifHeader = this.l;
|
||||
if (i < gifHeader.c) {
|
||||
return gifHeader.e.get(i).i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public void b() {
|
||||
this.k = (this.k + 1) % this.l.c;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public int c() {
|
||||
return this.l.c;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public void clear() {
|
||||
this.l = null;
|
||||
byte[] bArr = this.i;
|
||||
if (bArr != null) {
|
||||
this.c.a(bArr);
|
||||
}
|
||||
int[] iArr = this.j;
|
||||
if (iArr != null) {
|
||||
this.c.a(iArr);
|
||||
}
|
||||
Bitmap bitmap = this.m;
|
||||
if (bitmap != null) {
|
||||
this.c.a(bitmap);
|
||||
}
|
||||
this.m = null;
|
||||
this.d = null;
|
||||
this.s = null;
|
||||
byte[] bArr2 = this.e;
|
||||
if (bArr2 != null) {
|
||||
this.c.a(bArr2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public int d() {
|
||||
int i;
|
||||
if (this.l.c <= 0 || (i = this.k) < 0) {
|
||||
return 0;
|
||||
}
|
||||
return a(i);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public ByteBuffer e() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public void f() {
|
||||
this.k = -1;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public int g() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public int h() {
|
||||
return this.d.limit() + this.i.length + (this.j.length * 4);
|
||||
}
|
||||
|
||||
private void b(GifFrame gifFrame) {
|
||||
GifFrame gifFrame2 = gifFrame;
|
||||
int[] iArr = this.j;
|
||||
int i = gifFrame2.d;
|
||||
int i2 = gifFrame2.b;
|
||||
int i3 = gifFrame2.c;
|
||||
int i4 = gifFrame2.a;
|
||||
boolean z = this.k == 0;
|
||||
int i5 = this.r;
|
||||
byte[] bArr = this.i;
|
||||
int[] iArr2 = this.a;
|
||||
int i6 = 0;
|
||||
byte b = -1;
|
||||
while (i6 < i) {
|
||||
int i7 = (i6 + i2) * i5;
|
||||
int i8 = i7 + i4;
|
||||
int i9 = i8 + i3;
|
||||
int i10 = i7 + i5;
|
||||
if (i10 < i9) {
|
||||
i9 = i10;
|
||||
}
|
||||
int i11 = gifFrame2.c * i6;
|
||||
for (int i12 = i8; i12 < i9; i12++) {
|
||||
byte b2 = bArr[i11];
|
||||
int i13 = b2 & 255;
|
||||
if (i13 != b) {
|
||||
int i14 = iArr2[i13];
|
||||
if (i14 != 0) {
|
||||
iArr[i12] = i14;
|
||||
} else {
|
||||
b = b2;
|
||||
}
|
||||
}
|
||||
i11++;
|
||||
}
|
||||
i6++;
|
||||
gifFrame2 = gifFrame;
|
||||
}
|
||||
this.s = Boolean.valueOf(this.s == null && z && b != -1);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
/* JADX WARN: Type inference failed for: r4v10 */
|
||||
/* JADX WARN: Type inference failed for: r4v11 */
|
||||
/* JADX WARN: Type inference failed for: r4v12 */
|
||||
/* JADX WARN: Type inference failed for: r4v17, types: [short] */
|
||||
/* JADX WARN: Type inference failed for: r4v20 */
|
||||
private void c(GifFrame gifFrame) {
|
||||
int i;
|
||||
int i2;
|
||||
short s;
|
||||
StandardGifDecoder standardGifDecoder = this;
|
||||
if (gifFrame != null) {
|
||||
standardGifDecoder.d.position(gifFrame.j);
|
||||
}
|
||||
if (gifFrame == null) {
|
||||
GifHeader gifHeader = standardGifDecoder.l;
|
||||
i = gifHeader.f;
|
||||
i2 = gifHeader.g;
|
||||
} else {
|
||||
i = gifFrame.c;
|
||||
i2 = gifFrame.d;
|
||||
}
|
||||
int i3 = i * i2;
|
||||
byte[] bArr = standardGifDecoder.i;
|
||||
if (bArr == null || bArr.length < i3) {
|
||||
standardGifDecoder.i = standardGifDecoder.c.b(i3);
|
||||
}
|
||||
byte[] bArr2 = standardGifDecoder.i;
|
||||
if (standardGifDecoder.f == null) {
|
||||
standardGifDecoder.f = new short[FileUtil.ZIP_BUFFER_SIZE];
|
||||
}
|
||||
short[] sArr = standardGifDecoder.f;
|
||||
if (standardGifDecoder.g == null) {
|
||||
standardGifDecoder.g = new byte[FileUtil.ZIP_BUFFER_SIZE];
|
||||
}
|
||||
byte[] bArr3 = standardGifDecoder.g;
|
||||
if (standardGifDecoder.h == null) {
|
||||
standardGifDecoder.h = new byte[4097];
|
||||
}
|
||||
byte[] bArr4 = standardGifDecoder.h;
|
||||
int k = k();
|
||||
int i4 = 1 << k;
|
||||
int i5 = i4 + 1;
|
||||
int i6 = i4 + 2;
|
||||
int i7 = k + 1;
|
||||
int i8 = (1 << i7) - 1;
|
||||
int i9 = 0;
|
||||
for (int i10 = 0; i10 < i4; i10++) {
|
||||
sArr[i10] = 0;
|
||||
bArr3[i10] = (byte) i10;
|
||||
}
|
||||
byte[] bArr5 = standardGifDecoder.e;
|
||||
int i11 = i7;
|
||||
int i12 = i6;
|
||||
int i13 = i8;
|
||||
int i14 = 0;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
int i17 = 0;
|
||||
int i18 = 0;
|
||||
int i19 = -1;
|
||||
int i20 = 0;
|
||||
int i21 = 0;
|
||||
while (true) {
|
||||
if (i9 >= i3) {
|
||||
break;
|
||||
}
|
||||
if (i14 == 0) {
|
||||
i14 = j();
|
||||
if (i14 <= 0) {
|
||||
standardGifDecoder.o = 3;
|
||||
break;
|
||||
}
|
||||
i17 = 0;
|
||||
}
|
||||
i16 += (bArr5[i17] & 255) << i15;
|
||||
i17++;
|
||||
i14--;
|
||||
int i22 = i15 + 8;
|
||||
int i23 = i19;
|
||||
int i24 = i20;
|
||||
int i25 = i12;
|
||||
int i26 = i18;
|
||||
int i27 = i9;
|
||||
int i28 = i11;
|
||||
while (true) {
|
||||
if (i22 < i28) {
|
||||
i11 = i28;
|
||||
i20 = i24;
|
||||
i9 = i27;
|
||||
i18 = i26;
|
||||
i15 = i22;
|
||||
i12 = i25;
|
||||
i19 = i23;
|
||||
standardGifDecoder = this;
|
||||
break;
|
||||
}
|
||||
int i29 = i16 & i13;
|
||||
i16 >>= i28;
|
||||
i22 -= i28;
|
||||
if (i29 == i4) {
|
||||
i28 = i7;
|
||||
i25 = i6;
|
||||
i13 = i8;
|
||||
i23 = -1;
|
||||
} else {
|
||||
if (i29 == i5) {
|
||||
i15 = i22;
|
||||
i11 = i28;
|
||||
i9 = i27;
|
||||
i18 = i26;
|
||||
i12 = i25;
|
||||
i20 = i24;
|
||||
i19 = i23;
|
||||
break;
|
||||
}
|
||||
if (i23 == -1) {
|
||||
bArr2[i26] = bArr3[i29];
|
||||
i26++;
|
||||
i27++;
|
||||
standardGifDecoder = this;
|
||||
i23 = i29;
|
||||
i24 = i23;
|
||||
} else {
|
||||
int i30 = i25;
|
||||
if (i29 >= i30) {
|
||||
bArr4[i21] = (byte) i24;
|
||||
i21++;
|
||||
s = i23;
|
||||
} else {
|
||||
s = i29;
|
||||
}
|
||||
while (s >= i4) {
|
||||
bArr4[i21] = bArr3[s];
|
||||
i21++;
|
||||
s = sArr[s];
|
||||
}
|
||||
int i31 = bArr3[s] & 255;
|
||||
int i32 = i7;
|
||||
byte b = (byte) i31;
|
||||
bArr2[i26] = b;
|
||||
while (true) {
|
||||
i26++;
|
||||
i27++;
|
||||
if (i21 <= 0) {
|
||||
break;
|
||||
}
|
||||
i21--;
|
||||
bArr2[i26] = bArr4[i21];
|
||||
}
|
||||
if (i30 < 4096) {
|
||||
sArr[i30] = (short) i23;
|
||||
bArr3[i30] = b;
|
||||
i30++;
|
||||
if ((i30 & i13) == 0 && i30 < 4096) {
|
||||
i28++;
|
||||
i13 += i30;
|
||||
}
|
||||
}
|
||||
i23 = i29;
|
||||
i22 = i22;
|
||||
i7 = i32;
|
||||
i24 = i31;
|
||||
i25 = i30;
|
||||
standardGifDecoder = this;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Arrays.fill(bArr2, i18, i3, (byte) 0);
|
||||
}
|
||||
|
||||
public StandardGifDecoder(GifDecoder.BitmapProvider bitmapProvider) {
|
||||
this.b = new int[DataDecryptTool.DECRYPT_ALL_FILE];
|
||||
this.t = Bitmap.Config.ARGB_8888;
|
||||
this.c = bitmapProvider;
|
||||
this.l = new GifHeader();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public synchronized Bitmap a() {
|
||||
if (this.l.c <= 0 || this.k < 0) {
|
||||
if (Log.isLoggable(u, 3)) {
|
||||
Log.d(u, "Unable to decode frame, frameCount=" + this.l.c + ", framePointer=" + this.k);
|
||||
}
|
||||
this.o = 1;
|
||||
}
|
||||
if (this.o != 1 && this.o != 2) {
|
||||
this.o = 0;
|
||||
if (this.e == null) {
|
||||
this.e = this.c.b(255);
|
||||
}
|
||||
GifFrame gifFrame = this.l.e.get(this.k);
|
||||
int i = this.k - 1;
|
||||
GifFrame gifFrame2 = i >= 0 ? this.l.e.get(i) : null;
|
||||
this.a = gifFrame.k != null ? gifFrame.k : this.l.a;
|
||||
if (this.a == null) {
|
||||
if (Log.isLoggable(u, 3)) {
|
||||
Log.d(u, "No valid color table found for frame #" + this.k);
|
||||
}
|
||||
this.o = 1;
|
||||
return null;
|
||||
}
|
||||
if (gifFrame.f) {
|
||||
System.arraycopy(this.a, 0, this.b, 0, this.a.length);
|
||||
this.a = this.b;
|
||||
this.a[gifFrame.h] = 0;
|
||||
}
|
||||
return a(gifFrame, gifFrame2);
|
||||
}
|
||||
if (Log.isLoggable(u, 3)) {
|
||||
Log.d(u, "Unable to decode frame, status=" + this.o);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public synchronized void a(GifHeader gifHeader, ByteBuffer byteBuffer, int i) {
|
||||
if (i > 0) {
|
||||
int highestOneBit = Integer.highestOneBit(i);
|
||||
this.o = 0;
|
||||
this.l = gifHeader;
|
||||
this.k = -1;
|
||||
this.d = byteBuffer.asReadOnlyBuffer();
|
||||
this.d.position(0);
|
||||
this.d.order(ByteOrder.LITTLE_ENDIAN);
|
||||
this.n = false;
|
||||
Iterator<GifFrame> it = gifHeader.e.iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
} else if (it.next().g == 3) {
|
||||
this.n = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.p = highestOneBit;
|
||||
this.r = gifHeader.f / highestOneBit;
|
||||
this.q = gifHeader.g / highestOneBit;
|
||||
this.i = this.c.b(gifHeader.f * gifHeader.g);
|
||||
this.j = this.c.a(this.r * this.q);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Sample size must be >=0, not: " + i);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.gifdecoder.GifDecoder
|
||||
public void a(Bitmap.Config config) {
|
||||
if (config != Bitmap.Config.ARGB_8888 && config != Bitmap.Config.RGB_565) {
|
||||
throw new IllegalArgumentException("Unsupported format: " + config + ", must be one of " + Bitmap.Config.ARGB_8888 + " or " + Bitmap.Config.RGB_565);
|
||||
}
|
||||
this.t = config;
|
||||
}
|
||||
|
||||
private Bitmap a(GifFrame gifFrame, GifFrame gifFrame2) {
|
||||
int i;
|
||||
int i2;
|
||||
Bitmap bitmap;
|
||||
int[] iArr = this.j;
|
||||
int i3 = 0;
|
||||
if (gifFrame2 == null) {
|
||||
Bitmap bitmap2 = this.m;
|
||||
if (bitmap2 != null) {
|
||||
this.c.a(bitmap2);
|
||||
}
|
||||
this.m = null;
|
||||
Arrays.fill(iArr, 0);
|
||||
}
|
||||
if (gifFrame2 != null && gifFrame2.g == 3 && this.m == null) {
|
||||
Arrays.fill(iArr, 0);
|
||||
}
|
||||
if (gifFrame2 != null && (i2 = gifFrame2.g) > 0) {
|
||||
if (i2 == 2) {
|
||||
if (!gifFrame.f) {
|
||||
GifHeader gifHeader = this.l;
|
||||
int i4 = gifHeader.l;
|
||||
if (gifFrame.k == null || gifHeader.j != gifFrame.h) {
|
||||
i3 = i4;
|
||||
}
|
||||
} else if (this.k == 0) {
|
||||
this.s = true;
|
||||
}
|
||||
int i5 = gifFrame2.d;
|
||||
int i6 = this.p;
|
||||
int i7 = i5 / i6;
|
||||
int i8 = gifFrame2.b / i6;
|
||||
int i9 = gifFrame2.c / i6;
|
||||
int i10 = gifFrame2.a / i6;
|
||||
int i11 = this.r;
|
||||
int i12 = (i8 * i11) + i10;
|
||||
int i13 = (i7 * i11) + i12;
|
||||
while (i12 < i13) {
|
||||
int i14 = i12 + i9;
|
||||
for (int i15 = i12; i15 < i14; i15++) {
|
||||
iArr[i15] = i3;
|
||||
}
|
||||
i12 += this.r;
|
||||
}
|
||||
} else if (i2 == 3 && (bitmap = this.m) != null) {
|
||||
int i16 = this.r;
|
||||
bitmap.getPixels(iArr, 0, i16, 0, 0, i16, this.q);
|
||||
}
|
||||
}
|
||||
c(gifFrame);
|
||||
if (!gifFrame.e && this.p == 1) {
|
||||
b(gifFrame);
|
||||
} else {
|
||||
a(gifFrame);
|
||||
}
|
||||
if (this.n && ((i = gifFrame.g) == 0 || i == 1)) {
|
||||
if (this.m == null) {
|
||||
this.m = i();
|
||||
}
|
||||
Bitmap bitmap3 = this.m;
|
||||
int i17 = this.r;
|
||||
bitmap3.setPixels(iArr, 0, i17, 0, 0, i17, this.q);
|
||||
}
|
||||
Bitmap i18 = i();
|
||||
int i19 = this.r;
|
||||
i18.setPixels(iArr, 0, i19, 0, 0, i19, this.q);
|
||||
return i18;
|
||||
}
|
||||
|
||||
private void a(GifFrame gifFrame) {
|
||||
int i;
|
||||
int i2;
|
||||
int i3;
|
||||
int i4;
|
||||
int i5;
|
||||
int[] iArr = this.j;
|
||||
int i6 = gifFrame.d;
|
||||
int i7 = this.p;
|
||||
int i8 = i6 / i7;
|
||||
int i9 = gifFrame.b / i7;
|
||||
int i10 = gifFrame.c / i7;
|
||||
int i11 = gifFrame.a / i7;
|
||||
Boolean bool = true;
|
||||
boolean z = this.k == 0;
|
||||
int i12 = this.p;
|
||||
int i13 = this.r;
|
||||
int i14 = this.q;
|
||||
byte[] bArr = this.i;
|
||||
int[] iArr2 = this.a;
|
||||
Boolean bool2 = this.s;
|
||||
int i15 = 0;
|
||||
int i16 = 0;
|
||||
int i17 = 1;
|
||||
int i18 = 8;
|
||||
while (i15 < i8) {
|
||||
Boolean bool3 = bool;
|
||||
if (gifFrame.e) {
|
||||
if (i16 >= i8) {
|
||||
i = i8;
|
||||
i5 = i17 + 1;
|
||||
if (i5 == 2) {
|
||||
i16 = 4;
|
||||
} else if (i5 == 3) {
|
||||
i16 = 2;
|
||||
i18 = 4;
|
||||
} else if (i5 == 4) {
|
||||
i16 = 1;
|
||||
i18 = 2;
|
||||
}
|
||||
} else {
|
||||
i = i8;
|
||||
i5 = i17;
|
||||
}
|
||||
i2 = i16 + i18;
|
||||
i17 = i5;
|
||||
} else {
|
||||
i = i8;
|
||||
i2 = i16;
|
||||
i16 = i15;
|
||||
}
|
||||
int i19 = i16 + i9;
|
||||
boolean z2 = i12 == 1;
|
||||
if (i19 < i14) {
|
||||
int i20 = i19 * i13;
|
||||
int i21 = i20 + i11;
|
||||
int i22 = i21 + i10;
|
||||
int i23 = i20 + i13;
|
||||
if (i23 < i22) {
|
||||
i22 = i23;
|
||||
}
|
||||
i3 = i9;
|
||||
int i24 = i15 * i12 * gifFrame.c;
|
||||
if (z2) {
|
||||
int i25 = i21;
|
||||
while (i25 < i22) {
|
||||
int i26 = i10;
|
||||
int i27 = iArr2[bArr[i24] & 255];
|
||||
if (i27 != 0) {
|
||||
iArr[i25] = i27;
|
||||
} else if (z && bool2 == null) {
|
||||
bool2 = bool3;
|
||||
}
|
||||
i24 += i12;
|
||||
i25++;
|
||||
i10 = i26;
|
||||
}
|
||||
} else {
|
||||
i4 = i10;
|
||||
int i28 = ((i22 - i21) * i12) + i24;
|
||||
int i29 = i21;
|
||||
while (i29 < i22) {
|
||||
int i30 = i22;
|
||||
int a = a(i24, i28, gifFrame.c);
|
||||
if (a != 0) {
|
||||
iArr[i29] = a;
|
||||
} else if (z && bool2 == null) {
|
||||
bool2 = bool3;
|
||||
}
|
||||
i24 += i12;
|
||||
i29++;
|
||||
i22 = i30;
|
||||
}
|
||||
i15++;
|
||||
i16 = i2;
|
||||
i10 = i4;
|
||||
bool = bool3;
|
||||
i8 = i;
|
||||
i9 = i3;
|
||||
}
|
||||
} else {
|
||||
i3 = i9;
|
||||
}
|
||||
i4 = i10;
|
||||
i15++;
|
||||
i16 = i2;
|
||||
i10 = i4;
|
||||
bool = bool3;
|
||||
i8 = i;
|
||||
i9 = i3;
|
||||
}
|
||||
if (this.s == null) {
|
||||
this.s = Boolean.valueOf(bool2 == null ? false : bool2.booleanValue());
|
||||
}
|
||||
}
|
||||
|
||||
private int a(int i, int i2, int i3) {
|
||||
int i4 = 0;
|
||||
int i5 = 0;
|
||||
int i6 = 0;
|
||||
int i7 = 0;
|
||||
int i8 = 0;
|
||||
for (int i9 = i; i9 < this.p + i; i9++) {
|
||||
byte[] bArr = this.i;
|
||||
if (i9 >= bArr.length || i9 >= i2) {
|
||||
break;
|
||||
}
|
||||
int i10 = this.a[bArr[i9] & 255];
|
||||
if (i10 != 0) {
|
||||
i4 += (i10 >> 24) & 255;
|
||||
i5 += (i10 >> 16) & 255;
|
||||
i6 += (i10 >> 8) & 255;
|
||||
i7 += i10 & 255;
|
||||
i8++;
|
||||
}
|
||||
}
|
||||
int i11 = i + i3;
|
||||
for (int i12 = i11; i12 < this.p + i11; i12++) {
|
||||
byte[] bArr2 = this.i;
|
||||
if (i12 >= bArr2.length || i12 >= i2) {
|
||||
break;
|
||||
}
|
||||
int i13 = this.a[bArr2[i12] & 255];
|
||||
if (i13 != 0) {
|
||||
i4 += (i13 >> 24) & 255;
|
||||
i5 += (i13 >> 16) & 255;
|
||||
i6 += (i13 >> 8) & 255;
|
||||
i7 += i13 & 255;
|
||||
i8++;
|
||||
}
|
||||
}
|
||||
if (i8 == 0) {
|
||||
return 0;
|
||||
}
|
||||
return ((i4 / i8) << 24) | ((i5 / i8) << 16) | ((i6 / i8) << 8) | (i7 / i8);
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
package com.bumptech.glide.integration.okhttp3;
|
||||
|
||||
import android.content.Context;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.GlideBuilder;
|
||||
import com.bumptech.glide.Registry;
|
||||
import com.bumptech.glide.integration.okhttp3.OkHttpUrlLoader;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.module.GlideModule;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Deprecated
|
||||
/* loaded from: classes.dex */
|
||||
public class OkHttpGlideModule implements GlideModule {
|
||||
@Override // com.bumptech.glide.module.GlideModule
|
||||
public void applyOptions(Context context, GlideBuilder glideBuilder) {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.module.GlideModule
|
||||
public void registerComponents(Context context, Glide glide, Registry registry) {
|
||||
registry.b(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory());
|
||||
}
|
||||
}
|
@@ -0,0 +1,99 @@
|
||||
package com.bumptech.glide.integration.okhttp3;
|
||||
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.HttpException;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.util.ContentLengthInputStream;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
import okhttp3.ResponseBody;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OkHttpStreamFetcher implements DataFetcher<InputStream>, Callback {
|
||||
private final Call.Factory a;
|
||||
private final GlideUrl b;
|
||||
private InputStream c;
|
||||
private ResponseBody d;
|
||||
private DataFetcher.DataCallback<? super InputStream> e;
|
||||
private volatile Call f;
|
||||
|
||||
public OkHttpStreamFetcher(Call.Factory factory, GlideUrl glideUrl) {
|
||||
this.a = factory;
|
||||
this.b = glideUrl;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void a(Priority priority, DataFetcher.DataCallback<? super InputStream> dataCallback) {
|
||||
Request.Builder url = new Request.Builder().url(this.b.c());
|
||||
for (Map.Entry<String, String> entry : this.b.b().entrySet()) {
|
||||
url.addHeader(entry.getKey(), entry.getValue());
|
||||
}
|
||||
Request build = url.build();
|
||||
this.e = dataCallback;
|
||||
this.f = this.a.newCall(build);
|
||||
this.f.enqueue(this);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void b() {
|
||||
try {
|
||||
if (this.c != null) {
|
||||
this.c.close();
|
||||
}
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
ResponseBody responseBody = this.d;
|
||||
if (responseBody != null) {
|
||||
responseBody.close();
|
||||
}
|
||||
this.e = null;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void cancel() {
|
||||
Call call = this.f;
|
||||
if (call != null) {
|
||||
call.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.REMOTE;
|
||||
}
|
||||
|
||||
@Override // okhttp3.Callback
|
||||
public void onFailure(Call call, IOException iOException) {
|
||||
if (Log.isLoggable("OkHttpFetcher", 3)) {
|
||||
Log.d("OkHttpFetcher", "OkHttp failed to obtain result", iOException);
|
||||
}
|
||||
this.e.a((Exception) iOException);
|
||||
}
|
||||
|
||||
@Override // okhttp3.Callback
|
||||
public void onResponse(Call call, Response response) {
|
||||
this.d = response.body();
|
||||
if (!response.isSuccessful()) {
|
||||
this.e.a((Exception) new HttpException(response.message(), response.code()));
|
||||
return;
|
||||
}
|
||||
ResponseBody responseBody = this.d;
|
||||
Preconditions.a(responseBody);
|
||||
this.c = ContentLengthInputStream.a(this.d.byteStream(), responseBody.contentLength());
|
||||
this.e.a((DataFetcher.DataCallback<? super InputStream>) this.c);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,62 @@
|
||||
package com.bumptech.glide.integration.okhttp3;
|
||||
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import com.bumptech.glide.load.model.ModelLoaderFactory;
|
||||
import com.bumptech.glide.load.model.MultiModelLoaderFactory;
|
||||
import java.io.InputStream;
|
||||
import okhttp3.Call;
|
||||
import okhttp3.OkHttpClient;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class OkHttpUrlLoader implements ModelLoader<GlideUrl, InputStream> {
|
||||
private final Call.Factory a;
|
||||
|
||||
public static class Factory implements ModelLoaderFactory<GlideUrl, InputStream> {
|
||||
private static volatile Call.Factory b;
|
||||
private final Call.Factory a;
|
||||
|
||||
public Factory() {
|
||||
this(b());
|
||||
}
|
||||
|
||||
private static Call.Factory b() {
|
||||
if (b == null) {
|
||||
synchronized (Factory.class) {
|
||||
if (b == null) {
|
||||
b = new OkHttpClient();
|
||||
}
|
||||
}
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.model.ModelLoaderFactory
|
||||
public ModelLoader<GlideUrl, InputStream> a(MultiModelLoaderFactory multiModelLoaderFactory) {
|
||||
return new OkHttpUrlLoader(this.a);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.model.ModelLoaderFactory
|
||||
public void a() {
|
||||
}
|
||||
|
||||
public Factory(Call.Factory factory) {
|
||||
this.a = factory;
|
||||
}
|
||||
}
|
||||
|
||||
public OkHttpUrlLoader(Call.Factory factory) {
|
||||
this.a = factory;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.model.ModelLoader
|
||||
public boolean a(GlideUrl glideUrl) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.model.ModelLoader
|
||||
public ModelLoader.LoadData<InputStream> a(GlideUrl glideUrl, int i, int i2, Options options) {
|
||||
return new ModelLoader.LoadData<>(glideUrl, new OkHttpStreamFetcher(this.a, glideUrl));
|
||||
}
|
||||
}
|
10
sources/com/bumptech/glide/load/DataSource.java
Normal file
10
sources/com/bumptech/glide/load/DataSource.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum DataSource {
|
||||
LOCAL,
|
||||
REMOTE,
|
||||
DATA_DISK_CACHE,
|
||||
RESOURCE_DISK_CACHE,
|
||||
MEMORY_CACHE
|
||||
}
|
10
sources/com/bumptech/glide/load/DecodeFormat.java
Normal file
10
sources/com/bumptech/glide/load/DecodeFormat.java
Normal file
@@ -0,0 +1,10 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum DecodeFormat {
|
||||
PREFER_ARGB_8888,
|
||||
PREFER_ARGB_8888_DISALLOW_HARDWARE,
|
||||
PREFER_RGB_565;
|
||||
|
||||
public static final DecodeFormat DEFAULT = PREFER_ARGB_8888_DISALLOW_HARDWARE;
|
||||
}
|
8
sources/com/bumptech/glide/load/EncodeStrategy.java
Normal file
8
sources/com/bumptech/glide/load/EncodeStrategy.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public enum EncodeStrategy {
|
||||
SOURCE,
|
||||
TRANSFORMED,
|
||||
NONE
|
||||
}
|
8
sources/com/bumptech/glide/load/Encoder.java
Normal file
8
sources/com/bumptech/glide/load/Encoder.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Encoder<T> {
|
||||
boolean a(T t, File file, Options options);
|
||||
}
|
31
sources/com/bumptech/glide/load/HttpException.java
Normal file
31
sources/com/bumptech/glide/load/HttpException.java
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class HttpException extends IOException {
|
||||
public static final int UNKNOWN = -1;
|
||||
private static final long serialVersionUID = 1;
|
||||
private final int statusCode;
|
||||
|
||||
public HttpException(int i) {
|
||||
this("Http request failed with status code: " + i, i);
|
||||
}
|
||||
|
||||
public int getStatusCode() {
|
||||
return this.statusCode;
|
||||
}
|
||||
|
||||
public HttpException(String str) {
|
||||
this(str, -1);
|
||||
}
|
||||
|
||||
public HttpException(String str, int i) {
|
||||
this(str, i, null);
|
||||
}
|
||||
|
||||
public HttpException(String str, int i, Throwable th) {
|
||||
super(str, th);
|
||||
this.statusCode = i;
|
||||
}
|
||||
}
|
37
sources/com/bumptech/glide/load/ImageHeaderParser.java
Normal file
37
sources/com/bumptech/glide/load/ImageHeaderParser.java
Normal file
@@ -0,0 +1,37 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ImageHeaderParser {
|
||||
|
||||
public enum ImageType {
|
||||
GIF(true),
|
||||
JPEG(false),
|
||||
RAW(false),
|
||||
PNG_A(true),
|
||||
PNG(false),
|
||||
WEBP_A(true),
|
||||
WEBP(false),
|
||||
UNKNOWN(false);
|
||||
|
||||
private final boolean hasAlpha;
|
||||
|
||||
ImageType(boolean z) {
|
||||
this.hasAlpha = z;
|
||||
}
|
||||
|
||||
public boolean hasAlpha() {
|
||||
return this.hasAlpha;
|
||||
}
|
||||
}
|
||||
|
||||
int a(InputStream inputStream, ArrayPool arrayPool) throws IOException;
|
||||
|
||||
ImageType a(InputStream inputStream) throws IOException;
|
||||
|
||||
ImageType a(ByteBuffer byteBuffer) throws IOException;
|
||||
}
|
72
sources/com/bumptech/glide/load/ImageHeaderParserUtils.java
Normal file
72
sources/com/bumptech/glide/load/ImageHeaderParserUtils.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import com.bumptech.glide.load.ImageHeaderParser;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ImageHeaderParserUtils {
|
||||
public static ImageHeaderParser.ImageType a(List<ImageHeaderParser> list, ByteBuffer byteBuffer) throws IOException {
|
||||
if (byteBuffer == null) {
|
||||
return ImageHeaderParser.ImageType.UNKNOWN;
|
||||
}
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ImageHeaderParser.ImageType a = list.get(i).a(byteBuffer);
|
||||
if (a != ImageHeaderParser.ImageType.UNKNOWN) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
return ImageHeaderParser.ImageType.UNKNOWN;
|
||||
}
|
||||
|
||||
public static ImageHeaderParser.ImageType b(List<ImageHeaderParser> list, InputStream inputStream, ArrayPool arrayPool) throws IOException {
|
||||
if (inputStream == null) {
|
||||
return ImageHeaderParser.ImageType.UNKNOWN;
|
||||
}
|
||||
if (!inputStream.markSupported()) {
|
||||
inputStream = new RecyclableBufferedInputStream(inputStream, arrayPool);
|
||||
}
|
||||
inputStream.mark(5242880);
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
try {
|
||||
ImageHeaderParser.ImageType a = list.get(i).a(inputStream);
|
||||
if (a != ImageHeaderParser.ImageType.UNKNOWN) {
|
||||
return a;
|
||||
}
|
||||
inputStream.reset();
|
||||
} finally {
|
||||
inputStream.reset();
|
||||
}
|
||||
}
|
||||
return ImageHeaderParser.ImageType.UNKNOWN;
|
||||
}
|
||||
|
||||
public static int a(List<ImageHeaderParser> list, InputStream inputStream, ArrayPool arrayPool) throws IOException {
|
||||
if (inputStream == null) {
|
||||
return -1;
|
||||
}
|
||||
if (!inputStream.markSupported()) {
|
||||
inputStream = new RecyclableBufferedInputStream(inputStream, arrayPool);
|
||||
}
|
||||
inputStream.mark(5242880);
|
||||
int size = list.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
try {
|
||||
int a = list.get(i).a(inputStream, arrayPool);
|
||||
if (a != -1) {
|
||||
return a;
|
||||
}
|
||||
inputStream.reset();
|
||||
} finally {
|
||||
inputStream.reset();
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
15
sources/com/bumptech/glide/load/Key.java
Normal file
15
sources/com/bumptech/glide/load/Key.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Key {
|
||||
public static final Charset a = Charset.forName("UTF-8");
|
||||
|
||||
void a(MessageDigest messageDigest);
|
||||
|
||||
boolean equals(Object obj);
|
||||
|
||||
int hashCode();
|
||||
}
|
75
sources/com/bumptech/glide/load/Option.java
Normal file
75
sources/com/bumptech/glide/load/Option.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Option<T> {
|
||||
private static final CacheKeyUpdater<Object> e = new CacheKeyUpdater<Object>() { // from class: com.bumptech.glide.load.Option.1
|
||||
@Override // com.bumptech.glide.load.Option.CacheKeyUpdater
|
||||
public void a(byte[] bArr, Object obj, MessageDigest messageDigest) {
|
||||
}
|
||||
};
|
||||
private final T a;
|
||||
private final CacheKeyUpdater<T> b;
|
||||
private final String c;
|
||||
private volatile byte[] d;
|
||||
|
||||
public interface CacheKeyUpdater<T> {
|
||||
void a(byte[] bArr, T t, MessageDigest messageDigest);
|
||||
}
|
||||
|
||||
private Option(String str, T t, CacheKeyUpdater<T> cacheKeyUpdater) {
|
||||
Preconditions.a(str);
|
||||
this.c = str;
|
||||
this.a = t;
|
||||
Preconditions.a(cacheKeyUpdater);
|
||||
this.b = cacheKeyUpdater;
|
||||
}
|
||||
|
||||
public static <T> Option<T> a(String str) {
|
||||
return new Option<>(str, null, b());
|
||||
}
|
||||
|
||||
private static <T> CacheKeyUpdater<T> b() {
|
||||
return (CacheKeyUpdater<T>) e;
|
||||
}
|
||||
|
||||
private byte[] c() {
|
||||
if (this.d == null) {
|
||||
this.d = this.c.getBytes(Key.a);
|
||||
}
|
||||
return this.d;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Option) {
|
||||
return this.c.equals(((Option) obj).c);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return this.c.hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Option{key='" + this.c + "'}";
|
||||
}
|
||||
|
||||
public static <T> Option<T> a(String str, T t) {
|
||||
return new Option<>(str, t, b());
|
||||
}
|
||||
|
||||
public static <T> Option<T> a(String str, T t, CacheKeyUpdater<T> cacheKeyUpdater) {
|
||||
return new Option<>(str, t, cacheKeyUpdater);
|
||||
}
|
||||
|
||||
public T a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
public void a(T t, MessageDigest messageDigest) {
|
||||
this.b.a(c(), t, messageDigest);
|
||||
}
|
||||
}
|
53
sources/com/bumptech/glide/load/Options.java
Normal file
53
sources/com/bumptech/glide/load/Options.java
Normal file
@@ -0,0 +1,53 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import androidx.collection.ArrayMap;
|
||||
import androidx.collection.SimpleArrayMap;
|
||||
import com.bumptech.glide.util.CachedHashCodeArrayMap;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class Options implements Key {
|
||||
private final ArrayMap<Option<?>, Object> b = new CachedHashCodeArrayMap();
|
||||
|
||||
public void a(Options options) {
|
||||
this.b.a((SimpleArrayMap<? extends Option<?>, ? extends Object>) options.b);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof Options) {
|
||||
return this.b.equals(((Options) obj).b);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public int hashCode() {
|
||||
return this.b.hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Options{values=" + this.b + '}';
|
||||
}
|
||||
|
||||
public <T> Options a(Option<T> option, T t) {
|
||||
this.b.put(option, t);
|
||||
return this;
|
||||
}
|
||||
|
||||
public <T> T a(Option<T> option) {
|
||||
return this.b.containsKey(option) ? (T) this.b.get(option) : option.a();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
for (int i = 0; i < this.b.size(); i++) {
|
||||
a(this.b.b(i), this.b.d(i), messageDigest);
|
||||
}
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private static <T> void a(Option<T> option, Object obj, MessageDigest messageDigest) {
|
||||
option.a((Option<T>) obj, messageDigest);
|
||||
}
|
||||
}
|
11
sources/com/bumptech/glide/load/ResourceDecoder.java
Normal file
11
sources/com/bumptech/glide/load/ResourceDecoder.java
Normal file
@@ -0,0 +1,11 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ResourceDecoder<T, Z> {
|
||||
Resource<Z> a(T t, int i, int i2, Options options) throws IOException;
|
||||
|
||||
boolean a(T t, Options options) throws IOException;
|
||||
}
|
8
sources/com/bumptech/glide/load/ResourceEncoder.java
Normal file
8
sources/com/bumptech/glide/load/ResourceEncoder.java
Normal file
@@ -0,0 +1,8 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ResourceEncoder<T> extends Encoder<Resource<T>> {
|
||||
EncodeStrategy a(Options options);
|
||||
}
|
9
sources/com/bumptech/glide/load/Transformation.java
Normal file
9
sources/com/bumptech/glide/load/Transformation.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package com.bumptech.glide.load;
|
||||
|
||||
import android.content.Context;
|
||||
import com.bumptech.glide.load.engine.Resource;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Transformation<T> extends Key {
|
||||
Resource<T> a(Context context, Resource<T> resource, int i, int i2);
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.net.Uri;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class AssetFileDescriptorLocalUriFetcher extends LocalUriFetcher<AssetFileDescriptor> {
|
||||
public AssetFileDescriptorLocalUriFetcher(ContentResolver contentResolver, Uri uri) {
|
||||
super(contentResolver, uri);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public AssetFileDescriptor a(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
||||
AssetFileDescriptor openAssetFileDescriptor = contentResolver.openAssetFileDescriptor(uri, "r");
|
||||
if (openAssetFileDescriptor != null) {
|
||||
return openAssetFileDescriptor;
|
||||
}
|
||||
throw new FileNotFoundException("FileDescriptor is null for: " + uri);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public void a(AssetFileDescriptor assetFileDescriptor) throws IOException {
|
||||
assetFileDescriptor.close();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<AssetFileDescriptor> a() {
|
||||
return AssetFileDescriptor.class;
|
||||
}
|
||||
}
|
58
sources/com/bumptech/glide/load/data/AssetPathFetcher.java
Normal file
58
sources/com/bumptech/glide/load/data/AssetPathFetcher.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AssetPathFetcher<T> implements DataFetcher<T> {
|
||||
private final String a;
|
||||
private final AssetManager b;
|
||||
private T c;
|
||||
|
||||
public AssetPathFetcher(AssetManager assetManager, String str) {
|
||||
this.b = assetManager;
|
||||
this.a = str;
|
||||
}
|
||||
|
||||
protected abstract T a(AssetManager assetManager, String str) throws IOException;
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void a(Priority priority, DataFetcher.DataCallback<? super T> dataCallback) {
|
||||
try {
|
||||
this.c = a(this.b, this.a);
|
||||
dataCallback.a((DataFetcher.DataCallback<? super T>) this.c);
|
||||
} catch (IOException e) {
|
||||
if (Log.isLoggable("AssetPathFetcher", 3)) {
|
||||
Log.d("AssetPathFetcher", "Failed to load data from asset manager", e);
|
||||
}
|
||||
dataCallback.a((Exception) e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void a(T t) throws IOException;
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void b() {
|
||||
T t = this.c;
|
||||
if (t == null) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
a(t);
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.LOCAL;
|
||||
}
|
||||
}
|
@@ -0,0 +1,95 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class BufferedOutputStream extends OutputStream {
|
||||
private final OutputStream a;
|
||||
private byte[] b;
|
||||
private ArrayPool c;
|
||||
private int d;
|
||||
|
||||
public BufferedOutputStream(OutputStream outputStream, ArrayPool arrayPool) {
|
||||
this(outputStream, arrayPool, 65536);
|
||||
}
|
||||
|
||||
private void a() throws IOException {
|
||||
int i = this.d;
|
||||
if (i > 0) {
|
||||
this.a.write(this.b, 0, i);
|
||||
this.d = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void b() throws IOException {
|
||||
if (this.d == this.b.length) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
private void c() {
|
||||
byte[] bArr = this.b;
|
||||
if (bArr != null) {
|
||||
this.c.put(bArr);
|
||||
this.b = null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.io.OutputStream, java.io.Closeable, java.lang.AutoCloseable
|
||||
public void close() throws IOException {
|
||||
try {
|
||||
flush();
|
||||
this.a.close();
|
||||
c();
|
||||
} catch (Throwable th) {
|
||||
this.a.close();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.io.OutputStream, java.io.Flushable
|
||||
public void flush() throws IOException {
|
||||
a();
|
||||
this.a.flush();
|
||||
}
|
||||
|
||||
@Override // java.io.OutputStream
|
||||
public void write(int i) throws IOException {
|
||||
byte[] bArr = this.b;
|
||||
int i2 = this.d;
|
||||
this.d = i2 + 1;
|
||||
bArr[i2] = (byte) i;
|
||||
b();
|
||||
}
|
||||
|
||||
BufferedOutputStream(OutputStream outputStream, ArrayPool arrayPool, int i) {
|
||||
this.a = outputStream;
|
||||
this.c = arrayPool;
|
||||
this.b = (byte[]) arrayPool.b(i, byte[].class);
|
||||
}
|
||||
|
||||
@Override // java.io.OutputStream
|
||||
public void write(byte[] bArr) throws IOException {
|
||||
write(bArr, 0, bArr.length);
|
||||
}
|
||||
|
||||
@Override // java.io.OutputStream
|
||||
public void write(byte[] bArr, int i, int i2) throws IOException {
|
||||
int i3 = 0;
|
||||
do {
|
||||
int i4 = i2 - i3;
|
||||
int i5 = i + i3;
|
||||
if (this.d == 0 && i4 >= this.b.length) {
|
||||
this.a.write(bArr, i5, i4);
|
||||
return;
|
||||
}
|
||||
int min = Math.min(i4, this.b.length - this.d);
|
||||
System.arraycopy(bArr, i5, this.b, this.d, min);
|
||||
this.d += min;
|
||||
i3 += min;
|
||||
b();
|
||||
} while (i3 < i2);
|
||||
}
|
||||
}
|
24
sources/com/bumptech/glide/load/data/DataFetcher.java
Normal file
24
sources/com/bumptech/glide/load/data/DataFetcher.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DataFetcher<T> {
|
||||
|
||||
public interface DataCallback<T> {
|
||||
void a(Exception exc);
|
||||
|
||||
void a(T t);
|
||||
}
|
||||
|
||||
Class<T> a();
|
||||
|
||||
void a(Priority priority, DataCallback<? super T> dataCallback);
|
||||
|
||||
void b();
|
||||
|
||||
void cancel();
|
||||
|
||||
DataSource getDataSource();
|
||||
}
|
17
sources/com/bumptech/glide/load/data/DataRewinder.java
Normal file
17
sources/com/bumptech/glide/load/data/DataRewinder.java
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DataRewinder<T> {
|
||||
|
||||
public interface Factory<T> {
|
||||
DataRewinder<T> a(T t);
|
||||
|
||||
Class<T> a();
|
||||
}
|
||||
|
||||
T a() throws IOException;
|
||||
|
||||
void b();
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DataRewinderRegistry {
|
||||
private static final DataRewinder.Factory<?> b = new DataRewinder.Factory<Object>() { // from class: com.bumptech.glide.load.data.DataRewinderRegistry.1
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder.Factory
|
||||
public DataRewinder<Object> a(Object obj) {
|
||||
return new DefaultRewinder(obj);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder.Factory
|
||||
public Class<Object> a() {
|
||||
throw new UnsupportedOperationException("Not implemented");
|
||||
}
|
||||
};
|
||||
private final Map<Class<?>, DataRewinder.Factory<?>> a = new HashMap();
|
||||
|
||||
private static final class DefaultRewinder implements DataRewinder<Object> {
|
||||
private final Object a;
|
||||
|
||||
DefaultRewinder(Object obj) {
|
||||
this.a = obj;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder
|
||||
public Object a() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder
|
||||
public void b() {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void a(DataRewinder.Factory<?> factory) {
|
||||
this.a.put(factory.a(), factory);
|
||||
}
|
||||
|
||||
public synchronized <T> DataRewinder<T> a(T t) {
|
||||
DataRewinder.Factory<?> factory;
|
||||
Preconditions.a(t);
|
||||
factory = this.a.get(t.getClass());
|
||||
if (factory == null) {
|
||||
Iterator<DataRewinder.Factory<?>> it = this.a.values().iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
DataRewinder.Factory<?> next = it.next();
|
||||
if (next.a().isAssignableFrom(t.getClass())) {
|
||||
factory = next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (factory == null) {
|
||||
factory = b;
|
||||
}
|
||||
return (DataRewinder<T>) factory.a(t);
|
||||
}
|
||||
}
|
@@ -0,0 +1,81 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import java.io.FilterInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ExifOrientationStream extends FilterInputStream {
|
||||
private static final byte[] c = {-1, -31, 0, 28, 69, 120, 105, 102, 0, 0, 77, 77, 0, 0, 0, 0, 0, 8, 0, 1, 1, 18, 0, 2, 0, 0, 0, 1, 0};
|
||||
private static final int d = c.length;
|
||||
private static final int e = d + 2;
|
||||
private final byte a;
|
||||
private int b;
|
||||
|
||||
public ExifOrientationStream(InputStream inputStream, int i) {
|
||||
super(inputStream);
|
||||
if (i >= -1 && i <= 8) {
|
||||
this.a = (byte) i;
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot add invalid orientation: " + i);
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public void mark(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public boolean markSupported() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public int read() throws IOException {
|
||||
int i;
|
||||
int i2 = this.b;
|
||||
int read = (i2 < 2 || i2 > (i = e)) ? super.read() : i2 == i ? this.a : c[i2 - 2] & 255;
|
||||
if (read != -1) {
|
||||
this.b++;
|
||||
}
|
||||
return read;
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public void reset() throws IOException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public long skip(long j) throws IOException {
|
||||
long skip = super.skip(j);
|
||||
if (skip > 0) {
|
||||
this.b = (int) (this.b + skip);
|
||||
}
|
||||
return skip;
|
||||
}
|
||||
|
||||
@Override // java.io.FilterInputStream, java.io.InputStream
|
||||
public int read(byte[] bArr, int i, int i2) throws IOException {
|
||||
int i3;
|
||||
int i4 = this.b;
|
||||
int i5 = e;
|
||||
if (i4 > i5) {
|
||||
i3 = super.read(bArr, i, i2);
|
||||
} else if (i4 == i5) {
|
||||
bArr[i] = this.a;
|
||||
i3 = 1;
|
||||
} else if (i4 < 2) {
|
||||
i3 = super.read(bArr, i, 2 - i4);
|
||||
} else {
|
||||
int min = Math.min(i5 - i4, i2);
|
||||
System.arraycopy(c, this.b - 2, bArr, i, min);
|
||||
i3 = min;
|
||||
}
|
||||
if (i3 > 0) {
|
||||
this.b += i3;
|
||||
}
|
||||
return i3;
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FileDescriptorAssetPathFetcher extends AssetPathFetcher<ParcelFileDescriptor> {
|
||||
public FileDescriptorAssetPathFetcher(AssetManager assetManager, String str) {
|
||||
super(assetManager, str);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.AssetPathFetcher
|
||||
public ParcelFileDescriptor a(AssetManager assetManager, String str) throws IOException {
|
||||
return assetManager.openFd(str).getParcelFileDescriptor();
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.data.AssetPathFetcher
|
||||
public void a(ParcelFileDescriptor parcelFileDescriptor) throws IOException {
|
||||
parcelFileDescriptor.close();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<ParcelFileDescriptor> a() {
|
||||
return ParcelFileDescriptor.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.res.AssetFileDescriptor;
|
||||
import android.net.Uri;
|
||||
import android.os.ParcelFileDescriptor;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class FileDescriptorLocalUriFetcher extends LocalUriFetcher<ParcelFileDescriptor> {
|
||||
public FileDescriptorLocalUriFetcher(ContentResolver contentResolver, Uri uri) {
|
||||
super(contentResolver, uri);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public ParcelFileDescriptor a(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
||||
AssetFileDescriptor openAssetFileDescriptor = contentResolver.openAssetFileDescriptor(uri, "r");
|
||||
if (openAssetFileDescriptor != null) {
|
||||
return openAssetFileDescriptor.getParcelFileDescriptor();
|
||||
}
|
||||
throw new FileNotFoundException("FileDescriptor is null for: " + uri);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public void a(ParcelFileDescriptor parcelFileDescriptor) throws IOException {
|
||||
parcelFileDescriptor.close();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<ParcelFileDescriptor> a() {
|
||||
return ParcelFileDescriptor.class;
|
||||
}
|
||||
}
|
180
sources/com/bumptech/glide/load/data/HttpUrlFetcher.java
Normal file
180
sources/com/bumptech/glide/load/data/HttpUrlFetcher.java
Normal file
@@ -0,0 +1,180 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.HttpException;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.model.GlideUrl;
|
||||
import com.bumptech.glide.util.ContentLengthInputStream;
|
||||
import com.bumptech.glide.util.LogTime;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class HttpUrlFetcher implements DataFetcher<InputStream> {
|
||||
static final HttpUrlConnectionFactory g = new DefaultHttpUrlConnectionFactory();
|
||||
private final GlideUrl a;
|
||||
private final int b;
|
||||
private final HttpUrlConnectionFactory c;
|
||||
private HttpURLConnection d;
|
||||
private InputStream e;
|
||||
private volatile boolean f;
|
||||
|
||||
private static class DefaultHttpUrlConnectionFactory implements HttpUrlConnectionFactory {
|
||||
DefaultHttpUrlConnectionFactory() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.HttpUrlFetcher.HttpUrlConnectionFactory
|
||||
public HttpURLConnection a(URL url) throws IOException {
|
||||
return (HttpURLConnection) url.openConnection();
|
||||
}
|
||||
}
|
||||
|
||||
interface HttpUrlConnectionFactory {
|
||||
HttpURLConnection a(URL url) throws IOException;
|
||||
}
|
||||
|
||||
public HttpUrlFetcher(GlideUrl glideUrl, int i) {
|
||||
this(glideUrl, i, g);
|
||||
}
|
||||
|
||||
private static boolean b(int i) {
|
||||
return i / 100 == 3;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void a(Priority priority, DataFetcher.DataCallback<? super InputStream> dataCallback) {
|
||||
StringBuilder sb;
|
||||
long a = LogTime.a();
|
||||
try {
|
||||
try {
|
||||
dataCallback.a((DataFetcher.DataCallback<? super InputStream>) a(this.a.d(), 0, null, this.a.b()));
|
||||
} catch (IOException e) {
|
||||
if (Log.isLoggable("HttpUrlFetcher", 3)) {
|
||||
Log.d("HttpUrlFetcher", "Failed to load data for url", e);
|
||||
}
|
||||
dataCallback.a((Exception) e);
|
||||
if (!Log.isLoggable("HttpUrlFetcher", 2)) {
|
||||
return;
|
||||
} else {
|
||||
sb = new StringBuilder();
|
||||
}
|
||||
}
|
||||
if (Log.isLoggable("HttpUrlFetcher", 2)) {
|
||||
sb = new StringBuilder();
|
||||
sb.append("Finished http url fetcher fetch in ");
|
||||
sb.append(LogTime.a(a));
|
||||
Log.v("HttpUrlFetcher", sb.toString());
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (Log.isLoggable("HttpUrlFetcher", 2)) {
|
||||
Log.v("HttpUrlFetcher", "Finished http url fetcher fetch in " + LogTime.a(a));
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void cancel() {
|
||||
this.f = true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.REMOTE;
|
||||
}
|
||||
|
||||
HttpUrlFetcher(GlideUrl glideUrl, int i, HttpUrlConnectionFactory httpUrlConnectionFactory) {
|
||||
this.a = glideUrl;
|
||||
this.b = i;
|
||||
this.c = httpUrlConnectionFactory;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void b() {
|
||||
InputStream inputStream = this.e;
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
HttpURLConnection httpURLConnection = this.d;
|
||||
if (httpURLConnection != null) {
|
||||
httpURLConnection.disconnect();
|
||||
}
|
||||
this.d = null;
|
||||
}
|
||||
|
||||
private InputStream a(URL url, int i, URL url2, Map<String, String> map) throws IOException {
|
||||
if (i < 5) {
|
||||
if (url2 != null) {
|
||||
try {
|
||||
if (url.toURI().equals(url2.toURI())) {
|
||||
throw new HttpException("In re-direct loop");
|
||||
}
|
||||
} catch (URISyntaxException unused) {
|
||||
}
|
||||
}
|
||||
this.d = this.c.a(url);
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
this.d.addRequestProperty(entry.getKey(), entry.getValue());
|
||||
}
|
||||
this.d.setConnectTimeout(this.b);
|
||||
this.d.setReadTimeout(this.b);
|
||||
this.d.setUseCaches(false);
|
||||
this.d.setDoInput(true);
|
||||
this.d.setInstanceFollowRedirects(false);
|
||||
this.d.connect();
|
||||
this.e = this.d.getInputStream();
|
||||
if (this.f) {
|
||||
return null;
|
||||
}
|
||||
int responseCode = this.d.getResponseCode();
|
||||
if (a(responseCode)) {
|
||||
return a(this.d);
|
||||
}
|
||||
if (!b(responseCode)) {
|
||||
if (responseCode == -1) {
|
||||
throw new HttpException(responseCode);
|
||||
}
|
||||
throw new HttpException(this.d.getResponseMessage(), responseCode);
|
||||
}
|
||||
String headerField = this.d.getHeaderField("Location");
|
||||
if (!TextUtils.isEmpty(headerField)) {
|
||||
URL url3 = new URL(url, headerField);
|
||||
b();
|
||||
return a(url3, i + 1, url, map);
|
||||
}
|
||||
throw new HttpException("Received empty or null redirect url");
|
||||
}
|
||||
throw new HttpException("Too many (> 5) redirects!");
|
||||
}
|
||||
|
||||
private static boolean a(int i) {
|
||||
return i / 100 == 2;
|
||||
}
|
||||
|
||||
private InputStream a(HttpURLConnection httpURLConnection) throws IOException {
|
||||
if (TextUtils.isEmpty(httpURLConnection.getContentEncoding())) {
|
||||
this.e = ContentLengthInputStream.a(httpURLConnection.getInputStream(), httpURLConnection.getContentLength());
|
||||
} else {
|
||||
if (Log.isLoggable("HttpUrlFetcher", 3)) {
|
||||
Log.d("HttpUrlFetcher", "Got non empty content encoding: " + httpURLConnection.getContentEncoding());
|
||||
}
|
||||
this.e = httpURLConnection.getInputStream();
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,47 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.RecyclableBufferedInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class InputStreamRewinder implements DataRewinder<InputStream> {
|
||||
private final RecyclableBufferedInputStream a;
|
||||
|
||||
public static final class Factory implements DataRewinder.Factory<InputStream> {
|
||||
private final ArrayPool a;
|
||||
|
||||
public Factory(ArrayPool arrayPool) {
|
||||
this.a = arrayPool;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder.Factory
|
||||
public DataRewinder<InputStream> a(InputStream inputStream) {
|
||||
return new InputStreamRewinder(inputStream, this.a);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder.Factory
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
||||
|
||||
InputStreamRewinder(InputStream inputStream, ArrayPool arrayPool) {
|
||||
this.a = new RecyclableBufferedInputStream(inputStream, arrayPool);
|
||||
this.a.mark(5242880);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder
|
||||
public void b() {
|
||||
this.a.b();
|
||||
}
|
||||
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.DataRewinder
|
||||
public InputStream a() throws IOException {
|
||||
this.a.reset();
|
||||
return this.a;
|
||||
}
|
||||
}
|
59
sources/com/bumptech/glide/load/data/LocalUriFetcher.java
Normal file
59
sources/com/bumptech/glide/load/data/LocalUriFetcher.java
Normal file
@@ -0,0 +1,59 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class LocalUriFetcher<T> implements DataFetcher<T> {
|
||||
private final Uri a;
|
||||
private final ContentResolver b;
|
||||
private T c;
|
||||
|
||||
public LocalUriFetcher(ContentResolver contentResolver, Uri uri) {
|
||||
this.b = contentResolver;
|
||||
this.a = uri;
|
||||
}
|
||||
|
||||
protected abstract T a(Uri uri, ContentResolver contentResolver) throws FileNotFoundException;
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public final void a(Priority priority, DataFetcher.DataCallback<? super T> dataCallback) {
|
||||
try {
|
||||
this.c = a(this.a, this.b);
|
||||
dataCallback.a((DataFetcher.DataCallback<? super T>) this.c);
|
||||
} catch (FileNotFoundException e) {
|
||||
if (Log.isLoggable("LocalUriFetcher", 3)) {
|
||||
Log.d("LocalUriFetcher", "Failed to open Uri", e);
|
||||
}
|
||||
dataCallback.a((Exception) e);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void a(T t) throws IOException;
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void b() {
|
||||
T t = this.c;
|
||||
if (t != null) {
|
||||
try {
|
||||
a(t);
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.LOCAL;
|
||||
}
|
||||
}
|
@@ -0,0 +1,30 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.res.AssetManager;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StreamAssetPathFetcher extends AssetPathFetcher<InputStream> {
|
||||
public StreamAssetPathFetcher(AssetManager assetManager, String str) {
|
||||
super(assetManager, str);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.AssetPathFetcher
|
||||
public InputStream a(AssetManager assetManager, String str) throws IOException {
|
||||
return assetManager.open(str);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.data.AssetPathFetcher
|
||||
public void a(InputStream inputStream) throws IOException {
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,70 @@
|
||||
package com.bumptech.glide.load.data;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.UriMatcher;
|
||||
import android.net.Uri;
|
||||
import android.provider.ContactsContract;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class StreamLocalUriFetcher extends LocalUriFetcher<InputStream> {
|
||||
private static final UriMatcher d = new UriMatcher(-1);
|
||||
|
||||
static {
|
||||
d.addURI("com.android.contacts", "contacts/lookup/*/#", 1);
|
||||
d.addURI("com.android.contacts", "contacts/lookup/*", 1);
|
||||
d.addURI("com.android.contacts", "contacts/#/photo", 2);
|
||||
d.addURI("com.android.contacts", "contacts/#", 3);
|
||||
d.addURI("com.android.contacts", "contacts/#/display_photo", 4);
|
||||
d.addURI("com.android.contacts", "phone_lookup/*", 5);
|
||||
}
|
||||
|
||||
public StreamLocalUriFetcher(ContentResolver contentResolver, Uri uri) {
|
||||
super(contentResolver, uri);
|
||||
}
|
||||
|
||||
private InputStream b(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
||||
int match = d.match(uri);
|
||||
if (match != 1) {
|
||||
if (match == 3) {
|
||||
return a(contentResolver, uri);
|
||||
}
|
||||
if (match != 5) {
|
||||
return contentResolver.openInputStream(uri);
|
||||
}
|
||||
}
|
||||
Uri lookupContact = ContactsContract.Contacts.lookupContact(contentResolver, uri);
|
||||
if (lookupContact != null) {
|
||||
return a(contentResolver, lookupContact);
|
||||
}
|
||||
throw new FileNotFoundException("Contact cannot be found");
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public InputStream a(Uri uri, ContentResolver contentResolver) throws FileNotFoundException {
|
||||
InputStream b = b(uri, contentResolver);
|
||||
if (b != null) {
|
||||
return b;
|
||||
}
|
||||
throw new FileNotFoundException("InputStream is null for " + uri);
|
||||
}
|
||||
|
||||
private InputStream a(ContentResolver contentResolver, Uri uri) {
|
||||
return ContactsContract.Contacts.openContactPhotoInputStream(contentResolver, uri, true);
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.data.LocalUriFetcher
|
||||
public void a(InputStream inputStream) throws IOException {
|
||||
inputStream.close();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.bumptech.glide.load.data.mediastore;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class FileService {
|
||||
FileService() {
|
||||
}
|
||||
|
||||
public boolean a(File file) {
|
||||
return file.exists();
|
||||
}
|
||||
|
||||
public long b(File file) {
|
||||
return file.length();
|
||||
}
|
||||
|
||||
public File a(String str) {
|
||||
return new File(str);
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.bumptech.glide.load.data.mediastore;
|
||||
|
||||
import android.net.Uri;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class MediaStoreUtil {
|
||||
public static boolean a(int i, int i2) {
|
||||
return i != Integer.MIN_VALUE && i2 != Integer.MIN_VALUE && i <= 512 && i2 <= 384;
|
||||
}
|
||||
|
||||
public static boolean a(Uri uri) {
|
||||
return b(uri) && !d(uri);
|
||||
}
|
||||
|
||||
public static boolean b(Uri uri) {
|
||||
return uri != null && "content".equals(uri.getScheme()) && "media".equals(uri.getAuthority());
|
||||
}
|
||||
|
||||
public static boolean c(Uri uri) {
|
||||
return b(uri) && d(uri);
|
||||
}
|
||||
|
||||
private static boolean d(Uri uri) {
|
||||
return uri.getPathSegments().contains("video");
|
||||
}
|
||||
}
|
@@ -0,0 +1,112 @@
|
||||
package com.bumptech.glide.load.data.mediastore;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.Glide;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.data.ExifOrientationStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class ThumbFetcher implements DataFetcher<InputStream> {
|
||||
private final Uri a;
|
||||
private final ThumbnailStreamOpener b;
|
||||
private InputStream c;
|
||||
|
||||
static class ImageThumbnailQuery implements ThumbnailQuery {
|
||||
private static final String[] b = {"_data"};
|
||||
private final ContentResolver a;
|
||||
|
||||
ImageThumbnailQuery(ContentResolver contentResolver) {
|
||||
this.a = contentResolver;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.mediastore.ThumbnailQuery
|
||||
public Cursor a(Uri uri) {
|
||||
return this.a.query(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, b, "kind = 1 AND image_id = ?", new String[]{uri.getLastPathSegment()}, null);
|
||||
}
|
||||
}
|
||||
|
||||
static class VideoThumbnailQuery implements ThumbnailQuery {
|
||||
private static final String[] b = {"_data"};
|
||||
private final ContentResolver a;
|
||||
|
||||
VideoThumbnailQuery(ContentResolver contentResolver) {
|
||||
this.a = contentResolver;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.mediastore.ThumbnailQuery
|
||||
public Cursor a(Uri uri) {
|
||||
return this.a.query(MediaStore.Video.Thumbnails.EXTERNAL_CONTENT_URI, b, "kind = 1 AND video_id = ?", new String[]{uri.getLastPathSegment()}, null);
|
||||
}
|
||||
}
|
||||
|
||||
ThumbFetcher(Uri uri, ThumbnailStreamOpener thumbnailStreamOpener) {
|
||||
this.a = uri;
|
||||
this.b = thumbnailStreamOpener;
|
||||
}
|
||||
|
||||
public static ThumbFetcher a(Context context, Uri uri) {
|
||||
return a(context, uri, new ImageThumbnailQuery(context.getContentResolver()));
|
||||
}
|
||||
|
||||
public static ThumbFetcher b(Context context, Uri uri) {
|
||||
return a(context, uri, new VideoThumbnailQuery(context.getContentResolver()));
|
||||
}
|
||||
|
||||
private InputStream c() throws FileNotFoundException {
|
||||
InputStream b = this.b.b(this.a);
|
||||
int a = b != null ? this.b.a(this.a) : -1;
|
||||
return a != -1 ? new ExifOrientationStream(b, a) : b;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void cancel() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public DataSource getDataSource() {
|
||||
return DataSource.LOCAL;
|
||||
}
|
||||
|
||||
private static ThumbFetcher a(Context context, Uri uri, ThumbnailQuery thumbnailQuery) {
|
||||
return new ThumbFetcher(uri, new ThumbnailStreamOpener(Glide.b(context).h().a(), thumbnailQuery, Glide.b(context).c(), context.getContentResolver()));
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void b() {
|
||||
InputStream inputStream = this.c;
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public void a(Priority priority, DataFetcher.DataCallback<? super InputStream> dataCallback) {
|
||||
try {
|
||||
this.c = c();
|
||||
dataCallback.a((DataFetcher.DataCallback<? super InputStream>) this.c);
|
||||
} catch (FileNotFoundException e) {
|
||||
if (Log.isLoggable("MediaStoreThumbFetcher", 3)) {
|
||||
Log.d("MediaStoreThumbFetcher", "Failed to find thumbnail file", e);
|
||||
}
|
||||
dataCallback.a((Exception) e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher
|
||||
public Class<InputStream> a() {
|
||||
return InputStream.class;
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package com.bumptech.glide.load.data.mediastore;
|
||||
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface ThumbnailQuery {
|
||||
Cursor a(Uri uri);
|
||||
}
|
@@ -0,0 +1,115 @@
|
||||
package com.bumptech.glide.load.data.mediastore;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
import android.database.Cursor;
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.load.ImageHeaderParser;
|
||||
import com.bumptech.glide.load.ImageHeaderParserUtils;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ThumbnailStreamOpener {
|
||||
private static final FileService f = new FileService();
|
||||
private final FileService a;
|
||||
private final ThumbnailQuery b;
|
||||
private final ArrayPool c;
|
||||
private final ContentResolver d;
|
||||
private final List<ImageHeaderParser> e;
|
||||
|
||||
ThumbnailStreamOpener(List<ImageHeaderParser> list, ThumbnailQuery thumbnailQuery, ArrayPool arrayPool, ContentResolver contentResolver) {
|
||||
this(list, f, thumbnailQuery, arrayPool, contentResolver);
|
||||
}
|
||||
|
||||
private String c(Uri uri) {
|
||||
Cursor a = this.b.a(uri);
|
||||
if (a != null) {
|
||||
try {
|
||||
if (a.moveToFirst()) {
|
||||
return a.getString(0);
|
||||
}
|
||||
} finally {
|
||||
if (a != null) {
|
||||
a.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (a != null) {
|
||||
a.close();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
int a(Uri uri) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
try {
|
||||
inputStream = this.d.openInputStream(uri);
|
||||
int a = ImageHeaderParserUtils.a(this.e, inputStream, this.c);
|
||||
if (inputStream != null) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused) {
|
||||
}
|
||||
}
|
||||
return a;
|
||||
} catch (IOException | NullPointerException e) {
|
||||
if (Log.isLoggable("ThumbStreamOpener", 3)) {
|
||||
Log.d("ThumbStreamOpener", "Failed to open uri: " + uri, e);
|
||||
}
|
||||
if (inputStream == null) {
|
||||
return -1;
|
||||
}
|
||||
try {
|
||||
inputStream.close();
|
||||
return -1;
|
||||
} catch (IOException unused2) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
if (0 != 0) {
|
||||
try {
|
||||
inputStream.close();
|
||||
} catch (IOException unused3) {
|
||||
}
|
||||
}
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public InputStream b(Uri uri) throws FileNotFoundException {
|
||||
String c = c(uri);
|
||||
if (TextUtils.isEmpty(c)) {
|
||||
return null;
|
||||
}
|
||||
File a = this.a.a(c);
|
||||
if (!a(a)) {
|
||||
return null;
|
||||
}
|
||||
Uri fromFile = Uri.fromFile(a);
|
||||
try {
|
||||
return this.d.openInputStream(fromFile);
|
||||
} catch (NullPointerException e) {
|
||||
throw ((FileNotFoundException) new FileNotFoundException("NPE opening uri: " + uri + " -> " + fromFile).initCause(e));
|
||||
}
|
||||
}
|
||||
|
||||
ThumbnailStreamOpener(List<ImageHeaderParser> list, FileService fileService, ThumbnailQuery thumbnailQuery, ArrayPool arrayPool, ContentResolver contentResolver) {
|
||||
this.a = fileService;
|
||||
this.b = thumbnailQuery;
|
||||
this.c = arrayPool;
|
||||
this.d = contentResolver;
|
||||
this.e = list;
|
||||
}
|
||||
|
||||
private boolean a(File file) {
|
||||
return this.a.a(file) && 0 < this.a.b(file);
|
||||
}
|
||||
}
|
141
sources/com/bumptech/glide/load/engine/ActiveResources.java
Normal file
141
sources/com/bumptech/glide/load/engine/ActiveResources.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Process;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.engine.EngineResource;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ActiveResources {
|
||||
private final boolean a;
|
||||
private final Handler b = new Handler(Looper.getMainLooper(), new Handler.Callback() { // from class: com.bumptech.glide.load.engine.ActiveResources.1
|
||||
@Override // android.os.Handler.Callback
|
||||
public boolean handleMessage(Message message) {
|
||||
if (message.what != 1) {
|
||||
return false;
|
||||
}
|
||||
ActiveResources.this.a((ResourceWeakReference) message.obj);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
final Map<Key, ResourceWeakReference> c = new HashMap();
|
||||
private EngineResource.ResourceListener d;
|
||||
private ReferenceQueue<EngineResource<?>> e;
|
||||
private Thread f;
|
||||
private volatile boolean g;
|
||||
private volatile DequeuedResourceCallback h;
|
||||
|
||||
interface DequeuedResourceCallback {
|
||||
void a();
|
||||
}
|
||||
|
||||
static final class ResourceWeakReference extends WeakReference<EngineResource<?>> {
|
||||
final Key a;
|
||||
final boolean b;
|
||||
Resource<?> c;
|
||||
|
||||
ResourceWeakReference(Key key, EngineResource<?> engineResource, ReferenceQueue<? super EngineResource<?>> referenceQueue, boolean z) {
|
||||
super(engineResource, referenceQueue);
|
||||
Resource<?> resource;
|
||||
Preconditions.a(key);
|
||||
this.a = key;
|
||||
if (engineResource.e() && z) {
|
||||
Resource<?> d = engineResource.d();
|
||||
Preconditions.a(d);
|
||||
resource = d;
|
||||
} else {
|
||||
resource = null;
|
||||
}
|
||||
this.c = resource;
|
||||
this.b = engineResource.e();
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.c = null;
|
||||
clear();
|
||||
}
|
||||
}
|
||||
|
||||
ActiveResources(boolean z) {
|
||||
this.a = z;
|
||||
}
|
||||
|
||||
void a(EngineResource.ResourceListener resourceListener) {
|
||||
this.d = resourceListener;
|
||||
}
|
||||
|
||||
EngineResource<?> b(Key key) {
|
||||
ResourceWeakReference resourceWeakReference = this.c.get(key);
|
||||
if (resourceWeakReference == null) {
|
||||
return null;
|
||||
}
|
||||
EngineResource<?> engineResource = resourceWeakReference.get();
|
||||
if (engineResource == null) {
|
||||
a(resourceWeakReference);
|
||||
}
|
||||
return engineResource;
|
||||
}
|
||||
|
||||
void a(Key key, EngineResource<?> engineResource) {
|
||||
ResourceWeakReference put = this.c.put(key, new ResourceWeakReference(key, engineResource, b(), this.a));
|
||||
if (put != null) {
|
||||
put.a();
|
||||
}
|
||||
}
|
||||
|
||||
private ReferenceQueue<EngineResource<?>> b() {
|
||||
if (this.e == null) {
|
||||
this.e = new ReferenceQueue<>();
|
||||
this.f = new Thread(new Runnable() { // from class: com.bumptech.glide.load.engine.ActiveResources.2
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
Process.setThreadPriority(10);
|
||||
ActiveResources.this.a();
|
||||
}
|
||||
}, "glide-active-resources");
|
||||
this.f.start();
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
void a(Key key) {
|
||||
ResourceWeakReference remove = this.c.remove(key);
|
||||
if (remove != null) {
|
||||
remove.a();
|
||||
}
|
||||
}
|
||||
|
||||
void a(ResourceWeakReference resourceWeakReference) {
|
||||
Resource<?> resource;
|
||||
Util.b();
|
||||
this.c.remove(resourceWeakReference.a);
|
||||
if (!resourceWeakReference.b || (resource = resourceWeakReference.c) == null) {
|
||||
return;
|
||||
}
|
||||
EngineResource<?> engineResource = new EngineResource<>(resource, true, false);
|
||||
engineResource.a(resourceWeakReference.a, this.d);
|
||||
this.d.a(resourceWeakReference.a, engineResource);
|
||||
}
|
||||
|
||||
void a() {
|
||||
while (!this.g) {
|
||||
try {
|
||||
this.b.obtainMessage(1, (ResourceWeakReference) this.e.remove()).sendToTarget();
|
||||
DequeuedResourceCallback dequeuedResourceCallback = this.h;
|
||||
if (dequeuedResourceCallback != null) {
|
||||
dequeuedResourceCallback.a();
|
||||
}
|
||||
} catch (InterruptedException unused) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,88 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.engine.DataFetcherGenerator;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class DataCacheGenerator implements DataFetcherGenerator, DataFetcher.DataCallback<Object> {
|
||||
private final List<Key> a;
|
||||
private final DecodeHelper<?> b;
|
||||
private final DataFetcherGenerator.FetcherReadyCallback c;
|
||||
private int d;
|
||||
private Key e;
|
||||
private List<ModelLoader<File, ?>> f;
|
||||
private int g;
|
||||
private volatile ModelLoader.LoadData<?> h;
|
||||
private File i;
|
||||
|
||||
DataCacheGenerator(DecodeHelper<?> decodeHelper, DataFetcherGenerator.FetcherReadyCallback fetcherReadyCallback) {
|
||||
this(decodeHelper.c(), decodeHelper, fetcherReadyCallback);
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
return this.g < this.f.size();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public boolean a() {
|
||||
while (true) {
|
||||
boolean z = false;
|
||||
if (this.f != null && b()) {
|
||||
this.h = null;
|
||||
while (!z && b()) {
|
||||
List<ModelLoader<File, ?>> list = this.f;
|
||||
int i = this.g;
|
||||
this.g = i + 1;
|
||||
this.h = list.get(i).a(this.i, this.b.m(), this.b.f(), this.b.h());
|
||||
if (this.h != null && this.b.c(this.h.c.a())) {
|
||||
this.h.c.a(this.b.i(), this);
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
this.d++;
|
||||
if (this.d >= this.a.size()) {
|
||||
return false;
|
||||
}
|
||||
Key key = this.a.get(this.d);
|
||||
this.i = this.b.d().a(new DataCacheKey(key, this.b.k()));
|
||||
File file = this.i;
|
||||
if (file != null) {
|
||||
this.e = key;
|
||||
this.f = this.b.a(file);
|
||||
this.g = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public void cancel() {
|
||||
ModelLoader.LoadData<?> loadData = this.h;
|
||||
if (loadData != null) {
|
||||
loadData.c.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
DataCacheGenerator(List<Key> list, DecodeHelper<?> decodeHelper, DataFetcherGenerator.FetcherReadyCallback fetcherReadyCallback) {
|
||||
this.d = -1;
|
||||
this.a = list;
|
||||
this.b = decodeHelper;
|
||||
this.c = fetcherReadyCallback;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Object obj) {
|
||||
this.c.a(this.e, obj, this.h.c, DataSource.DATA_DISK_CACHE, this.e);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Exception exc) {
|
||||
this.c.a(this.e, exc, this.h.c, DataSource.DATA_DISK_CACHE);
|
||||
}
|
||||
}
|
39
sources/com/bumptech/glide/load/engine/DataCacheKey.java
Normal file
39
sources/com/bumptech/glide/load/engine/DataCacheKey.java
Normal file
@@ -0,0 +1,39 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DataCacheKey implements Key {
|
||||
private final Key b;
|
||||
private final Key c;
|
||||
|
||||
DataCacheKey(Key key, Key key2) {
|
||||
this.b = key;
|
||||
this.c = key2;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
this.b.a(messageDigest);
|
||||
this.c.a(messageDigest);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof DataCacheKey)) {
|
||||
return false;
|
||||
}
|
||||
DataCacheKey dataCacheKey = (DataCacheKey) obj;
|
||||
return this.b.equals(dataCacheKey.b) && this.c.equals(dataCacheKey.c);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public int hashCode() {
|
||||
return (this.b.hashCode() * 31) + this.c.hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "DataCacheKey{sourceKey=" + this.b + ", signature=" + this.c + '}';
|
||||
}
|
||||
}
|
24
sources/com/bumptech/glide/load/engine/DataCacheWriter.java
Normal file
24
sources/com/bumptech/glide/load/engine/DataCacheWriter.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Encoder;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class DataCacheWriter<DataType> implements DiskCache.Writer {
|
||||
private final Encoder<DataType> a;
|
||||
private final DataType b;
|
||||
private final Options c;
|
||||
|
||||
DataCacheWriter(Encoder<DataType> encoder, DataType datatype, Options options) {
|
||||
this.a = encoder;
|
||||
this.b = datatype;
|
||||
this.c = options;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache.Writer
|
||||
public boolean a(File file) {
|
||||
return this.a.a(this.b, file, this.c);
|
||||
}
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface DataFetcherGenerator {
|
||||
|
||||
public interface FetcherReadyCallback {
|
||||
void a(Key key, Exception exc, DataFetcher<?> dataFetcher, DataSource dataSource);
|
||||
|
||||
void a(Key key, Object obj, DataFetcher<?> dataFetcher, DataSource dataSource, Key key2);
|
||||
|
||||
void d();
|
||||
}
|
||||
|
||||
boolean a();
|
||||
|
||||
void cancel();
|
||||
}
|
220
sources/com/bumptech/glide/load/engine/DecodeHelper.java
Normal file
220
sources/com/bumptech/glide/load/engine/DecodeHelper.java
Normal file
@@ -0,0 +1,220 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.GlideContext;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.Registry;
|
||||
import com.bumptech.glide.load.Encoder;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.ResourceEncoder;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.DecodeJob;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import com.bumptech.glide.load.resource.UnitTransformation;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DecodeHelper<Transcode> {
|
||||
private final List<ModelLoader.LoadData<?>> a = new ArrayList();
|
||||
private final List<Key> b = new ArrayList();
|
||||
private GlideContext c;
|
||||
private Object d;
|
||||
private int e;
|
||||
private int f;
|
||||
private Class<?> g;
|
||||
private DecodeJob.DiskCacheProvider h;
|
||||
private Options i;
|
||||
private Map<Class<?>, Transformation<?>> j;
|
||||
private Class<Transcode> k;
|
||||
private boolean l;
|
||||
private boolean m;
|
||||
private Key n;
|
||||
private Priority o;
|
||||
private DiskCacheStrategy p;
|
||||
private boolean q;
|
||||
private boolean r;
|
||||
|
||||
DecodeHelper() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
<R> void a(GlideContext glideContext, Object obj, Key key, int i, int i2, DiskCacheStrategy diskCacheStrategy, Class<?> cls, Class<R> cls2, Priority priority, Options options, Map<Class<?>, Transformation<?>> map, boolean z, boolean z2, DecodeJob.DiskCacheProvider diskCacheProvider) {
|
||||
this.c = glideContext;
|
||||
this.d = obj;
|
||||
this.n = key;
|
||||
this.e = i;
|
||||
this.f = i2;
|
||||
this.p = diskCacheStrategy;
|
||||
this.g = cls;
|
||||
this.h = diskCacheProvider;
|
||||
this.k = cls2;
|
||||
this.o = priority;
|
||||
this.i = options;
|
||||
this.j = map;
|
||||
this.q = z;
|
||||
this.r = z2;
|
||||
}
|
||||
|
||||
ArrayPool b() {
|
||||
return this.c.a();
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
boolean c(Class<?> cls) {
|
||||
return a((Class) cls) != null;
|
||||
}
|
||||
|
||||
DiskCache d() {
|
||||
return this.h.a();
|
||||
}
|
||||
|
||||
DiskCacheStrategy e() {
|
||||
return this.p;
|
||||
}
|
||||
|
||||
int f() {
|
||||
return this.f;
|
||||
}
|
||||
|
||||
List<ModelLoader.LoadData<?>> g() {
|
||||
if (!this.l) {
|
||||
this.l = true;
|
||||
this.a.clear();
|
||||
List a = this.c.e().a((Registry) this.d);
|
||||
int size = a.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ModelLoader.LoadData<?> a2 = ((ModelLoader) a.get(i)).a(this.d, this.e, this.f, this.i);
|
||||
if (a2 != null) {
|
||||
this.a.add(a2);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.a;
|
||||
}
|
||||
|
||||
Options h() {
|
||||
return this.i;
|
||||
}
|
||||
|
||||
Priority i() {
|
||||
return this.o;
|
||||
}
|
||||
|
||||
List<Class<?>> j() {
|
||||
return this.c.e().b(this.d.getClass(), this.g, this.k);
|
||||
}
|
||||
|
||||
Key k() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
Class<?> l() {
|
||||
return this.k;
|
||||
}
|
||||
|
||||
int m() {
|
||||
return this.e;
|
||||
}
|
||||
|
||||
boolean n() {
|
||||
return this.r;
|
||||
}
|
||||
|
||||
<Z> Transformation<Z> b(Class<Z> cls) {
|
||||
Transformation<Z> transformation = (Transformation) this.j.get(cls);
|
||||
if (transformation == null) {
|
||||
Iterator<Map.Entry<Class<?>, Transformation<?>>> it = this.j.entrySet().iterator();
|
||||
while (true) {
|
||||
if (!it.hasNext()) {
|
||||
break;
|
||||
}
|
||||
Map.Entry<Class<?>, Transformation<?>> next = it.next();
|
||||
if (next.getKey().isAssignableFrom(cls)) {
|
||||
transformation = (Transformation) next.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (transformation != null) {
|
||||
return transformation;
|
||||
}
|
||||
if (!this.j.isEmpty() || !this.q) {
|
||||
return UnitTransformation.a();
|
||||
}
|
||||
throw new IllegalArgumentException("Missing transformation for " + cls + ". If you wish to ignore unknown resource types, use the optional transformation methods.");
|
||||
}
|
||||
|
||||
List<Key> c() {
|
||||
if (!this.m) {
|
||||
this.m = true;
|
||||
this.b.clear();
|
||||
List<ModelLoader.LoadData<?>> g = g();
|
||||
int size = g.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ModelLoader.LoadData<?> loadData = g.get(i);
|
||||
if (!this.b.contains(loadData.a)) {
|
||||
this.b.add(loadData.a);
|
||||
}
|
||||
for (int i2 = 0; i2 < loadData.b.size(); i2++) {
|
||||
if (!this.b.contains(loadData.b.get(i2))) {
|
||||
this.b.add(loadData.b.get(i2));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.b;
|
||||
}
|
||||
|
||||
boolean b(Resource<?> resource) {
|
||||
return this.c.e().b(resource);
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.c = null;
|
||||
this.d = null;
|
||||
this.n = null;
|
||||
this.g = null;
|
||||
this.k = null;
|
||||
this.i = null;
|
||||
this.o = null;
|
||||
this.j = null;
|
||||
this.p = null;
|
||||
this.a.clear();
|
||||
this.l = false;
|
||||
this.b.clear();
|
||||
this.m = false;
|
||||
}
|
||||
|
||||
<Data> LoadPath<Data, ?, Transcode> a(Class<Data> cls) {
|
||||
return this.c.e().a(cls, this.g, this.k);
|
||||
}
|
||||
|
||||
<Z> ResourceEncoder<Z> a(Resource<Z> resource) {
|
||||
return this.c.e().a((Resource) resource);
|
||||
}
|
||||
|
||||
List<ModelLoader<File, ?>> a(File file) throws Registry.NoModelLoaderAvailableException {
|
||||
return this.c.e().a((Registry) file);
|
||||
}
|
||||
|
||||
boolean a(Key key) {
|
||||
List<ModelLoader.LoadData<?>> g = g();
|
||||
int size = g.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (g.get(i).a.equals(key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
<X> Encoder<X> a(X x) throws Registry.NoSourceEncoderAvailableException {
|
||||
return this.c.e().c(x);
|
||||
}
|
||||
}
|
676
sources/com/bumptech/glide/load/engine/DecodeJob.java
Normal file
676
sources/com/bumptech/glide/load/engine/DecodeJob.java
Normal file
@@ -0,0 +1,676 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.GlideContext;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.Registry;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.EncodeStrategy;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.ResourceEncoder;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.engine.DataFetcherGenerator;
|
||||
import com.bumptech.glide.load.engine.DecodePath;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import com.bumptech.glide.load.resource.bitmap.Downsampler;
|
||||
import com.bumptech.glide.util.LogTime;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import com.bumptech.glide.util.pool.GlideTrace;
|
||||
import com.bumptech.glide.util.pool.StateVerifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class DecodeJob<R> implements DataFetcherGenerator.FetcherReadyCallback, Runnable, Comparable<DecodeJob<?>>, FactoryPools.Poolable {
|
||||
private Object A;
|
||||
private DataSource B;
|
||||
private DataFetcher<?> C;
|
||||
private volatile DataFetcherGenerator D;
|
||||
private volatile boolean E;
|
||||
private volatile boolean F;
|
||||
private final DiskCacheProvider d;
|
||||
private final Pools$Pool<DecodeJob<?>> e;
|
||||
private GlideContext h;
|
||||
private Key i;
|
||||
private Priority j;
|
||||
private EngineKey k;
|
||||
private int l;
|
||||
private int m;
|
||||
private DiskCacheStrategy n;
|
||||
private Options o;
|
||||
private Callback<R> p;
|
||||
private int q;
|
||||
private Stage r;
|
||||
private RunReason s;
|
||||
private long t;
|
||||
private boolean u;
|
||||
private Object v;
|
||||
private Thread x;
|
||||
private Key y;
|
||||
private Key z;
|
||||
private final DecodeHelper<R> a = new DecodeHelper<>();
|
||||
private final List<Throwable> b = new ArrayList();
|
||||
private final StateVerifier c = StateVerifier.b();
|
||||
private final DeferredEncodeManager<?> f = new DeferredEncodeManager<>();
|
||||
private final ReleaseManager g = new ReleaseManager();
|
||||
|
||||
/* renamed from: com.bumptech.glide.load.engine.DecodeJob$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a;
|
||||
static final /* synthetic */ int[] b;
|
||||
static final /* synthetic */ int[] c = new int[EncodeStrategy.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
c[EncodeStrategy.SOURCE.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
c[EncodeStrategy.TRANSFORMED.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
b = new int[Stage.values().length];
|
||||
try {
|
||||
b[Stage.RESOURCE_CACHE.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
b[Stage.DATA_CACHE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
try {
|
||||
b[Stage.SOURCE.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused5) {
|
||||
}
|
||||
try {
|
||||
b[Stage.FINISHED.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused6) {
|
||||
}
|
||||
try {
|
||||
b[Stage.INITIALIZE.ordinal()] = 5;
|
||||
} catch (NoSuchFieldError unused7) {
|
||||
}
|
||||
a = new int[RunReason.values().length];
|
||||
try {
|
||||
a[RunReason.INITIALIZE.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused8) {
|
||||
}
|
||||
try {
|
||||
a[RunReason.SWITCH_TO_SOURCE_SERVICE.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused9) {
|
||||
}
|
||||
try {
|
||||
a[RunReason.DECODE_DATA.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused10) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
interface Callback<R> {
|
||||
void a(DecodeJob<?> decodeJob);
|
||||
|
||||
void a(GlideException glideException);
|
||||
|
||||
void a(Resource<R> resource, DataSource dataSource);
|
||||
}
|
||||
|
||||
private final class DecodeCallback<Z> implements DecodePath.DecodeCallback<Z> {
|
||||
private final DataSource a;
|
||||
|
||||
DecodeCallback(DataSource dataSource) {
|
||||
this.a = dataSource;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DecodePath.DecodeCallback
|
||||
public Resource<Z> a(Resource<Z> resource) {
|
||||
return DecodeJob.this.a(this.a, resource);
|
||||
}
|
||||
}
|
||||
|
||||
interface DiskCacheProvider {
|
||||
DiskCache a();
|
||||
}
|
||||
|
||||
private enum RunReason {
|
||||
INITIALIZE,
|
||||
SWITCH_TO_SOURCE_SERVICE,
|
||||
DECODE_DATA
|
||||
}
|
||||
|
||||
private enum Stage {
|
||||
INITIALIZE,
|
||||
RESOURCE_CACHE,
|
||||
DATA_CACHE,
|
||||
SOURCE,
|
||||
ENCODE,
|
||||
FINISHED
|
||||
}
|
||||
|
||||
DecodeJob(DiskCacheProvider diskCacheProvider, Pools$Pool<DecodeJob<?>> pools$Pool) {
|
||||
this.d = diskCacheProvider;
|
||||
this.e = pools$Pool;
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
private void b(Resource<R> resource, DataSource dataSource) {
|
||||
if (resource instanceof Initializable) {
|
||||
((Initializable) resource).c();
|
||||
}
|
||||
LockedResource lockedResource = 0;
|
||||
if (this.f.b()) {
|
||||
resource = LockedResource.b(resource);
|
||||
lockedResource = resource;
|
||||
}
|
||||
a((Resource) resource, dataSource);
|
||||
this.r = Stage.ENCODE;
|
||||
try {
|
||||
if (this.f.b()) {
|
||||
this.f.a(this.d, this.o);
|
||||
}
|
||||
o();
|
||||
} finally {
|
||||
if (lockedResource != 0) {
|
||||
lockedResource.d();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void f() {
|
||||
if (Log.isLoggable("DecodeJob", 2)) {
|
||||
a("Retrieved data", this.t, "data: " + this.A + ", cache key: " + this.y + ", fetcher: " + this.C);
|
||||
}
|
||||
Resource<R> resource = null;
|
||||
try {
|
||||
resource = a(this.C, (DataFetcher<?>) this.A, this.B);
|
||||
} catch (GlideException e) {
|
||||
e.setLoggingDetails(this.z, this.B);
|
||||
this.b.add(e);
|
||||
}
|
||||
if (resource != null) {
|
||||
b(resource, this.B);
|
||||
} else {
|
||||
r();
|
||||
}
|
||||
}
|
||||
|
||||
private DataFetcherGenerator m() {
|
||||
int i = AnonymousClass1.b[this.r.ordinal()];
|
||||
if (i == 1) {
|
||||
return new ResourceCacheGenerator(this.a, this);
|
||||
}
|
||||
if (i == 2) {
|
||||
return new DataCacheGenerator(this.a, this);
|
||||
}
|
||||
if (i == 3) {
|
||||
return new SourceGenerator(this.a, this);
|
||||
}
|
||||
if (i == 4) {
|
||||
return null;
|
||||
}
|
||||
throw new IllegalStateException("Unrecognized stage: " + this.r);
|
||||
}
|
||||
|
||||
private void n() {
|
||||
t();
|
||||
this.p.a(new GlideException("Failed to load resource", new ArrayList(this.b)));
|
||||
p();
|
||||
}
|
||||
|
||||
private void o() {
|
||||
if (this.g.a()) {
|
||||
q();
|
||||
}
|
||||
}
|
||||
|
||||
private void p() {
|
||||
if (this.g.b()) {
|
||||
q();
|
||||
}
|
||||
}
|
||||
|
||||
private void q() {
|
||||
this.g.c();
|
||||
this.f.a();
|
||||
this.a.a();
|
||||
this.E = false;
|
||||
this.h = null;
|
||||
this.i = null;
|
||||
this.o = null;
|
||||
this.j = null;
|
||||
this.k = null;
|
||||
this.p = null;
|
||||
this.r = null;
|
||||
this.D = null;
|
||||
this.x = null;
|
||||
this.y = null;
|
||||
this.A = null;
|
||||
this.B = null;
|
||||
this.C = null;
|
||||
this.t = 0L;
|
||||
this.F = false;
|
||||
this.v = null;
|
||||
this.b.clear();
|
||||
this.e.a(this);
|
||||
}
|
||||
|
||||
private void r() {
|
||||
this.x = Thread.currentThread();
|
||||
this.t = LogTime.a();
|
||||
boolean z = false;
|
||||
while (!this.F && this.D != null && !(z = this.D.a())) {
|
||||
this.r = a(this.r);
|
||||
this.D = m();
|
||||
if (this.r == Stage.SOURCE) {
|
||||
d();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ((this.r == Stage.FINISHED || this.F) && !z) {
|
||||
n();
|
||||
}
|
||||
}
|
||||
|
||||
private void s() {
|
||||
int i = AnonymousClass1.a[this.s.ordinal()];
|
||||
if (i == 1) {
|
||||
this.r = a(Stage.INITIALIZE);
|
||||
this.D = m();
|
||||
r();
|
||||
} else if (i == 2) {
|
||||
r();
|
||||
} else {
|
||||
if (i == 3) {
|
||||
f();
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("Unrecognized run reason: " + this.s);
|
||||
}
|
||||
}
|
||||
|
||||
private void t() {
|
||||
this.c.a();
|
||||
if (this.E) {
|
||||
throw new IllegalStateException("Already notified");
|
||||
}
|
||||
this.E = true;
|
||||
}
|
||||
|
||||
DecodeJob<R> a(GlideContext glideContext, Object obj, EngineKey engineKey, Key key, int i, int i2, Class<?> cls, Class<R> cls2, Priority priority, DiskCacheStrategy diskCacheStrategy, Map<Class<?>, Transformation<?>> map, boolean z, boolean z2, boolean z3, Options options, Callback<R> callback, int i3) {
|
||||
this.a.a(glideContext, obj, key, i, i2, diskCacheStrategy, cls, cls2, priority, options, map, z, z2, this.d);
|
||||
this.h = glideContext;
|
||||
this.i = key;
|
||||
this.j = priority;
|
||||
this.k = engineKey;
|
||||
this.l = i;
|
||||
this.m = i2;
|
||||
this.n = diskCacheStrategy;
|
||||
this.u = z3;
|
||||
this.o = options;
|
||||
this.p = callback;
|
||||
this.q = i3;
|
||||
this.s = RunReason.INITIALIZE;
|
||||
this.v = obj;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Poolable
|
||||
public StateVerifier c() {
|
||||
return this.c;
|
||||
}
|
||||
|
||||
public void cancel() {
|
||||
this.F = true;
|
||||
DataFetcherGenerator dataFetcherGenerator = this.D;
|
||||
if (dataFetcherGenerator != null) {
|
||||
dataFetcherGenerator.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void d() {
|
||||
this.s = RunReason.SWITCH_TO_SOURCE_SERVICE;
|
||||
this.p.a((DecodeJob<?>) this);
|
||||
}
|
||||
|
||||
boolean e() {
|
||||
Stage a = a(Stage.INITIALIZE);
|
||||
return a == Stage.RESOURCE_CACHE || a == Stage.DATA_CACHE;
|
||||
}
|
||||
|
||||
/* JADX WARN: Code restructure failed: missing block: B:12:0x001e, code lost:
|
||||
|
||||
if (r1 != null) goto L12;
|
||||
*/
|
||||
@Override // java.lang.Runnable
|
||||
/*
|
||||
Code decompiled incorrectly, please refer to instructions dump.
|
||||
To view partially-correct code enable 'Show inconsistent code' option in preferences
|
||||
*/
|
||||
public void run() {
|
||||
/*
|
||||
r5 = this;
|
||||
java.lang.String r0 = "DecodeJob"
|
||||
java.lang.Object r1 = r5.v
|
||||
java.lang.String r2 = "DecodeJob#run(model=%s)"
|
||||
com.bumptech.glide.util.pool.GlideTrace.a(r2, r1)
|
||||
com.bumptech.glide.load.data.DataFetcher<?> r1 = r5.C
|
||||
boolean r2 = r5.F // Catch: java.lang.Throwable -> L27
|
||||
if (r2 == 0) goto L1b
|
||||
r5.n() // Catch: java.lang.Throwable -> L27
|
||||
if (r1 == 0) goto L17
|
||||
r1.b()
|
||||
L17:
|
||||
com.bumptech.glide.util.pool.GlideTrace.a()
|
||||
return
|
||||
L1b:
|
||||
r5.s() // Catch: java.lang.Throwable -> L27
|
||||
if (r1 == 0) goto L23
|
||||
L20:
|
||||
r1.b()
|
||||
L23:
|
||||
com.bumptech.glide.util.pool.GlideTrace.a()
|
||||
goto L64
|
||||
L27:
|
||||
r2 = move-exception
|
||||
r3 = 3
|
||||
boolean r3 = android.util.Log.isLoggable(r0, r3) // Catch: java.lang.Throwable -> L66
|
||||
if (r3 == 0) goto L4f
|
||||
java.lang.StringBuilder r3 = new java.lang.StringBuilder // Catch: java.lang.Throwable -> L66
|
||||
r3.<init>() // Catch: java.lang.Throwable -> L66
|
||||
java.lang.String r4 = "DecodeJob threw unexpectedly, isCancelled: "
|
||||
r3.append(r4) // Catch: java.lang.Throwable -> L66
|
||||
boolean r4 = r5.F // Catch: java.lang.Throwable -> L66
|
||||
r3.append(r4) // Catch: java.lang.Throwable -> L66
|
||||
java.lang.String r4 = ", stage: "
|
||||
r3.append(r4) // Catch: java.lang.Throwable -> L66
|
||||
com.bumptech.glide.load.engine.DecodeJob$Stage r4 = r5.r // Catch: java.lang.Throwable -> L66
|
||||
r3.append(r4) // Catch: java.lang.Throwable -> L66
|
||||
java.lang.String r3 = r3.toString() // Catch: java.lang.Throwable -> L66
|
||||
android.util.Log.d(r0, r3, r2) // Catch: java.lang.Throwable -> L66
|
||||
L4f:
|
||||
com.bumptech.glide.load.engine.DecodeJob$Stage r0 = r5.r // Catch: java.lang.Throwable -> L66
|
||||
com.bumptech.glide.load.engine.DecodeJob$Stage r3 = com.bumptech.glide.load.engine.DecodeJob.Stage.ENCODE // Catch: java.lang.Throwable -> L66
|
||||
if (r0 == r3) goto L5d
|
||||
java.util.List<java.lang.Throwable> r0 = r5.b // Catch: java.lang.Throwable -> L66
|
||||
r0.add(r2) // Catch: java.lang.Throwable -> L66
|
||||
r5.n() // Catch: java.lang.Throwable -> L66
|
||||
L5d:
|
||||
boolean r0 = r5.F // Catch: java.lang.Throwable -> L66
|
||||
if (r0 == 0) goto L65
|
||||
if (r1 == 0) goto L23
|
||||
goto L20
|
||||
L64:
|
||||
return
|
||||
L65:
|
||||
throw r2 // Catch: java.lang.Throwable -> L66
|
||||
L66:
|
||||
r0 = move-exception
|
||||
if (r1 == 0) goto L6c
|
||||
r1.b()
|
||||
L6c:
|
||||
com.bumptech.glide.util.pool.GlideTrace.a()
|
||||
throw r0
|
||||
*/
|
||||
throw new UnsupportedOperationException("Method not decompiled: com.bumptech.glide.load.engine.DecodeJob.run():void");
|
||||
}
|
||||
|
||||
private static class ReleaseManager {
|
||||
private boolean a;
|
||||
private boolean b;
|
||||
private boolean c;
|
||||
|
||||
ReleaseManager() {
|
||||
}
|
||||
|
||||
synchronized boolean a(boolean z) {
|
||||
this.a = true;
|
||||
return b(z);
|
||||
}
|
||||
|
||||
synchronized boolean b() {
|
||||
this.c = true;
|
||||
return b(false);
|
||||
}
|
||||
|
||||
synchronized void c() {
|
||||
this.b = false;
|
||||
this.a = false;
|
||||
this.c = false;
|
||||
}
|
||||
|
||||
private boolean b(boolean z) {
|
||||
return (this.c || z || this.b) && this.a;
|
||||
}
|
||||
|
||||
synchronized boolean a() {
|
||||
this.b = true;
|
||||
return b(false);
|
||||
}
|
||||
}
|
||||
|
||||
private static class DeferredEncodeManager<Z> {
|
||||
private Key a;
|
||||
private ResourceEncoder<Z> b;
|
||||
private LockedResource<Z> c;
|
||||
|
||||
DeferredEncodeManager() {
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
<X> void a(Key key, ResourceEncoder<X> resourceEncoder, LockedResource<X> lockedResource) {
|
||||
this.a = key;
|
||||
this.b = resourceEncoder;
|
||||
this.c = lockedResource;
|
||||
}
|
||||
|
||||
boolean b() {
|
||||
return this.c != null;
|
||||
}
|
||||
|
||||
void a(DiskCacheProvider diskCacheProvider, Options options) {
|
||||
GlideTrace.a("DecodeJob.encode");
|
||||
try {
|
||||
diskCacheProvider.a().a(this.a, new DataCacheWriter(this.b, this.c, options));
|
||||
} finally {
|
||||
this.c.d();
|
||||
GlideTrace.a();
|
||||
}
|
||||
}
|
||||
|
||||
void a() {
|
||||
this.a = null;
|
||||
this.b = null;
|
||||
this.c = null;
|
||||
}
|
||||
}
|
||||
|
||||
void a(boolean z) {
|
||||
if (this.g.a(z)) {
|
||||
q();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Comparable
|
||||
/* renamed from: a, reason: merged with bridge method [inline-methods] */
|
||||
public int compareTo(DecodeJob<?> decodeJob) {
|
||||
int a = a() - decodeJob.a();
|
||||
return a == 0 ? this.q - decodeJob.q : a;
|
||||
}
|
||||
|
||||
private int a() {
|
||||
return this.j.ordinal();
|
||||
}
|
||||
|
||||
private void a(Resource<R> resource, DataSource dataSource) {
|
||||
t();
|
||||
this.p.a(resource, dataSource);
|
||||
}
|
||||
|
||||
private Stage a(Stage stage) {
|
||||
int i = AnonymousClass1.b[stage.ordinal()];
|
||||
if (i == 1) {
|
||||
return this.n.a() ? Stage.DATA_CACHE : a(Stage.DATA_CACHE);
|
||||
}
|
||||
if (i == 2) {
|
||||
return this.u ? Stage.FINISHED : Stage.SOURCE;
|
||||
}
|
||||
if (i == 3 || i == 4) {
|
||||
return Stage.FINISHED;
|
||||
}
|
||||
if (i == 5) {
|
||||
return this.n.b() ? Stage.RESOURCE_CACHE : a(Stage.RESOURCE_CACHE);
|
||||
}
|
||||
throw new IllegalArgumentException("Unrecognized stage: " + stage);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void a(Key key, Object obj, DataFetcher<?> dataFetcher, DataSource dataSource, Key key2) {
|
||||
this.y = key;
|
||||
this.A = obj;
|
||||
this.C = dataFetcher;
|
||||
this.B = dataSource;
|
||||
this.z = key2;
|
||||
if (Thread.currentThread() != this.x) {
|
||||
this.s = RunReason.DECODE_DATA;
|
||||
this.p.a((DecodeJob<?>) this);
|
||||
} else {
|
||||
GlideTrace.a("DecodeJob.decodeFromRetrievedData");
|
||||
try {
|
||||
f();
|
||||
} finally {
|
||||
GlideTrace.a();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void a(Key key, Exception exc, DataFetcher<?> dataFetcher, DataSource dataSource) {
|
||||
dataFetcher.b();
|
||||
GlideException glideException = new GlideException("Fetching data failed", exc);
|
||||
glideException.setLoggingDetails(key, dataSource, dataFetcher.a());
|
||||
this.b.add(glideException);
|
||||
if (Thread.currentThread() != this.x) {
|
||||
this.s = RunReason.SWITCH_TO_SOURCE_SERVICE;
|
||||
this.p.a((DecodeJob<?>) this);
|
||||
} else {
|
||||
r();
|
||||
}
|
||||
}
|
||||
|
||||
private <Data> Resource<R> a(DataFetcher<?> dataFetcher, Data data, DataSource dataSource) throws GlideException {
|
||||
if (data == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
long a = LogTime.a();
|
||||
Resource<R> a2 = a((DecodeJob<R>) data, dataSource);
|
||||
if (Log.isLoggable("DecodeJob", 2)) {
|
||||
a("Decoded result " + a2, a);
|
||||
}
|
||||
return a2;
|
||||
} finally {
|
||||
dataFetcher.b();
|
||||
}
|
||||
}
|
||||
|
||||
private <Data> Resource<R> a(Data data, DataSource dataSource) throws GlideException {
|
||||
return a((DecodeJob<R>) data, dataSource, (LoadPath<DecodeJob<R>, ResourceType, R>) this.a.a((Class) data.getClass()));
|
||||
}
|
||||
|
||||
private Options a(DataSource dataSource) {
|
||||
Options options = this.o;
|
||||
if (Build.VERSION.SDK_INT < 26 || options.a(Downsampler.h) != null) {
|
||||
return options;
|
||||
}
|
||||
if (dataSource != DataSource.RESOURCE_DISK_CACHE && !this.a.n()) {
|
||||
return options;
|
||||
}
|
||||
Options options2 = new Options();
|
||||
options2.a(this.o);
|
||||
options2.a(Downsampler.h, true);
|
||||
return options2;
|
||||
}
|
||||
|
||||
private <Data, ResourceType> Resource<R> a(Data data, DataSource dataSource, LoadPath<Data, ResourceType, R> loadPath) throws GlideException {
|
||||
Options a = a(dataSource);
|
||||
DataRewinder<Data> b = this.h.e().b((Registry) data);
|
||||
try {
|
||||
return loadPath.a(b, a, this.l, this.m, new DecodeCallback(dataSource));
|
||||
} finally {
|
||||
b.b();
|
||||
}
|
||||
}
|
||||
|
||||
private void a(String str, long j) {
|
||||
a(str, j, (String) null);
|
||||
}
|
||||
|
||||
private void a(String str, long j, String str2) {
|
||||
String str3;
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(str);
|
||||
sb.append(" in ");
|
||||
sb.append(LogTime.a(j));
|
||||
sb.append(", load key: ");
|
||||
sb.append(this.k);
|
||||
if (str2 != null) {
|
||||
str3 = ", " + str2;
|
||||
} else {
|
||||
str3 = "";
|
||||
}
|
||||
sb.append(str3);
|
||||
sb.append(", thread: ");
|
||||
sb.append(Thread.currentThread().getName());
|
||||
Log.v("DecodeJob", sb.toString());
|
||||
}
|
||||
|
||||
<Z> Resource<Z> a(DataSource dataSource, Resource<Z> resource) {
|
||||
Resource<Z> resource2;
|
||||
Transformation<Z> transformation;
|
||||
EncodeStrategy encodeStrategy;
|
||||
Key dataCacheKey;
|
||||
Class<?> cls = resource.get().getClass();
|
||||
ResourceEncoder<Z> resourceEncoder = null;
|
||||
if (dataSource != DataSource.RESOURCE_DISK_CACHE) {
|
||||
Transformation<Z> b = this.a.b(cls);
|
||||
transformation = b;
|
||||
resource2 = b.a(this.h, resource, this.l, this.m);
|
||||
} else {
|
||||
resource2 = resource;
|
||||
transformation = null;
|
||||
}
|
||||
if (!resource.equals(resource2)) {
|
||||
resource.a();
|
||||
}
|
||||
if (this.a.b((Resource<?>) resource2)) {
|
||||
resourceEncoder = this.a.a((Resource) resource2);
|
||||
encodeStrategy = resourceEncoder.a(this.o);
|
||||
} else {
|
||||
encodeStrategy = EncodeStrategy.NONE;
|
||||
}
|
||||
ResourceEncoder resourceEncoder2 = resourceEncoder;
|
||||
if (!this.n.a(!this.a.a(this.y), dataSource, encodeStrategy)) {
|
||||
return resource2;
|
||||
}
|
||||
if (resourceEncoder2 != null) {
|
||||
int i = AnonymousClass1.c[encodeStrategy.ordinal()];
|
||||
if (i == 1) {
|
||||
dataCacheKey = new DataCacheKey(this.y, this.i);
|
||||
} else if (i == 2) {
|
||||
dataCacheKey = new ResourceCacheKey(this.a.b(), this.y, this.i, this.l, this.m, transformation, cls, this.o);
|
||||
} else {
|
||||
throw new IllegalArgumentException("Unknown strategy: " + encodeStrategy);
|
||||
}
|
||||
LockedResource b2 = LockedResource.b(resource2);
|
||||
this.f.a(dataCacheKey, resourceEncoder2, b2);
|
||||
return b2;
|
||||
}
|
||||
throw new Registry.NoResultEncoderAvailableException(resource2.get().getClass());
|
||||
}
|
||||
}
|
77
sources/com/bumptech/glide/load/engine/DecodePath.java
Normal file
77
sources/com/bumptech/glide/load/engine/DecodePath.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.ResourceDecoder;
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.resource.transcode.ResourceTranscoder;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DecodePath<DataType, ResourceType, Transcode> {
|
||||
private final Class<DataType> a;
|
||||
private final List<? extends ResourceDecoder<DataType, ResourceType>> b;
|
||||
private final ResourceTranscoder<ResourceType, Transcode> c;
|
||||
private final Pools$Pool<List<Throwable>> d;
|
||||
private final String e;
|
||||
|
||||
interface DecodeCallback<ResourceType> {
|
||||
Resource<ResourceType> a(Resource<ResourceType> resource);
|
||||
}
|
||||
|
||||
public DecodePath(Class<DataType> cls, Class<ResourceType> cls2, Class<Transcode> cls3, List<? extends ResourceDecoder<DataType, ResourceType>> list, ResourceTranscoder<ResourceType, Transcode> resourceTranscoder, Pools$Pool<List<Throwable>> pools$Pool) {
|
||||
this.a = cls;
|
||||
this.b = list;
|
||||
this.c = resourceTranscoder;
|
||||
this.d = pools$Pool;
|
||||
this.e = "Failed DecodePath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}";
|
||||
}
|
||||
|
||||
public Resource<Transcode> a(DataRewinder<DataType> dataRewinder, int i, int i2, Options options, DecodeCallback<ResourceType> decodeCallback) throws GlideException {
|
||||
return this.c.a(decodeCallback.a(a(dataRewinder, i, i2, options)), options);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "DecodePath{ dataClass=" + this.a + ", decoders=" + this.b + ", transcoder=" + this.c + '}';
|
||||
}
|
||||
|
||||
private Resource<ResourceType> a(DataRewinder<DataType> dataRewinder, int i, int i2, Options options) throws GlideException {
|
||||
List<Throwable> a = this.d.a();
|
||||
Preconditions.a(a);
|
||||
List<Throwable> list = a;
|
||||
try {
|
||||
return a(dataRewinder, i, i2, options, list);
|
||||
} finally {
|
||||
this.d.a(list);
|
||||
}
|
||||
}
|
||||
|
||||
private Resource<ResourceType> a(DataRewinder<DataType> dataRewinder, int i, int i2, Options options, List<Throwable> list) throws GlideException {
|
||||
int size = this.b.size();
|
||||
Resource<ResourceType> resource = null;
|
||||
for (int i3 = 0; i3 < size; i3++) {
|
||||
ResourceDecoder<DataType, ResourceType> resourceDecoder = this.b.get(i3);
|
||||
try {
|
||||
if (resourceDecoder.a(dataRewinder.a(), options)) {
|
||||
resource = resourceDecoder.a(dataRewinder.a(), i, i2, options);
|
||||
}
|
||||
} catch (IOException | OutOfMemoryError | RuntimeException e) {
|
||||
if (Log.isLoggable("DecodePath", 2)) {
|
||||
Log.v("DecodePath", "Failed to decode data for " + resourceDecoder, e);
|
||||
}
|
||||
list.add(e);
|
||||
}
|
||||
if (resource != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resource != null) {
|
||||
return resource;
|
||||
}
|
||||
throw new GlideException(this.e, new ArrayList(list));
|
||||
}
|
||||
}
|
125
sources/com/bumptech/glide/load/engine/DiskCacheStrategy.java
Normal file
125
sources/com/bumptech/glide/load/engine/DiskCacheStrategy.java
Normal file
@@ -0,0 +1,125 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.EncodeStrategy;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class DiskCacheStrategy {
|
||||
public static final DiskCacheStrategy a = new DiskCacheStrategy() { // from class: com.bumptech.glide.load.engine.DiskCacheStrategy.1
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(DataSource dataSource) {
|
||||
return dataSource == DataSource.REMOTE;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy) {
|
||||
return (dataSource == DataSource.RESOURCE_DISK_CACHE || dataSource == DataSource.MEMORY_CACHE) ? false : true;
|
||||
}
|
||||
};
|
||||
public static final DiskCacheStrategy b = new DiskCacheStrategy() { // from class: com.bumptech.glide.load.engine.DiskCacheStrategy.2
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(DataSource dataSource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
public static final DiskCacheStrategy c = new DiskCacheStrategy() { // from class: com.bumptech.glide.load.engine.DiskCacheStrategy.3
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(DataSource dataSource) {
|
||||
return (dataSource == DataSource.DATA_DISK_CACHE || dataSource == DataSource.MEMORY_CACHE) ? false : true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean b() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
public static final DiskCacheStrategy d;
|
||||
|
||||
static {
|
||||
new DiskCacheStrategy() { // from class: com.bumptech.glide.load.engine.DiskCacheStrategy.4
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(DataSource dataSource) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy) {
|
||||
return (dataSource == DataSource.RESOURCE_DISK_CACHE || dataSource == DataSource.MEMORY_CACHE) ? false : true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
d = new DiskCacheStrategy() { // from class: com.bumptech.glide.load.engine.DiskCacheStrategy.5
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(DataSource dataSource) {
|
||||
return dataSource == DataSource.REMOTE;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean b() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DiskCacheStrategy
|
||||
public boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy) {
|
||||
return ((z && dataSource == DataSource.DATA_DISK_CACHE) || dataSource == DataSource.LOCAL) && encodeStrategy == EncodeStrategy.TRANSFORMED;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public abstract boolean a();
|
||||
|
||||
public abstract boolean a(DataSource dataSource);
|
||||
|
||||
public abstract boolean a(boolean z, DataSource dataSource, EncodeStrategy encodeStrategy);
|
||||
|
||||
public abstract boolean b();
|
||||
}
|
275
sources/com/bumptech/glide/load/engine/Engine.java
Normal file
275
sources/com/bumptech/glide/load/engine/Engine.java
Normal file
@@ -0,0 +1,275 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.util.Log;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.GlideContext;
|
||||
import com.bumptech.glide.Priority;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.DecodeJob;
|
||||
import com.bumptech.glide.load.engine.EngineResource;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCacheAdapter;
|
||||
import com.bumptech.glide.load.engine.cache.MemoryCache;
|
||||
import com.bumptech.glide.load.engine.executor.GlideExecutor;
|
||||
import com.bumptech.glide.request.ResourceCallback;
|
||||
import com.bumptech.glide.util.LogTime;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class Engine implements EngineJobListener, MemoryCache.ResourceRemovedListener, EngineResource.ResourceListener {
|
||||
private static final boolean i = Log.isLoggable("Engine", 2);
|
||||
private final Jobs a;
|
||||
private final EngineKeyFactory b;
|
||||
private final MemoryCache c;
|
||||
private final EngineJobFactory d;
|
||||
private final ResourceRecycler e;
|
||||
private final LazyDiskCacheProvider f;
|
||||
private final DecodeJobFactory g;
|
||||
private final ActiveResources h;
|
||||
|
||||
static class DecodeJobFactory {
|
||||
final DecodeJob.DiskCacheProvider a;
|
||||
final Pools$Pool<DecodeJob<?>> b = FactoryPools.a(150, new FactoryPools.Factory<DecodeJob<?>>() { // from class: com.bumptech.glide.load.engine.Engine.DecodeJobFactory.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Factory
|
||||
public DecodeJob<?> a() {
|
||||
DecodeJobFactory decodeJobFactory = DecodeJobFactory.this;
|
||||
return new DecodeJob<>(decodeJobFactory.a, decodeJobFactory.b);
|
||||
}
|
||||
});
|
||||
private int c;
|
||||
|
||||
DecodeJobFactory(DecodeJob.DiskCacheProvider diskCacheProvider) {
|
||||
this.a = diskCacheProvider;
|
||||
}
|
||||
|
||||
<R> DecodeJob<R> a(GlideContext glideContext, Object obj, EngineKey engineKey, Key key, int i, int i2, Class<?> cls, Class<R> cls2, Priority priority, DiskCacheStrategy diskCacheStrategy, Map<Class<?>, Transformation<?>> map, boolean z, boolean z2, boolean z3, Options options, DecodeJob.Callback<R> callback) {
|
||||
DecodeJob a = this.b.a();
|
||||
Preconditions.a(a);
|
||||
DecodeJob decodeJob = a;
|
||||
int i3 = this.c;
|
||||
this.c = i3 + 1;
|
||||
decodeJob.a(glideContext, obj, engineKey, key, i, i2, cls, cls2, priority, diskCacheStrategy, map, z, z2, z3, options, callback, i3);
|
||||
return decodeJob;
|
||||
}
|
||||
}
|
||||
|
||||
static class EngineJobFactory {
|
||||
final GlideExecutor a;
|
||||
final GlideExecutor b;
|
||||
final GlideExecutor c;
|
||||
final GlideExecutor d;
|
||||
final EngineJobListener e;
|
||||
final Pools$Pool<EngineJob<?>> f = FactoryPools.a(150, new FactoryPools.Factory<EngineJob<?>>() { // from class: com.bumptech.glide.load.engine.Engine.EngineJobFactory.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Factory
|
||||
public EngineJob<?> a() {
|
||||
EngineJobFactory engineJobFactory = EngineJobFactory.this;
|
||||
return new EngineJob<>(engineJobFactory.a, engineJobFactory.b, engineJobFactory.c, engineJobFactory.d, engineJobFactory.e, engineJobFactory.f);
|
||||
}
|
||||
});
|
||||
|
||||
EngineJobFactory(GlideExecutor glideExecutor, GlideExecutor glideExecutor2, GlideExecutor glideExecutor3, GlideExecutor glideExecutor4, EngineJobListener engineJobListener) {
|
||||
this.a = glideExecutor;
|
||||
this.b = glideExecutor2;
|
||||
this.c = glideExecutor3;
|
||||
this.d = glideExecutor4;
|
||||
this.e = engineJobListener;
|
||||
}
|
||||
|
||||
<R> EngineJob<R> a(Key key, boolean z, boolean z2, boolean z3, boolean z4) {
|
||||
EngineJob a = this.f.a();
|
||||
Preconditions.a(a);
|
||||
EngineJob engineJob = a;
|
||||
engineJob.a(key, z, z2, z3, z4);
|
||||
return engineJob;
|
||||
}
|
||||
}
|
||||
|
||||
private static class LazyDiskCacheProvider implements DecodeJob.DiskCacheProvider {
|
||||
private final DiskCache.Factory a;
|
||||
private volatile DiskCache b;
|
||||
|
||||
LazyDiskCacheProvider(DiskCache.Factory factory) {
|
||||
this.a = factory;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DecodeJob.DiskCacheProvider
|
||||
public DiskCache a() {
|
||||
if (this.b == null) {
|
||||
synchronized (this) {
|
||||
if (this.b == null) {
|
||||
this.b = this.a.build();
|
||||
}
|
||||
if (this.b == null) {
|
||||
this.b = new DiskCacheAdapter();
|
||||
}
|
||||
}
|
||||
}
|
||||
return this.b;
|
||||
}
|
||||
}
|
||||
|
||||
public static class LoadStatus {
|
||||
private final EngineJob<?> a;
|
||||
private final ResourceCallback b;
|
||||
|
||||
LoadStatus(ResourceCallback resourceCallback, EngineJob<?> engineJob) {
|
||||
this.b = resourceCallback;
|
||||
this.a = engineJob;
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.a.b(this.b);
|
||||
}
|
||||
}
|
||||
|
||||
public Engine(MemoryCache memoryCache, DiskCache.Factory factory, GlideExecutor glideExecutor, GlideExecutor glideExecutor2, GlideExecutor glideExecutor3, GlideExecutor glideExecutor4, boolean z) {
|
||||
this(memoryCache, factory, glideExecutor, glideExecutor2, glideExecutor3, glideExecutor4, null, null, null, null, null, null, z);
|
||||
}
|
||||
|
||||
private EngineResource<?> b(Key key, boolean z) {
|
||||
if (!z) {
|
||||
return null;
|
||||
}
|
||||
EngineResource<?> a = a(key);
|
||||
if (a != null) {
|
||||
a.c();
|
||||
this.h.a(key, a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public <R> LoadStatus a(GlideContext glideContext, Object obj, Key key, int i2, int i3, Class<?> cls, Class<R> cls2, Priority priority, DiskCacheStrategy diskCacheStrategy, Map<Class<?>, Transformation<?>> map, boolean z, boolean z2, Options options, boolean z3, boolean z4, boolean z5, boolean z6, ResourceCallback resourceCallback) {
|
||||
Util.b();
|
||||
long a = i ? LogTime.a() : 0L;
|
||||
EngineKey a2 = this.b.a(obj, key, i2, i3, map, cls, cls2, options);
|
||||
EngineResource<?> a3 = a(a2, z3);
|
||||
if (a3 != null) {
|
||||
resourceCallback.a(a3, DataSource.MEMORY_CACHE);
|
||||
if (i) {
|
||||
a("Loaded resource from active resources", a, a2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
EngineResource<?> b = b(a2, z3);
|
||||
if (b != null) {
|
||||
resourceCallback.a(b, DataSource.MEMORY_CACHE);
|
||||
if (i) {
|
||||
a("Loaded resource from cache", a, a2);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
EngineJob<?> a4 = this.a.a(a2, z6);
|
||||
if (a4 != null) {
|
||||
a4.a(resourceCallback);
|
||||
if (i) {
|
||||
a("Added to existing load", a, a2);
|
||||
}
|
||||
return new LoadStatus(resourceCallback, a4);
|
||||
}
|
||||
EngineJob<R> a5 = this.d.a(a2, z3, z4, z5, z6);
|
||||
DecodeJob<R> a6 = this.g.a(glideContext, obj, a2, key, i2, i3, cls, cls2, priority, diskCacheStrategy, map, z, z2, z6, options, a5);
|
||||
this.a.a((Key) a2, (EngineJob<?>) a5);
|
||||
a5.a(resourceCallback);
|
||||
a5.b(a6);
|
||||
if (i) {
|
||||
a("Started new load", a, a2);
|
||||
}
|
||||
return new LoadStatus(resourceCallback, a5);
|
||||
}
|
||||
|
||||
Engine(MemoryCache memoryCache, DiskCache.Factory factory, GlideExecutor glideExecutor, GlideExecutor glideExecutor2, GlideExecutor glideExecutor3, GlideExecutor glideExecutor4, Jobs jobs, EngineKeyFactory engineKeyFactory, ActiveResources activeResources, EngineJobFactory engineJobFactory, DecodeJobFactory decodeJobFactory, ResourceRecycler resourceRecycler, boolean z) {
|
||||
this.c = memoryCache;
|
||||
this.f = new LazyDiskCacheProvider(factory);
|
||||
ActiveResources activeResources2 = activeResources == null ? new ActiveResources(z) : activeResources;
|
||||
this.h = activeResources2;
|
||||
activeResources2.a(this);
|
||||
this.b = engineKeyFactory == null ? new EngineKeyFactory() : engineKeyFactory;
|
||||
this.a = jobs == null ? new Jobs() : jobs;
|
||||
this.d = engineJobFactory == null ? new EngineJobFactory(glideExecutor, glideExecutor2, glideExecutor3, glideExecutor4, this) : engineJobFactory;
|
||||
this.g = decodeJobFactory == null ? new DecodeJobFactory(this.f) : decodeJobFactory;
|
||||
this.e = resourceRecycler == null ? new ResourceRecycler() : resourceRecycler;
|
||||
memoryCache.a(this);
|
||||
}
|
||||
|
||||
public void b(Resource<?> resource) {
|
||||
Util.b();
|
||||
if (resource instanceof EngineResource) {
|
||||
((EngineResource) resource).f();
|
||||
return;
|
||||
}
|
||||
throw new IllegalArgumentException("Cannot release anything but an EngineResource");
|
||||
}
|
||||
|
||||
private static void a(String str, long j, Key key) {
|
||||
Log.v("Engine", str + " in " + LogTime.a(j) + "ms, key: " + key);
|
||||
}
|
||||
|
||||
private EngineResource<?> a(Key key, boolean z) {
|
||||
if (!z) {
|
||||
return null;
|
||||
}
|
||||
EngineResource<?> b = this.h.b(key);
|
||||
if (b != null) {
|
||||
b.c();
|
||||
}
|
||||
return b;
|
||||
}
|
||||
|
||||
private EngineResource<?> a(Key key) {
|
||||
Resource<?> a = this.c.a(key);
|
||||
if (a == null) {
|
||||
return null;
|
||||
}
|
||||
if (a instanceof EngineResource) {
|
||||
return (EngineResource) a;
|
||||
}
|
||||
return new EngineResource<>(a, true, true);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.EngineJobListener
|
||||
public void a(EngineJob<?> engineJob, Key key, EngineResource<?> engineResource) {
|
||||
Util.b();
|
||||
if (engineResource != null) {
|
||||
engineResource.a(key, this);
|
||||
if (engineResource.e()) {
|
||||
this.h.a(key, engineResource);
|
||||
}
|
||||
}
|
||||
this.a.b(key, engineJob);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.EngineJobListener
|
||||
public void a(EngineJob<?> engineJob, Key key) {
|
||||
Util.b();
|
||||
this.a.b(key, engineJob);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.MemoryCache.ResourceRemovedListener
|
||||
public void a(Resource<?> resource) {
|
||||
Util.b();
|
||||
this.e.a(resource);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.EngineResource.ResourceListener
|
||||
public void a(Key key, EngineResource<?> engineResource) {
|
||||
Util.b();
|
||||
this.h.a(key);
|
||||
if (engineResource.e()) {
|
||||
this.c.a(key, engineResource);
|
||||
} else {
|
||||
this.e.a(engineResource);
|
||||
}
|
||||
}
|
||||
|
||||
public void a() {
|
||||
this.f.a().clear();
|
||||
}
|
||||
}
|
269
sources/com/bumptech/glide/load/engine/EngineJob.java
Normal file
269
sources/com/bumptech/glide/load/engine/EngineJob.java
Normal file
@@ -0,0 +1,269 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.engine.DecodeJob;
|
||||
import com.bumptech.glide.load.engine.executor.GlideExecutor;
|
||||
import com.bumptech.glide.request.ResourceCallback;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import com.bumptech.glide.util.pool.StateVerifier;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class EngineJob<R> implements DecodeJob.Callback<R>, FactoryPools.Poolable {
|
||||
private static final EngineResourceFactory y = new EngineResourceFactory();
|
||||
private static final Handler z = new Handler(Looper.getMainLooper(), new MainThreadCallback());
|
||||
private final List<ResourceCallback> a;
|
||||
private final StateVerifier b;
|
||||
private final Pools$Pool<EngineJob<?>> c;
|
||||
private final EngineResourceFactory d;
|
||||
private final EngineJobListener e;
|
||||
private final GlideExecutor f;
|
||||
private final GlideExecutor g;
|
||||
private final GlideExecutor h;
|
||||
private final GlideExecutor i;
|
||||
private Key j;
|
||||
private boolean k;
|
||||
private boolean l;
|
||||
private boolean m;
|
||||
private boolean n;
|
||||
private Resource<?> o;
|
||||
private DataSource p;
|
||||
private boolean q;
|
||||
private GlideException r;
|
||||
private boolean s;
|
||||
private List<ResourceCallback> t;
|
||||
private EngineResource<?> u;
|
||||
private DecodeJob<R> v;
|
||||
private volatile boolean x;
|
||||
|
||||
static class EngineResourceFactory {
|
||||
EngineResourceFactory() {
|
||||
}
|
||||
|
||||
public <R> EngineResource<R> a(Resource<R> resource, boolean z) {
|
||||
return new EngineResource<>(resource, z, true);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MainThreadCallback implements Handler.Callback {
|
||||
MainThreadCallback() {
|
||||
}
|
||||
|
||||
@Override // android.os.Handler.Callback
|
||||
public boolean handleMessage(Message message) {
|
||||
EngineJob engineJob = (EngineJob) message.obj;
|
||||
int i = message.what;
|
||||
if (i == 1) {
|
||||
engineJob.e();
|
||||
} else if (i == 2) {
|
||||
engineJob.d();
|
||||
} else {
|
||||
if (i != 3) {
|
||||
throw new IllegalStateException("Unrecognized message: " + message.what);
|
||||
}
|
||||
engineJob.b();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
EngineJob(GlideExecutor glideExecutor, GlideExecutor glideExecutor2, GlideExecutor glideExecutor3, GlideExecutor glideExecutor4, EngineJobListener engineJobListener, Pools$Pool<EngineJob<?>> pools$Pool) {
|
||||
this(glideExecutor, glideExecutor2, glideExecutor3, glideExecutor4, engineJobListener, pools$Pool, y);
|
||||
}
|
||||
|
||||
private void c(ResourceCallback resourceCallback) {
|
||||
if (this.t == null) {
|
||||
this.t = new ArrayList(2);
|
||||
}
|
||||
if (this.t.contains(resourceCallback)) {
|
||||
return;
|
||||
}
|
||||
this.t.add(resourceCallback);
|
||||
}
|
||||
|
||||
private boolean d(ResourceCallback resourceCallback) {
|
||||
List<ResourceCallback> list = this.t;
|
||||
return list != null && list.contains(resourceCallback);
|
||||
}
|
||||
|
||||
private GlideExecutor g() {
|
||||
return this.l ? this.h : this.m ? this.i : this.g;
|
||||
}
|
||||
|
||||
EngineJob<R> a(Key key, boolean z2, boolean z3, boolean z4, boolean z5) {
|
||||
this.j = key;
|
||||
this.k = z2;
|
||||
this.l = z3;
|
||||
this.m = z4;
|
||||
this.n = z5;
|
||||
return this;
|
||||
}
|
||||
|
||||
public void b(DecodeJob<R> decodeJob) {
|
||||
this.v = decodeJob;
|
||||
(decodeJob.e() ? this.f : g()).execute(decodeJob);
|
||||
}
|
||||
|
||||
void e() {
|
||||
this.b.a();
|
||||
if (this.x) {
|
||||
this.o.a();
|
||||
a(false);
|
||||
return;
|
||||
}
|
||||
if (this.a.isEmpty()) {
|
||||
throw new IllegalStateException("Received a resource without any callbacks to notify");
|
||||
}
|
||||
if (this.q) {
|
||||
throw new IllegalStateException("Already have resource");
|
||||
}
|
||||
this.u = this.d.a(this.o, this.k);
|
||||
this.q = true;
|
||||
this.u.c();
|
||||
this.e.a(this, this.j, this.u);
|
||||
int size = this.a.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
ResourceCallback resourceCallback = this.a.get(i);
|
||||
if (!d(resourceCallback)) {
|
||||
this.u.c();
|
||||
resourceCallback.a(this.u, this.p);
|
||||
}
|
||||
}
|
||||
this.u.f();
|
||||
a(false);
|
||||
}
|
||||
|
||||
boolean f() {
|
||||
return this.n;
|
||||
}
|
||||
|
||||
EngineJob(GlideExecutor glideExecutor, GlideExecutor glideExecutor2, GlideExecutor glideExecutor3, GlideExecutor glideExecutor4, EngineJobListener engineJobListener, Pools$Pool<EngineJob<?>> pools$Pool, EngineResourceFactory engineResourceFactory) {
|
||||
this.a = new ArrayList(2);
|
||||
this.b = StateVerifier.b();
|
||||
this.f = glideExecutor;
|
||||
this.g = glideExecutor2;
|
||||
this.h = glideExecutor3;
|
||||
this.i = glideExecutor4;
|
||||
this.e = engineJobListener;
|
||||
this.c = pools$Pool;
|
||||
this.d = engineResourceFactory;
|
||||
}
|
||||
|
||||
void d() {
|
||||
this.b.a();
|
||||
if (this.x) {
|
||||
a(false);
|
||||
return;
|
||||
}
|
||||
if (this.a.isEmpty()) {
|
||||
throw new IllegalStateException("Received an exception without any callbacks to notify");
|
||||
}
|
||||
if (this.s) {
|
||||
throw new IllegalStateException("Already failed once");
|
||||
}
|
||||
this.s = true;
|
||||
this.e.a(this, this.j, null);
|
||||
for (ResourceCallback resourceCallback : this.a) {
|
||||
if (!d(resourceCallback)) {
|
||||
resourceCallback.a(this.r);
|
||||
}
|
||||
}
|
||||
a(false);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Poolable
|
||||
public StateVerifier c() {
|
||||
return this.b;
|
||||
}
|
||||
|
||||
void a(ResourceCallback resourceCallback) {
|
||||
Util.b();
|
||||
this.b.a();
|
||||
if (this.q) {
|
||||
resourceCallback.a(this.u, this.p);
|
||||
} else if (this.s) {
|
||||
resourceCallback.a(this.r);
|
||||
} else {
|
||||
this.a.add(resourceCallback);
|
||||
}
|
||||
}
|
||||
|
||||
void b(ResourceCallback resourceCallback) {
|
||||
Util.b();
|
||||
this.b.a();
|
||||
if (!this.q && !this.s) {
|
||||
this.a.remove(resourceCallback);
|
||||
if (this.a.isEmpty()) {
|
||||
a();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
c(resourceCallback);
|
||||
}
|
||||
|
||||
void a() {
|
||||
if (this.s || this.q || this.x) {
|
||||
return;
|
||||
}
|
||||
this.x = true;
|
||||
this.v.cancel();
|
||||
this.e.a(this, this.j);
|
||||
}
|
||||
|
||||
void b() {
|
||||
this.b.a();
|
||||
if (this.x) {
|
||||
this.e.a(this, this.j);
|
||||
a(false);
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("Not cancelled");
|
||||
}
|
||||
|
||||
private void a(boolean z2) {
|
||||
Util.b();
|
||||
this.a.clear();
|
||||
this.j = null;
|
||||
this.u = null;
|
||||
this.o = null;
|
||||
List<ResourceCallback> list = this.t;
|
||||
if (list != null) {
|
||||
list.clear();
|
||||
}
|
||||
this.s = false;
|
||||
this.x = false;
|
||||
this.q = false;
|
||||
this.v.a(z2);
|
||||
this.v = null;
|
||||
this.r = null;
|
||||
this.p = null;
|
||||
this.c.a(this);
|
||||
}
|
||||
|
||||
/* JADX WARN: Multi-variable type inference failed */
|
||||
@Override // com.bumptech.glide.load.engine.DecodeJob.Callback
|
||||
public void a(Resource<R> resource, DataSource dataSource) {
|
||||
this.o = resource;
|
||||
this.p = dataSource;
|
||||
z.obtainMessage(1, this).sendToTarget();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DecodeJob.Callback
|
||||
public void a(GlideException glideException) {
|
||||
this.r = glideException;
|
||||
z.obtainMessage(2, this).sendToTarget();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DecodeJob.Callback
|
||||
public void a(DecodeJob<?> decodeJob) {
|
||||
g().execute(decodeJob);
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface EngineJobListener {
|
||||
void a(EngineJob<?> engineJob, Key key);
|
||||
|
||||
void a(EngineJob<?> engineJob, Key key, EngineResource<?> engineResource);
|
||||
}
|
71
sources/com/bumptech/glide/load/engine/EngineKey.java
Normal file
71
sources/com/bumptech/glide/load/engine/EngineKey.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.security.MessageDigest;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class EngineKey implements Key {
|
||||
private final Object b;
|
||||
private final int c;
|
||||
private final int d;
|
||||
private final Class<?> e;
|
||||
private final Class<?> f;
|
||||
private final Key g;
|
||||
private final Map<Class<?>, Transformation<?>> h;
|
||||
private final Options i;
|
||||
private int j;
|
||||
|
||||
EngineKey(Object obj, Key key, int i, int i2, Map<Class<?>, Transformation<?>> map, Class<?> cls, Class<?> cls2, Options options) {
|
||||
Preconditions.a(obj);
|
||||
this.b = obj;
|
||||
Preconditions.a(key, "Signature must not be null");
|
||||
this.g = key;
|
||||
this.c = i;
|
||||
this.d = i2;
|
||||
Preconditions.a(map);
|
||||
this.h = map;
|
||||
Preconditions.a(cls, "Resource class must not be null");
|
||||
this.e = cls;
|
||||
Preconditions.a(cls2, "Transcode class must not be null");
|
||||
this.f = cls2;
|
||||
Preconditions.a(options);
|
||||
this.i = options;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof EngineKey)) {
|
||||
return false;
|
||||
}
|
||||
EngineKey engineKey = (EngineKey) obj;
|
||||
return this.b.equals(engineKey.b) && this.g.equals(engineKey.g) && this.d == engineKey.d && this.c == engineKey.c && this.h.equals(engineKey.h) && this.e.equals(engineKey.e) && this.f.equals(engineKey.f) && this.i.equals(engineKey.i);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public int hashCode() {
|
||||
if (this.j == 0) {
|
||||
this.j = this.b.hashCode();
|
||||
this.j = (this.j * 31) + this.g.hashCode();
|
||||
this.j = (this.j * 31) + this.c;
|
||||
this.j = (this.j * 31) + this.d;
|
||||
this.j = (this.j * 31) + this.h.hashCode();
|
||||
this.j = (this.j * 31) + this.e.hashCode();
|
||||
this.j = (this.j * 31) + this.f.hashCode();
|
||||
this.j = (this.j * 31) + this.i.hashCode();
|
||||
}
|
||||
return this.j;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "EngineKey{model=" + this.b + ", width=" + this.c + ", height=" + this.d + ", resourceClass=" + this.e + ", transcodeClass=" + this.f + ", signature=" + this.g + ", hashCode=" + this.j + ", transformations=" + this.h + ", options=" + this.i + '}';
|
||||
}
|
||||
}
|
16
sources/com/bumptech/glide/load/engine/EngineKeyFactory.java
Normal file
16
sources/com/bumptech/glide/load/engine/EngineKeyFactory.java
Normal file
@@ -0,0 +1,16 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class EngineKeyFactory {
|
||||
EngineKeyFactory() {
|
||||
}
|
||||
|
||||
EngineKey a(Object obj, Key key, int i, int i2, Map<Class<?>, Transformation<?>> map, Class<?> cls, Class<?> cls2, Options options) {
|
||||
return new EngineKey(obj, key, i, i2, map, cls, cls2, options);
|
||||
}
|
||||
}
|
99
sources/com/bumptech/glide/load/engine/EngineResource.java
Normal file
99
sources/com/bumptech/glide/load/engine/EngineResource.java
Normal file
@@ -0,0 +1,99 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.os.Looper;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class EngineResource<Z> implements Resource<Z> {
|
||||
private final boolean a;
|
||||
private final boolean b;
|
||||
private ResourceListener c;
|
||||
private Key d;
|
||||
private int e;
|
||||
private boolean f;
|
||||
private final Resource<Z> g;
|
||||
|
||||
interface ResourceListener {
|
||||
void a(Key key, EngineResource<?> engineResource);
|
||||
}
|
||||
|
||||
EngineResource(Resource<Z> resource, boolean z, boolean z2) {
|
||||
Preconditions.a(resource);
|
||||
this.g = resource;
|
||||
this.a = z;
|
||||
this.b = z2;
|
||||
}
|
||||
|
||||
void a(Key key, ResourceListener resourceListener) {
|
||||
this.d = key;
|
||||
this.c = resourceListener;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Class<Z> b() {
|
||||
return this.g.b();
|
||||
}
|
||||
|
||||
void c() {
|
||||
if (this.f) {
|
||||
throw new IllegalStateException("Cannot acquire a recycled resource");
|
||||
}
|
||||
if (!Looper.getMainLooper().equals(Looper.myLooper())) {
|
||||
throw new IllegalThreadStateException("Must call acquire on the main thread");
|
||||
}
|
||||
this.e++;
|
||||
}
|
||||
|
||||
Resource<Z> d() {
|
||||
return this.g;
|
||||
}
|
||||
|
||||
boolean e() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
void f() {
|
||||
if (this.e <= 0) {
|
||||
throw new IllegalStateException("Cannot release a recycled or not yet acquired resource");
|
||||
}
|
||||
if (!Looper.getMainLooper().equals(Looper.myLooper())) {
|
||||
throw new IllegalThreadStateException("Must call release on the main thread");
|
||||
}
|
||||
int i = this.e - 1;
|
||||
this.e = i;
|
||||
if (i == 0) {
|
||||
this.c.a(this.d, this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Z get() {
|
||||
return this.g.get();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public int getSize() {
|
||||
return this.g.getSize();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "EngineResource{isCacheable=" + this.a + ", listener=" + this.c + ", key=" + this.d + ", acquired=" + this.e + ", isRecycled=" + this.f + ", resource=" + this.g + '}';
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public void a() {
|
||||
if (this.e <= 0) {
|
||||
if (!this.f) {
|
||||
this.f = true;
|
||||
if (this.b) {
|
||||
this.g.a();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
throw new IllegalStateException("Cannot recycle a resource that has already been recycled");
|
||||
}
|
||||
throw new IllegalStateException("Cannot recycle a resource while it is still acquired");
|
||||
}
|
||||
}
|
218
sources/com/bumptech/glide/load/engine/GlideException.java
Normal file
218
sources/com/bumptech/glide/load/engine/GlideException.java
Normal file
@@ -0,0 +1,218 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class GlideException extends Exception {
|
||||
private static final StackTraceElement[] EMPTY_ELEMENTS = new StackTraceElement[0];
|
||||
private static final long serialVersionUID = 1;
|
||||
private final List<Throwable> causes;
|
||||
private Class<?> dataClass;
|
||||
private DataSource dataSource;
|
||||
private String detailMessage;
|
||||
private Key key;
|
||||
|
||||
public GlideException(String str) {
|
||||
this(str, (List<Throwable>) Collections.emptyList());
|
||||
}
|
||||
|
||||
private void addRootCauses(Throwable th, List<Throwable> list) {
|
||||
if (!(th instanceof GlideException)) {
|
||||
list.add(th);
|
||||
return;
|
||||
}
|
||||
Iterator<Throwable> it = ((GlideException) th).getCauses().iterator();
|
||||
while (it.hasNext()) {
|
||||
addRootCauses(it.next(), list);
|
||||
}
|
||||
}
|
||||
|
||||
private static void appendCauses(List<Throwable> list, Appendable appendable) {
|
||||
try {
|
||||
appendCausesWrapped(list, appendable);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void appendCausesWrapped(List<Throwable> list, Appendable appendable) throws IOException {
|
||||
int size = list.size();
|
||||
int i = 0;
|
||||
while (i < size) {
|
||||
int i2 = i + 1;
|
||||
appendable.append("Cause (").append(String.valueOf(i2)).append(" of ").append(String.valueOf(size)).append("): ");
|
||||
Throwable th = list.get(i);
|
||||
if (th instanceof GlideException) {
|
||||
((GlideException) th).printStackTrace(appendable);
|
||||
} else {
|
||||
appendExceptionMessage(th, appendable);
|
||||
}
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
|
||||
private static void appendExceptionMessage(Throwable th, Appendable appendable) {
|
||||
try {
|
||||
appendable.append(th.getClass().toString()).append(": ").append(th.getMessage()).append('\n');
|
||||
} catch (IOException unused) {
|
||||
throw new RuntimeException(th);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Throwable> getCauses() {
|
||||
return this.causes;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public String getMessage() {
|
||||
StringBuilder sb = new StringBuilder(71);
|
||||
sb.append(this.detailMessage);
|
||||
sb.append(this.dataClass != null ? ", " + this.dataClass : "");
|
||||
sb.append(this.dataSource != null ? ", " + this.dataSource : "");
|
||||
sb.append(this.key != null ? ", " + this.key : "");
|
||||
List<Throwable> rootCauses = getRootCauses();
|
||||
if (rootCauses.isEmpty()) {
|
||||
return sb.toString();
|
||||
}
|
||||
if (rootCauses.size() == 1) {
|
||||
sb.append("\nThere was 1 cause:");
|
||||
} else {
|
||||
sb.append("\nThere were ");
|
||||
sb.append(rootCauses.size());
|
||||
sb.append(" causes:");
|
||||
}
|
||||
for (Throwable th : rootCauses) {
|
||||
sb.append('\n');
|
||||
sb.append(th.getClass().getName());
|
||||
sb.append('(');
|
||||
sb.append(th.getMessage());
|
||||
sb.append(')');
|
||||
}
|
||||
sb.append("\n call GlideException#logRootCauses(String) for more detail");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public List<Throwable> getRootCauses() {
|
||||
ArrayList arrayList = new ArrayList();
|
||||
addRootCauses(this, arrayList);
|
||||
return arrayList;
|
||||
}
|
||||
|
||||
public void logRootCauses(String str) {
|
||||
List<Throwable> rootCauses = getRootCauses();
|
||||
int size = rootCauses.size();
|
||||
int i = 0;
|
||||
while (i < size) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Root cause (");
|
||||
int i2 = i + 1;
|
||||
sb.append(i2);
|
||||
sb.append(" of ");
|
||||
sb.append(size);
|
||||
sb.append(")");
|
||||
Log.i(str, sb.toString(), rootCauses.get(i));
|
||||
i = i2;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace() {
|
||||
printStackTrace(System.err);
|
||||
}
|
||||
|
||||
void setLoggingDetails(Key key, DataSource dataSource) {
|
||||
setLoggingDetails(key, dataSource, null);
|
||||
}
|
||||
|
||||
public GlideException(String str, Throwable th) {
|
||||
this(str, (List<Throwable>) Collections.singletonList(th));
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace(PrintStream printStream) {
|
||||
printStackTrace((Appendable) printStream);
|
||||
}
|
||||
|
||||
void setLoggingDetails(Key key, DataSource dataSource, Class<?> cls) {
|
||||
this.key = key;
|
||||
this.dataSource = dataSource;
|
||||
this.dataClass = cls;
|
||||
}
|
||||
|
||||
public GlideException(String str, List<Throwable> list) {
|
||||
this.detailMessage = str;
|
||||
setStackTrace(EMPTY_ELEMENTS);
|
||||
this.causes = list;
|
||||
}
|
||||
|
||||
@Override // java.lang.Throwable
|
||||
public void printStackTrace(PrintWriter printWriter) {
|
||||
printStackTrace((Appendable) printWriter);
|
||||
}
|
||||
|
||||
private void printStackTrace(Appendable appendable) {
|
||||
appendExceptionMessage(this, appendable);
|
||||
appendCauses(getCauses(), new IndentedAppendable(appendable));
|
||||
}
|
||||
|
||||
private static final class IndentedAppendable implements Appendable {
|
||||
private final Appendable a;
|
||||
private boolean b = true;
|
||||
|
||||
IndentedAppendable(Appendable appendable) {
|
||||
this.a = appendable;
|
||||
}
|
||||
|
||||
private CharSequence a(CharSequence charSequence) {
|
||||
return charSequence == null ? "" : charSequence;
|
||||
}
|
||||
|
||||
@Override // java.lang.Appendable
|
||||
public Appendable append(char c) throws IOException {
|
||||
if (this.b) {
|
||||
this.b = false;
|
||||
this.a.append(" ");
|
||||
}
|
||||
this.b = c == '\n';
|
||||
this.a.append(c);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // java.lang.Appendable
|
||||
public Appendable append(CharSequence charSequence) throws IOException {
|
||||
CharSequence a = a(charSequence);
|
||||
append(a, 0, a.length());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override // java.lang.Appendable
|
||||
public Appendable append(CharSequence charSequence, int i, int i2) throws IOException {
|
||||
CharSequence a = a(charSequence);
|
||||
boolean z = false;
|
||||
if (this.b) {
|
||||
this.b = false;
|
||||
this.a.append(" ");
|
||||
}
|
||||
if (a.length() > 0 && a.charAt(i2 - 1) == '\n') {
|
||||
z = true;
|
||||
}
|
||||
this.b = z;
|
||||
this.a.append(a, i, i2);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Initializable {
|
||||
void c();
|
||||
}
|
33
sources/com/bumptech/glide/load/engine/Jobs.java
Normal file
33
sources/com/bumptech/glide/load/engine/Jobs.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class Jobs {
|
||||
private final Map<Key, EngineJob<?>> a = new HashMap();
|
||||
private final Map<Key, EngineJob<?>> b = new HashMap();
|
||||
|
||||
Jobs() {
|
||||
}
|
||||
|
||||
EngineJob<?> a(Key key, boolean z) {
|
||||
return a(z).get(key);
|
||||
}
|
||||
|
||||
void b(Key key, EngineJob<?> engineJob) {
|
||||
Map<Key, EngineJob<?>> a = a(engineJob.f());
|
||||
if (engineJob.equals(a.get(key))) {
|
||||
a.remove(key);
|
||||
}
|
||||
}
|
||||
|
||||
void a(Key key, EngineJob<?> engineJob) {
|
||||
a(engineJob.f()).put(key, engineJob);
|
||||
}
|
||||
|
||||
private Map<Key, EngineJob<?>> a(boolean z) {
|
||||
return z ? this.b : this.a;
|
||||
}
|
||||
}
|
58
sources/com/bumptech/glide/load/engine/LoadPath.java
Normal file
58
sources/com/bumptech/glide/load/engine/LoadPath.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.data.DataRewinder;
|
||||
import com.bumptech.glide.load.engine.DecodePath;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LoadPath<Data, ResourceType, Transcode> {
|
||||
private final Pools$Pool<List<Throwable>> a;
|
||||
private final List<? extends DecodePath<Data, ResourceType, Transcode>> b;
|
||||
private final String c;
|
||||
|
||||
public LoadPath(Class<Data> cls, Class<ResourceType> cls2, Class<Transcode> cls3, List<DecodePath<Data, ResourceType, Transcode>> list, Pools$Pool<List<Throwable>> pools$Pool) {
|
||||
this.a = pools$Pool;
|
||||
Preconditions.a(list);
|
||||
this.b = list;
|
||||
this.c = "Failed LoadPath{" + cls.getSimpleName() + "->" + cls2.getSimpleName() + "->" + cls3.getSimpleName() + "}";
|
||||
}
|
||||
|
||||
public Resource<Transcode> a(DataRewinder<Data> dataRewinder, Options options, int i, int i2, DecodePath.DecodeCallback<ResourceType> decodeCallback) throws GlideException {
|
||||
List<Throwable> a = this.a.a();
|
||||
Preconditions.a(a);
|
||||
List<Throwable> list = a;
|
||||
try {
|
||||
return a(dataRewinder, options, i, i2, decodeCallback, list);
|
||||
} finally {
|
||||
this.a.a(list);
|
||||
}
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "LoadPath{decodePaths=" + Arrays.toString(this.b.toArray()) + '}';
|
||||
}
|
||||
|
||||
private Resource<Transcode> a(DataRewinder<Data> dataRewinder, Options options, int i, int i2, DecodePath.DecodeCallback<ResourceType> decodeCallback, List<Throwable> list) throws GlideException {
|
||||
int size = this.b.size();
|
||||
Resource<Transcode> resource = null;
|
||||
for (int i3 = 0; i3 < size; i3++) {
|
||||
try {
|
||||
resource = this.b.get(i3).a(dataRewinder, i, i2, options, decodeCallback);
|
||||
} catch (GlideException e) {
|
||||
list.add(e);
|
||||
}
|
||||
if (resource != null) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resource != null) {
|
||||
return resource;
|
||||
}
|
||||
throw new GlideException(this.c, new ArrayList(list));
|
||||
}
|
||||
}
|
84
sources/com/bumptech/glide/load/engine/LockedResource.java
Normal file
84
sources/com/bumptech/glide/load/engine/LockedResource.java
Normal file
@@ -0,0 +1,84 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import androidx.core.util.Pools$Pool;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import com.bumptech.glide.util.pool.FactoryPools;
|
||||
import com.bumptech.glide.util.pool.StateVerifier;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class LockedResource<Z> implements Resource<Z>, FactoryPools.Poolable {
|
||||
private static final Pools$Pool<LockedResource<?>> e = FactoryPools.b(20, new FactoryPools.Factory<LockedResource<?>>() { // from class: com.bumptech.glide.load.engine.LockedResource.1
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Factory
|
||||
public LockedResource<?> a() {
|
||||
return new LockedResource<>();
|
||||
}
|
||||
});
|
||||
private final StateVerifier a = StateVerifier.b();
|
||||
private Resource<Z> b;
|
||||
private boolean c;
|
||||
private boolean d;
|
||||
|
||||
LockedResource() {
|
||||
}
|
||||
|
||||
private void a(Resource<Z> resource) {
|
||||
this.d = false;
|
||||
this.c = true;
|
||||
this.b = resource;
|
||||
}
|
||||
|
||||
static <Z> LockedResource<Z> b(Resource<Z> resource) {
|
||||
LockedResource a = e.a();
|
||||
Preconditions.a(a);
|
||||
LockedResource lockedResource = a;
|
||||
lockedResource.a(resource);
|
||||
return lockedResource;
|
||||
}
|
||||
|
||||
private void e() {
|
||||
this.b = null;
|
||||
e.a(this);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.util.pool.FactoryPools.Poolable
|
||||
public StateVerifier c() {
|
||||
return this.a;
|
||||
}
|
||||
|
||||
synchronized void d() {
|
||||
this.a.a();
|
||||
if (!this.c) {
|
||||
throw new IllegalStateException("Already unlocked");
|
||||
}
|
||||
this.c = false;
|
||||
if (this.d) {
|
||||
a();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Z get() {
|
||||
return this.b.get();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public int getSize() {
|
||||
return this.b.getSize();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public Class<Z> b() {
|
||||
return this.b.b();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.Resource
|
||||
public synchronized void a() {
|
||||
this.a.a();
|
||||
this.d = true;
|
||||
if (!this.c) {
|
||||
this.b.a();
|
||||
e();
|
||||
}
|
||||
}
|
||||
}
|
12
sources/com/bumptech/glide/load/engine/Resource.java
Normal file
12
sources/com/bumptech/glide/load/engine/Resource.java
Normal file
@@ -0,0 +1,12 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface Resource<Z> {
|
||||
void a();
|
||||
|
||||
Class<Z> b();
|
||||
|
||||
Z get();
|
||||
|
||||
int getSize();
|
||||
}
|
@@ -0,0 +1,97 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.engine.DataFetcherGenerator;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ResourceCacheGenerator implements DataFetcherGenerator, DataFetcher.DataCallback<Object> {
|
||||
private final DataFetcherGenerator.FetcherReadyCallback a;
|
||||
private final DecodeHelper<?> b;
|
||||
private int c;
|
||||
private int d = -1;
|
||||
private Key e;
|
||||
private List<ModelLoader<File, ?>> f;
|
||||
private int g;
|
||||
private volatile ModelLoader.LoadData<?> h;
|
||||
private File i;
|
||||
private ResourceCacheKey j;
|
||||
|
||||
ResourceCacheGenerator(DecodeHelper<?> decodeHelper, DataFetcherGenerator.FetcherReadyCallback fetcherReadyCallback) {
|
||||
this.b = decodeHelper;
|
||||
this.a = fetcherReadyCallback;
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
return this.g < this.f.size();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public boolean a() {
|
||||
List<Key> c = this.b.c();
|
||||
boolean z = false;
|
||||
if (c.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
List<Class<?>> j = this.b.j();
|
||||
if (j.isEmpty() && File.class.equals(this.b.l())) {
|
||||
return false;
|
||||
}
|
||||
while (true) {
|
||||
if (this.f != null && b()) {
|
||||
this.h = null;
|
||||
while (!z && b()) {
|
||||
List<ModelLoader<File, ?>> list = this.f;
|
||||
int i = this.g;
|
||||
this.g = i + 1;
|
||||
this.h = list.get(i).a(this.i, this.b.m(), this.b.f(), this.b.h());
|
||||
if (this.h != null && this.b.c(this.h.c.a())) {
|
||||
this.h.c.a(this.b.i(), this);
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
this.d++;
|
||||
if (this.d >= j.size()) {
|
||||
this.c++;
|
||||
if (this.c >= c.size()) {
|
||||
return false;
|
||||
}
|
||||
this.d = 0;
|
||||
}
|
||||
Key key = c.get(this.c);
|
||||
Class<?> cls = j.get(this.d);
|
||||
this.j = new ResourceCacheKey(this.b.b(), key, this.b.k(), this.b.m(), this.b.f(), this.b.b(cls), cls, this.b.h());
|
||||
this.i = this.b.d().a(this.j);
|
||||
File file = this.i;
|
||||
if (file != null) {
|
||||
this.e = key;
|
||||
this.f = this.b.a(file);
|
||||
this.g = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public void cancel() {
|
||||
ModelLoader.LoadData<?> loadData = this.h;
|
||||
if (loadData != null) {
|
||||
loadData.c.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Object obj) {
|
||||
this.a.a(this.e, obj, this.h.c, DataSource.RESOURCE_DISK_CACHE, this.j);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Exception exc) {
|
||||
this.a.a(this.j, exc, this.h.c, DataSource.RESOURCE_DISK_CACHE);
|
||||
}
|
||||
}
|
83
sources/com/bumptech/glide/load/engine/ResourceCacheKey.java
Normal file
83
sources/com/bumptech/glide/load/engine/ResourceCacheKey.java
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.Options;
|
||||
import com.bumptech.glide.load.Transformation;
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool;
|
||||
import com.bumptech.glide.util.LruCache;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.security.MessageDigest;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class ResourceCacheKey implements Key {
|
||||
private static final LruCache<Class<?>, byte[]> j = new LruCache<>(50);
|
||||
private final ArrayPool b;
|
||||
private final Key c;
|
||||
private final Key d;
|
||||
private final int e;
|
||||
private final int f;
|
||||
private final Class<?> g;
|
||||
private final Options h;
|
||||
private final Transformation<?> i;
|
||||
|
||||
ResourceCacheKey(ArrayPool arrayPool, Key key, Key key2, int i, int i2, Transformation<?> transformation, Class<?> cls, Options options) {
|
||||
this.b = arrayPool;
|
||||
this.c = key;
|
||||
this.d = key2;
|
||||
this.e = i;
|
||||
this.f = i2;
|
||||
this.i = transformation;
|
||||
this.g = cls;
|
||||
this.h = options;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public void a(MessageDigest messageDigest) {
|
||||
byte[] bArr = (byte[]) this.b.a(8, byte[].class);
|
||||
ByteBuffer.wrap(bArr).putInt(this.e).putInt(this.f).array();
|
||||
this.d.a(messageDigest);
|
||||
this.c.a(messageDigest);
|
||||
messageDigest.update(bArr);
|
||||
Transformation<?> transformation = this.i;
|
||||
if (transformation != null) {
|
||||
transformation.a(messageDigest);
|
||||
}
|
||||
this.h.a(messageDigest);
|
||||
messageDigest.update(a());
|
||||
this.b.put(bArr);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof ResourceCacheKey)) {
|
||||
return false;
|
||||
}
|
||||
ResourceCacheKey resourceCacheKey = (ResourceCacheKey) obj;
|
||||
return this.f == resourceCacheKey.f && this.e == resourceCacheKey.e && Util.b(this.i, resourceCacheKey.i) && this.g.equals(resourceCacheKey.g) && this.c.equals(resourceCacheKey.c) && this.d.equals(resourceCacheKey.d) && this.h.equals(resourceCacheKey.h);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.Key
|
||||
public int hashCode() {
|
||||
int hashCode = (((((this.c.hashCode() * 31) + this.d.hashCode()) * 31) + this.e) * 31) + this.f;
|
||||
Transformation<?> transformation = this.i;
|
||||
if (transformation != null) {
|
||||
hashCode = (hashCode * 31) + transformation.hashCode();
|
||||
}
|
||||
return (((hashCode * 31) + this.g.hashCode()) * 31) + this.h.hashCode();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "ResourceCacheKey{sourceKey=" + this.c + ", signature=" + this.d + ", width=" + this.e + ", height=" + this.f + ", decodedResourceClass=" + this.g + ", transformation='" + this.i + "', options=" + this.h + '}';
|
||||
}
|
||||
|
||||
private byte[] a() {
|
||||
byte[] a = j.a((LruCache<Class<?>, byte[]>) this.g);
|
||||
if (a != null) {
|
||||
return a;
|
||||
}
|
||||
byte[] bytes = this.g.getName().getBytes(Key.a);
|
||||
j.b(this.g, bytes);
|
||||
return bytes;
|
||||
}
|
||||
}
|
40
sources/com/bumptech/glide/load/engine/ResourceRecycler.java
Normal file
40
sources/com/bumptech/glide/load/engine/ResourceRecycler.java
Normal file
@@ -0,0 +1,40 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import com.bumptech.glide.util.Util;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class ResourceRecycler {
|
||||
private boolean a;
|
||||
private final Handler b = new Handler(Looper.getMainLooper(), new ResourceRecyclerCallback());
|
||||
|
||||
private static final class ResourceRecyclerCallback implements Handler.Callback {
|
||||
ResourceRecyclerCallback() {
|
||||
}
|
||||
|
||||
@Override // android.os.Handler.Callback
|
||||
public boolean handleMessage(Message message) {
|
||||
if (message.what != 1) {
|
||||
return false;
|
||||
}
|
||||
((Resource) message.obj).a();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
ResourceRecycler() {
|
||||
}
|
||||
|
||||
void a(Resource<?> resource) {
|
||||
Util.b();
|
||||
if (this.a) {
|
||||
this.b.obtainMessage(1, resource).sendToTarget();
|
||||
return;
|
||||
}
|
||||
this.a = true;
|
||||
resource.a();
|
||||
this.a = false;
|
||||
}
|
||||
}
|
116
sources/com/bumptech/glide/load/engine/SourceGenerator.java
Normal file
116
sources/com/bumptech/glide/load/engine/SourceGenerator.java
Normal file
@@ -0,0 +1,116 @@
|
||||
package com.bumptech.glide.load.engine;
|
||||
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.load.DataSource;
|
||||
import com.bumptech.glide.load.Encoder;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.data.DataFetcher;
|
||||
import com.bumptech.glide.load.engine.DataFetcherGenerator;
|
||||
import com.bumptech.glide.load.model.ModelLoader;
|
||||
import com.bumptech.glide.util.LogTime;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class SourceGenerator implements DataFetcherGenerator, DataFetcher.DataCallback<Object>, DataFetcherGenerator.FetcherReadyCallback {
|
||||
private final DecodeHelper<?> a;
|
||||
private final DataFetcherGenerator.FetcherReadyCallback b;
|
||||
private int c;
|
||||
private DataCacheGenerator d;
|
||||
private Object e;
|
||||
private volatile ModelLoader.LoadData<?> f;
|
||||
private DataCacheKey g;
|
||||
|
||||
SourceGenerator(DecodeHelper<?> decodeHelper, DataFetcherGenerator.FetcherReadyCallback fetcherReadyCallback) {
|
||||
this.a = decodeHelper;
|
||||
this.b = fetcherReadyCallback;
|
||||
}
|
||||
|
||||
private boolean b() {
|
||||
return this.c < this.a.g().size();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public boolean a() {
|
||||
Object obj = this.e;
|
||||
if (obj != null) {
|
||||
this.e = null;
|
||||
b(obj);
|
||||
}
|
||||
DataCacheGenerator dataCacheGenerator = this.d;
|
||||
if (dataCacheGenerator != null && dataCacheGenerator.a()) {
|
||||
return true;
|
||||
}
|
||||
this.d = null;
|
||||
this.f = null;
|
||||
boolean z = false;
|
||||
while (!z && b()) {
|
||||
List<ModelLoader.LoadData<?>> g = this.a.g();
|
||||
int i = this.c;
|
||||
this.c = i + 1;
|
||||
this.f = g.get(i);
|
||||
if (this.f != null && (this.a.e().a(this.f.c.getDataSource()) || this.a.c(this.f.c.a()))) {
|
||||
this.f.c.a(this.a.i(), this);
|
||||
z = true;
|
||||
}
|
||||
}
|
||||
return z;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator
|
||||
public void cancel() {
|
||||
ModelLoader.LoadData<?> loadData = this.f;
|
||||
if (loadData != null) {
|
||||
loadData.c.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void d() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
private void b(Object obj) {
|
||||
long a = LogTime.a();
|
||||
try {
|
||||
Encoder<X> a2 = this.a.a((DecodeHelper<?>) obj);
|
||||
DataCacheWriter dataCacheWriter = new DataCacheWriter(a2, obj, this.a.h());
|
||||
this.g = new DataCacheKey(this.f.a, this.a.k());
|
||||
this.a.d().a(this.g, dataCacheWriter);
|
||||
if (Log.isLoggable("SourceGenerator", 2)) {
|
||||
Log.v("SourceGenerator", "Finished encoding source to cache, key: " + this.g + ", data: " + obj + ", encoder: " + a2 + ", duration: " + LogTime.a(a));
|
||||
}
|
||||
this.f.c.b();
|
||||
this.d = new DataCacheGenerator(Collections.singletonList(this.f.a), this.a, this);
|
||||
} catch (Throwable th) {
|
||||
this.f.c.b();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Object obj) {
|
||||
DiskCacheStrategy e = this.a.e();
|
||||
if (obj != null && e.a(this.f.c.getDataSource())) {
|
||||
this.e = obj;
|
||||
this.b.d();
|
||||
} else {
|
||||
this.b.a(this.f.a, obj, this.f.c, this.f.c.getDataSource(), this.g);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.data.DataFetcher.DataCallback
|
||||
public void a(Exception exc) {
|
||||
this.b.a(this.g, exc, this.f.c, this.f.c.getDataSource());
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void a(Key key, Object obj, DataFetcher<?> dataFetcher, DataSource dataSource, Key key2) {
|
||||
this.b.a(key, obj, dataFetcher, this.f.c.getDataSource(), key);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.DataFetcherGenerator.FetcherReadyCallback
|
||||
public void a(Key key, Exception exc, DataFetcher<?> dataFetcher, DataSource dataSource) {
|
||||
this.b.a(key, exc, dataFetcher, this.f.c.getDataSource());
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface ArrayAdapterInterface<T> {
|
||||
int a(T t);
|
||||
|
||||
String a();
|
||||
|
||||
int b();
|
||||
|
||||
T newArray(int i);
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface ArrayPool {
|
||||
<T> T a(int i, Class<T> cls);
|
||||
|
||||
void a();
|
||||
|
||||
void a(int i);
|
||||
|
||||
<T> T b(int i, Class<T> cls);
|
||||
|
||||
<T> void put(T t);
|
||||
}
|
@@ -0,0 +1,113 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import com.bumptech.glide.util.Util;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class AttributeStrategy implements LruPoolStrategy {
|
||||
private final KeyPool a = new KeyPool();
|
||||
private final GroupedLinkedMap<Key, Bitmap> b = new GroupedLinkedMap<>();
|
||||
|
||||
static class KeyPool extends BaseKeyPool<Key> {
|
||||
KeyPool() {
|
||||
}
|
||||
|
||||
Key a(int i, int i2, Bitmap.Config config) {
|
||||
Key b = b();
|
||||
b.a(i, i2, config);
|
||||
return b;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BaseKeyPool
|
||||
public Key a() {
|
||||
return new Key(this);
|
||||
}
|
||||
}
|
||||
|
||||
AttributeStrategy() {
|
||||
}
|
||||
|
||||
private static String d(Bitmap bitmap) {
|
||||
return c(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig());
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public void a(Bitmap bitmap) {
|
||||
this.b.a(this.a.a(bitmap.getWidth(), bitmap.getHeight(), bitmap.getConfig()), bitmap);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public String b(int i, int i2, Bitmap.Config config) {
|
||||
return c(i, i2, config);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public String c(Bitmap bitmap) {
|
||||
return d(bitmap);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public Bitmap removeLast() {
|
||||
return this.b.a();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "AttributeStrategy:\n " + this.b;
|
||||
}
|
||||
|
||||
static String c(int i, int i2, Bitmap.Config config) {
|
||||
return "[" + i + "x" + i2 + "], " + config;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public int b(Bitmap bitmap) {
|
||||
return Util.a(bitmap);
|
||||
}
|
||||
|
||||
static class Key implements Poolable {
|
||||
private final KeyPool a;
|
||||
private int b;
|
||||
private int c;
|
||||
private Bitmap.Config d;
|
||||
|
||||
public Key(KeyPool keyPool) {
|
||||
this.a = keyPool;
|
||||
}
|
||||
|
||||
public void a(int i, int i2, Bitmap.Config config) {
|
||||
this.b = i;
|
||||
this.c = i2;
|
||||
this.d = config;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Key)) {
|
||||
return false;
|
||||
}
|
||||
Key key = (Key) obj;
|
||||
return this.b == key.b && this.c == key.c && this.d == key.d;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = ((this.b * 31) + this.c) * 31;
|
||||
Bitmap.Config config = this.d;
|
||||
return i + (config != null ? config.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return AttributeStrategy.c(this.b, this.c, this.d);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.Poolable
|
||||
public void a() {
|
||||
this.a.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public Bitmap a(int i, int i2, Bitmap.Config config) {
|
||||
return this.b.a((GroupedLinkedMap<Key, Bitmap>) this.a.a(i, i2, config));
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.Poolable;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.util.Queue;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
abstract class BaseKeyPool<T extends Poolable> {
|
||||
private final Queue<T> a = Util.a(20);
|
||||
|
||||
BaseKeyPool() {
|
||||
}
|
||||
|
||||
abstract T a();
|
||||
|
||||
public void a(T t) {
|
||||
if (this.a.size() < 20) {
|
||||
this.a.offer(t);
|
||||
}
|
||||
}
|
||||
|
||||
T b() {
|
||||
T poll = this.a.poll();
|
||||
return poll == null ? a() : poll;
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface BitmapPool {
|
||||
Bitmap a(int i, int i2, Bitmap.Config config);
|
||||
|
||||
void a();
|
||||
|
||||
void a(int i);
|
||||
|
||||
void a(Bitmap bitmap);
|
||||
|
||||
Bitmap b(int i, int i2, Bitmap.Config config);
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class BitmapPoolAdapter implements BitmapPool {
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public void a() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public void a(int i) {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public void a(Bitmap bitmap) {
|
||||
bitmap.recycle();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public Bitmap b(int i, int i2, Bitmap.Config config) {
|
||||
return a(i, i2, config);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public Bitmap a(int i, int i2, Bitmap.Config config) {
|
||||
return Bitmap.createBitmap(i, i2, config);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ByteArrayAdapter implements ArrayAdapterInterface<byte[]> {
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public String a() {
|
||||
return "ByteArrayPool";
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public int b() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public int a(byte[] bArr) {
|
||||
return bArr.length;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public byte[] newArray(int i) {
|
||||
return new byte[i];
|
||||
}
|
||||
}
|
@@ -0,0 +1,138 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.Poolable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
class GroupedLinkedMap<K extends Poolable, V> {
|
||||
private final LinkedEntry<K, V> a = new LinkedEntry<>();
|
||||
private final Map<K, LinkedEntry<K, V>> b = new HashMap();
|
||||
|
||||
private static class LinkedEntry<K, V> {
|
||||
final K a;
|
||||
private List<V> b;
|
||||
LinkedEntry<K, V> c;
|
||||
LinkedEntry<K, V> d;
|
||||
|
||||
LinkedEntry() {
|
||||
this(null);
|
||||
}
|
||||
|
||||
public V a() {
|
||||
int b = b();
|
||||
if (b > 0) {
|
||||
return this.b.remove(b - 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int b() {
|
||||
List<V> list = this.b;
|
||||
if (list != null) {
|
||||
return list.size();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
LinkedEntry(K k) {
|
||||
this.d = this;
|
||||
this.c = this;
|
||||
this.a = k;
|
||||
}
|
||||
|
||||
public void a(V v) {
|
||||
if (this.b == null) {
|
||||
this.b = new ArrayList();
|
||||
}
|
||||
this.b.add(v);
|
||||
}
|
||||
}
|
||||
|
||||
GroupedLinkedMap() {
|
||||
}
|
||||
|
||||
private void b(LinkedEntry<K, V> linkedEntry) {
|
||||
c(linkedEntry);
|
||||
LinkedEntry<K, V> linkedEntry2 = this.a;
|
||||
linkedEntry.d = linkedEntry2.d;
|
||||
linkedEntry.c = linkedEntry2;
|
||||
d(linkedEntry);
|
||||
}
|
||||
|
||||
private static <K, V> void c(LinkedEntry<K, V> linkedEntry) {
|
||||
LinkedEntry<K, V> linkedEntry2 = linkedEntry.d;
|
||||
linkedEntry2.c = linkedEntry.c;
|
||||
linkedEntry.c.d = linkedEntry2;
|
||||
}
|
||||
|
||||
private static <K, V> void d(LinkedEntry<K, V> linkedEntry) {
|
||||
linkedEntry.c.d = linkedEntry;
|
||||
linkedEntry.d.c = linkedEntry;
|
||||
}
|
||||
|
||||
public void a(K k, V v) {
|
||||
LinkedEntry<K, V> linkedEntry = this.b.get(k);
|
||||
if (linkedEntry == null) {
|
||||
linkedEntry = new LinkedEntry<>(k);
|
||||
b(linkedEntry);
|
||||
this.b.put(k, linkedEntry);
|
||||
} else {
|
||||
k.a();
|
||||
}
|
||||
linkedEntry.a(v);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder("GroupedLinkedMap( ");
|
||||
boolean z = false;
|
||||
for (LinkedEntry linkedEntry = this.a.c; !linkedEntry.equals(this.a); linkedEntry = linkedEntry.c) {
|
||||
z = true;
|
||||
sb.append('{');
|
||||
sb.append(linkedEntry.a);
|
||||
sb.append(':');
|
||||
sb.append(linkedEntry.b());
|
||||
sb.append("}, ");
|
||||
}
|
||||
if (z) {
|
||||
sb.delete(sb.length() - 2, sb.length());
|
||||
}
|
||||
sb.append(" )");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public V a(K k) {
|
||||
LinkedEntry<K, V> linkedEntry = this.b.get(k);
|
||||
if (linkedEntry == null) {
|
||||
linkedEntry = new LinkedEntry<>(k);
|
||||
this.b.put(k, linkedEntry);
|
||||
} else {
|
||||
k.a();
|
||||
}
|
||||
a(linkedEntry);
|
||||
return linkedEntry.a();
|
||||
}
|
||||
|
||||
public V a() {
|
||||
for (LinkedEntry linkedEntry = this.a.d; !linkedEntry.equals(this.a); linkedEntry = linkedEntry.d) {
|
||||
V v = (V) linkedEntry.a();
|
||||
if (v != null) {
|
||||
return v;
|
||||
}
|
||||
c(linkedEntry);
|
||||
this.b.remove(linkedEntry.a);
|
||||
((Poolable) linkedEntry.a).a();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void a(LinkedEntry<K, V> linkedEntry) {
|
||||
c(linkedEntry);
|
||||
LinkedEntry<K, V> linkedEntry2 = this.a;
|
||||
linkedEntry.d = linkedEntry2;
|
||||
linkedEntry.c = linkedEntry2.c;
|
||||
d(linkedEntry);
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class IntegerArrayAdapter implements ArrayAdapterInterface<int[]> {
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public String a() {
|
||||
return "IntegerArrayPool";
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public int b() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public int a(int[] iArr) {
|
||||
return iArr.length;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayAdapterInterface
|
||||
public int[] newArray(int i) {
|
||||
return new int[i];
|
||||
}
|
||||
}
|
@@ -0,0 +1,224 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class LruArrayPool implements ArrayPool {
|
||||
private final GroupedLinkedMap<Key, Object> a = new GroupedLinkedMap<>();
|
||||
private final KeyPool b = new KeyPool();
|
||||
private final Map<Class<?>, NavigableMap<Integer, Integer>> c = new HashMap();
|
||||
private final Map<Class<?>, ArrayAdapterInterface<?>> d = new HashMap();
|
||||
private final int e;
|
||||
private int f;
|
||||
|
||||
private static final class KeyPool extends BaseKeyPool<Key> {
|
||||
KeyPool() {
|
||||
}
|
||||
|
||||
Key a(int i, Class<?> cls) {
|
||||
Key b = b();
|
||||
b.a(i, cls);
|
||||
return b;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
/* JADX WARN: Can't rename method to resolve collision */
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BaseKeyPool
|
||||
public Key a() {
|
||||
return new Key(this);
|
||||
}
|
||||
}
|
||||
|
||||
public LruArrayPool(int i) {
|
||||
this.e = i;
|
||||
}
|
||||
|
||||
private boolean c(int i) {
|
||||
return i <= this.e / 2;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool
|
||||
public synchronized <T> T a(int i, Class<T> cls) {
|
||||
return (T) a(this.b.a(i, cls), cls);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool
|
||||
public synchronized <T> T b(int i, Class<T> cls) {
|
||||
Integer ceilingKey;
|
||||
ceilingKey = b((Class<?>) cls).ceilingKey(Integer.valueOf(i));
|
||||
return (T) a(a(i, ceilingKey) ? this.b.a(ceilingKey.intValue(), cls) : this.b.a(i, cls), cls);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool
|
||||
public synchronized <T> void put(T t) {
|
||||
Class<?> cls = t.getClass();
|
||||
ArrayAdapterInterface<T> a = a((Class) cls);
|
||||
int a2 = a.a(t);
|
||||
int b = a.b() * a2;
|
||||
if (c(b)) {
|
||||
Key a3 = this.b.a(a2, cls);
|
||||
this.a.a(a3, t);
|
||||
NavigableMap<Integer, Integer> b2 = b(cls);
|
||||
Integer num = (Integer) b2.get(Integer.valueOf(a3.b));
|
||||
Integer valueOf = Integer.valueOf(a3.b);
|
||||
int i = 1;
|
||||
if (num != null) {
|
||||
i = 1 + num.intValue();
|
||||
}
|
||||
b2.put(valueOf, Integer.valueOf(i));
|
||||
this.f += b;
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Key implements Poolable {
|
||||
private final KeyPool a;
|
||||
int b;
|
||||
private Class<?> c;
|
||||
|
||||
Key(KeyPool keyPool) {
|
||||
this.a = keyPool;
|
||||
}
|
||||
|
||||
void a(int i, Class<?> cls) {
|
||||
this.b = i;
|
||||
this.c = cls;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Key)) {
|
||||
return false;
|
||||
}
|
||||
Key key = (Key) obj;
|
||||
return this.b == key.b && this.c == key.c;
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = this.b * 31;
|
||||
Class<?> cls = this.c;
|
||||
return i + (cls != null ? cls.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return "Key{size=" + this.b + "array=" + this.c + '}';
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.Poolable
|
||||
public void a() {
|
||||
this.a.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean c() {
|
||||
int i = this.f;
|
||||
return i == 0 || this.e / i >= 2;
|
||||
}
|
||||
|
||||
private <T> T a(Key key, Class<T> cls) {
|
||||
ArrayAdapterInterface<T> a = a((Class) cls);
|
||||
T t = (T) a(key);
|
||||
if (t != null) {
|
||||
this.f -= a.a(t) * a.b();
|
||||
c(a.a(t), cls);
|
||||
}
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
if (Log.isLoggable(a.a(), 2)) {
|
||||
Log.v(a.a(), "Allocated " + key.b + " bytes");
|
||||
}
|
||||
return a.newArray(key.b);
|
||||
}
|
||||
|
||||
private void c(int i, Class<?> cls) {
|
||||
NavigableMap<Integer, Integer> b = b(cls);
|
||||
Integer num = (Integer) b.get(Integer.valueOf(i));
|
||||
if (num != null) {
|
||||
if (num.intValue() == 1) {
|
||||
b.remove(Integer.valueOf(i));
|
||||
return;
|
||||
} else {
|
||||
b.put(Integer.valueOf(i), Integer.valueOf(num.intValue() - 1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new NullPointerException("Tried to decrement empty size, size: " + i + ", this: " + this);
|
||||
}
|
||||
|
||||
private void b() {
|
||||
b(this.e);
|
||||
}
|
||||
|
||||
private void b(int i) {
|
||||
while (this.f > i) {
|
||||
Object a = this.a.a();
|
||||
Preconditions.a(a);
|
||||
ArrayAdapterInterface a2 = a((LruArrayPool) a);
|
||||
this.f -= a2.a(a) * a2.b();
|
||||
c(a2.a(a), a.getClass());
|
||||
if (Log.isLoggable(a2.a(), 2)) {
|
||||
Log.v(a2.a(), "evicted: " + a2.a(a));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private <T> T a(Key key) {
|
||||
return (T) this.a.a((GroupedLinkedMap<Key, Object>) key);
|
||||
}
|
||||
|
||||
private boolean a(int i, Integer num) {
|
||||
return num != null && (c() || num.intValue() <= i * 8);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool
|
||||
public synchronized void a() {
|
||||
b(0);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.ArrayPool
|
||||
public synchronized void a(int i) {
|
||||
try {
|
||||
if (i >= 40) {
|
||||
a();
|
||||
} else if (i >= 20 || i == 15) {
|
||||
b(this.e / 2);
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
private NavigableMap<Integer, Integer> b(Class<?> cls) {
|
||||
NavigableMap<Integer, Integer> navigableMap = this.c.get(cls);
|
||||
if (navigableMap != null) {
|
||||
return navigableMap;
|
||||
}
|
||||
TreeMap treeMap = new TreeMap();
|
||||
this.c.put(cls, treeMap);
|
||||
return treeMap;
|
||||
}
|
||||
|
||||
private <T> ArrayAdapterInterface<T> a(T t) {
|
||||
return a((Class) t.getClass());
|
||||
}
|
||||
|
||||
private <T> ArrayAdapterInterface<T> a(Class<T> cls) {
|
||||
ArrayAdapterInterface<T> arrayAdapterInterface = (ArrayAdapterInterface) this.d.get(cls);
|
||||
if (arrayAdapterInterface == null) {
|
||||
if (cls.equals(int[].class)) {
|
||||
arrayAdapterInterface = new IntegerArrayAdapter();
|
||||
} else if (cls.equals(byte[].class)) {
|
||||
arrayAdapterInterface = new ByteArrayAdapter();
|
||||
} else {
|
||||
throw new IllegalArgumentException("No array pool found for: " + cls.getSimpleName());
|
||||
}
|
||||
this.d.put(cls, arrayAdapterInterface);
|
||||
}
|
||||
return arrayAdapterInterface;
|
||||
}
|
||||
}
|
@@ -0,0 +1,227 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.util.Log;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class LruBitmapPool implements BitmapPool {
|
||||
private static final Bitmap.Config j = Bitmap.Config.ARGB_8888;
|
||||
private final LruPoolStrategy a;
|
||||
private final Set<Bitmap.Config> b;
|
||||
private final BitmapTracker c;
|
||||
private long d;
|
||||
private long e;
|
||||
private int f;
|
||||
private int g;
|
||||
private int h;
|
||||
private int i;
|
||||
|
||||
private interface BitmapTracker {
|
||||
void a(Bitmap bitmap);
|
||||
|
||||
void b(Bitmap bitmap);
|
||||
}
|
||||
|
||||
private static final class NullBitmapTracker implements BitmapTracker {
|
||||
NullBitmapTracker() {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool.BitmapTracker
|
||||
public void a(Bitmap bitmap) {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruBitmapPool.BitmapTracker
|
||||
public void b(Bitmap bitmap) {
|
||||
}
|
||||
}
|
||||
|
||||
LruBitmapPool(long j2, LruPoolStrategy lruPoolStrategy, Set<Bitmap.Config> set) {
|
||||
this.d = j2;
|
||||
this.a = lruPoolStrategy;
|
||||
this.b = set;
|
||||
this.c = new NullBitmapTracker();
|
||||
}
|
||||
|
||||
private static Bitmap c(int i, int i2, Bitmap.Config config) {
|
||||
if (config == null) {
|
||||
config = j;
|
||||
}
|
||||
return Bitmap.createBitmap(i, i2, config);
|
||||
}
|
||||
|
||||
private synchronized Bitmap d(int i, int i2, Bitmap.Config config) {
|
||||
Bitmap a;
|
||||
a(config);
|
||||
a = this.a.a(i, i2, config != null ? config : j);
|
||||
if (a == null) {
|
||||
if (Log.isLoggable("LruBitmapPool", 3)) {
|
||||
Log.d("LruBitmapPool", "Missing bitmap=" + this.a.b(i, i2, config));
|
||||
}
|
||||
this.g++;
|
||||
} else {
|
||||
this.f++;
|
||||
this.e -= this.a.b(a);
|
||||
this.c.a(a);
|
||||
c(a);
|
||||
}
|
||||
if (Log.isLoggable("LruBitmapPool", 2)) {
|
||||
Log.v("LruBitmapPool", "Get bitmap=" + this.a.b(i, i2, config));
|
||||
}
|
||||
c();
|
||||
return a;
|
||||
}
|
||||
|
||||
private void e() {
|
||||
a(this.d);
|
||||
}
|
||||
|
||||
@TargetApi(26)
|
||||
private static Set<Bitmap.Config> f() {
|
||||
HashSet hashSet = new HashSet(Arrays.asList(Bitmap.Config.values()));
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
hashSet.add(null);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
hashSet.remove(Bitmap.Config.HARDWARE);
|
||||
}
|
||||
return Collections.unmodifiableSet(hashSet);
|
||||
}
|
||||
|
||||
private static LruPoolStrategy g() {
|
||||
return Build.VERSION.SDK_INT >= 19 ? new SizeConfigStrategy() : new AttributeStrategy();
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public synchronized void a(Bitmap bitmap) {
|
||||
try {
|
||||
if (bitmap == null) {
|
||||
throw new NullPointerException("Bitmap must not be null");
|
||||
}
|
||||
if (bitmap.isRecycled()) {
|
||||
throw new IllegalStateException("Cannot pool recycled bitmap");
|
||||
}
|
||||
if (bitmap.isMutable() && this.a.b(bitmap) <= this.d && this.b.contains(bitmap.getConfig())) {
|
||||
int b = this.a.b(bitmap);
|
||||
this.a.a(bitmap);
|
||||
this.c.b(bitmap);
|
||||
this.h++;
|
||||
this.e += b;
|
||||
if (Log.isLoggable("LruBitmapPool", 2)) {
|
||||
Log.v("LruBitmapPool", "Put bitmap in pool=" + this.a.c(bitmap));
|
||||
}
|
||||
c();
|
||||
e();
|
||||
return;
|
||||
}
|
||||
if (Log.isLoggable("LruBitmapPool", 2)) {
|
||||
Log.v("LruBitmapPool", "Reject bitmap from pool, bitmap: " + this.a.c(bitmap) + ", is mutable: " + bitmap.isMutable() + ", is allowed config: " + this.b.contains(bitmap.getConfig()));
|
||||
}
|
||||
bitmap.recycle();
|
||||
} catch (Throwable th) {
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
public long b() {
|
||||
return this.d;
|
||||
}
|
||||
|
||||
private static void c(Bitmap bitmap) {
|
||||
bitmap.setHasAlpha(true);
|
||||
b(bitmap);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public Bitmap b(int i, int i2, Bitmap.Config config) {
|
||||
Bitmap d = d(i, i2, config);
|
||||
return d == null ? c(i, i2, config) : d;
|
||||
}
|
||||
|
||||
@TargetApi(19)
|
||||
private static void b(Bitmap bitmap) {
|
||||
if (Build.VERSION.SDK_INT >= 19) {
|
||||
bitmap.setPremultiplied(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void c() {
|
||||
if (Log.isLoggable("LruBitmapPool", 2)) {
|
||||
d();
|
||||
}
|
||||
}
|
||||
|
||||
public LruBitmapPool(long j2) {
|
||||
this(j2, g(), f());
|
||||
}
|
||||
|
||||
private void d() {
|
||||
Log.v("LruBitmapPool", "Hits=" + this.f + ", misses=" + this.g + ", puts=" + this.h + ", evictions=" + this.i + ", currentSize=" + this.e + ", maxSize=" + this.d + "\nStrategy=" + this.a);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public Bitmap a(int i, int i2, Bitmap.Config config) {
|
||||
Bitmap d = d(i, i2, config);
|
||||
if (d != null) {
|
||||
d.eraseColor(0);
|
||||
return d;
|
||||
}
|
||||
return c(i, i2, config);
|
||||
}
|
||||
|
||||
@TargetApi(26)
|
||||
private static void a(Bitmap.Config config) {
|
||||
if (Build.VERSION.SDK_INT >= 26 && config == Bitmap.Config.HARDWARE) {
|
||||
throw new IllegalArgumentException("Cannot create a mutable Bitmap with config: " + config + ". Consider setting Downsampler#ALLOW_HARDWARE_CONFIG to false in your RequestOptions and/or in GlideBuilder.setDefaultRequestOptions");
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
public void a() {
|
||||
if (Log.isLoggable("LruBitmapPool", 3)) {
|
||||
Log.d("LruBitmapPool", "clearMemory");
|
||||
}
|
||||
a(0L);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
|
||||
@SuppressLint({"InlinedApi"})
|
||||
public void a(int i) {
|
||||
if (Log.isLoggable("LruBitmapPool", 3)) {
|
||||
Log.d("LruBitmapPool", "trimMemory, level=" + i);
|
||||
}
|
||||
if (i >= 40) {
|
||||
a();
|
||||
} else if (i >= 20 || i == 15) {
|
||||
a(b() / 2);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized void a(long j2) {
|
||||
while (this.e > j2) {
|
||||
Bitmap removeLast = this.a.removeLast();
|
||||
if (removeLast == null) {
|
||||
if (Log.isLoggable("LruBitmapPool", 5)) {
|
||||
Log.w("LruBitmapPool", "Size mismatch, resetting");
|
||||
d();
|
||||
}
|
||||
this.e = 0L;
|
||||
return;
|
||||
}
|
||||
this.c.a(removeLast);
|
||||
this.e -= this.a.b(removeLast);
|
||||
this.i++;
|
||||
if (Log.isLoggable("LruBitmapPool", 3)) {
|
||||
Log.d("LruBitmapPool", "Evicting bitmap=" + this.a.c(removeLast));
|
||||
}
|
||||
c();
|
||||
removeLast.recycle();
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface LruPoolStrategy {
|
||||
Bitmap a(int i, int i2, Bitmap.Config config);
|
||||
|
||||
void a(Bitmap bitmap);
|
||||
|
||||
int b(Bitmap bitmap);
|
||||
|
||||
String b(int i, int i2, Bitmap.Config config);
|
||||
|
||||
String c(Bitmap bitmap);
|
||||
|
||||
Bitmap removeLast();
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
interface Poolable {
|
||||
void a();
|
||||
}
|
@@ -0,0 +1,243 @@
|
||||
package com.bumptech.glide.load.engine.bitmap_recycle;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import com.bumptech.glide.util.Util;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class SizeConfigStrategy implements LruPoolStrategy {
|
||||
private static final Bitmap.Config[] d;
|
||||
private static final Bitmap.Config[] e;
|
||||
private static final Bitmap.Config[] f;
|
||||
private static final Bitmap.Config[] g;
|
||||
private static final Bitmap.Config[] h;
|
||||
private final KeyPool a = new KeyPool();
|
||||
private final GroupedLinkedMap<Key, Bitmap> b = new GroupedLinkedMap<>();
|
||||
private final Map<Bitmap.Config, NavigableMap<Integer, Integer>> c = new HashMap();
|
||||
|
||||
/* renamed from: com.bumptech.glide.load.engine.bitmap_recycle.SizeConfigStrategy$1, reason: invalid class name */
|
||||
static /* synthetic */ class AnonymousClass1 {
|
||||
static final /* synthetic */ int[] a = new int[Bitmap.Config.values().length];
|
||||
|
||||
static {
|
||||
try {
|
||||
a[Bitmap.Config.ARGB_8888.ordinal()] = 1;
|
||||
} catch (NoSuchFieldError unused) {
|
||||
}
|
||||
try {
|
||||
a[Bitmap.Config.RGB_565.ordinal()] = 2;
|
||||
} catch (NoSuchFieldError unused2) {
|
||||
}
|
||||
try {
|
||||
a[Bitmap.Config.ARGB_4444.ordinal()] = 3;
|
||||
} catch (NoSuchFieldError unused3) {
|
||||
}
|
||||
try {
|
||||
a[Bitmap.Config.ALPHA_8.ordinal()] = 4;
|
||||
} catch (NoSuchFieldError unused4) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static class KeyPool extends BaseKeyPool<Key> {
|
||||
KeyPool() {
|
||||
}
|
||||
|
||||
public Key a(int i, Bitmap.Config config) {
|
||||
Key b = b();
|
||||
b.a(i, config);
|
||||
return b;
|
||||
}
|
||||
|
||||
/* JADX INFO: Access modifiers changed from: protected */
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.BaseKeyPool
|
||||
public Key a() {
|
||||
return new Key(this);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
Bitmap.Config[] configArr = {Bitmap.Config.ARGB_8888, null};
|
||||
if (Build.VERSION.SDK_INT >= 26) {
|
||||
configArr = (Bitmap.Config[]) Arrays.copyOf(configArr, configArr.length + 1);
|
||||
configArr[configArr.length - 1] = Bitmap.Config.RGBA_F16;
|
||||
}
|
||||
d = configArr;
|
||||
e = d;
|
||||
f = new Bitmap.Config[]{Bitmap.Config.RGB_565};
|
||||
g = new Bitmap.Config[]{Bitmap.Config.ARGB_4444};
|
||||
h = new Bitmap.Config[]{Bitmap.Config.ALPHA_8};
|
||||
}
|
||||
|
||||
private NavigableMap<Integer, Integer> b(Bitmap.Config config) {
|
||||
NavigableMap<Integer, Integer> navigableMap = this.c.get(config);
|
||||
if (navigableMap != null) {
|
||||
return navigableMap;
|
||||
}
|
||||
TreeMap treeMap = new TreeMap();
|
||||
this.c.put(config, treeMap);
|
||||
return treeMap;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public void a(Bitmap bitmap) {
|
||||
Key a = this.a.a(Util.a(bitmap), bitmap.getConfig());
|
||||
this.b.a(a, bitmap);
|
||||
NavigableMap<Integer, Integer> b = b(bitmap.getConfig());
|
||||
Integer num = (Integer) b.get(Integer.valueOf(a.b));
|
||||
b.put(Integer.valueOf(a.b), Integer.valueOf(num != null ? 1 + num.intValue() : 1));
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public String c(Bitmap bitmap) {
|
||||
return b(Util.a(bitmap), bitmap.getConfig());
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public Bitmap removeLast() {
|
||||
Bitmap a = this.b.a();
|
||||
if (a != null) {
|
||||
a(Integer.valueOf(Util.a(a)), a);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("SizeConfigStrategy{groupedMap=");
|
||||
sb.append(this.b);
|
||||
sb.append(", sortedSizes=(");
|
||||
for (Map.Entry<Bitmap.Config, NavigableMap<Integer, Integer>> entry : this.c.entrySet()) {
|
||||
sb.append(entry.getKey());
|
||||
sb.append('[');
|
||||
sb.append(entry.getValue());
|
||||
sb.append("], ");
|
||||
}
|
||||
if (!this.c.isEmpty()) {
|
||||
sb.replace(sb.length() - 2, sb.length(), "");
|
||||
}
|
||||
sb.append(")}");
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
static final class Key implements Poolable {
|
||||
private final KeyPool a;
|
||||
int b;
|
||||
private Bitmap.Config c;
|
||||
|
||||
public Key(KeyPool keyPool) {
|
||||
this.a = keyPool;
|
||||
}
|
||||
|
||||
public void a(int i, Bitmap.Config config) {
|
||||
this.b = i;
|
||||
this.c = config;
|
||||
}
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (!(obj instanceof Key)) {
|
||||
return false;
|
||||
}
|
||||
Key key = (Key) obj;
|
||||
return this.b == key.b && Util.b(this.c, key.c);
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
int i = this.b * 31;
|
||||
Bitmap.Config config = this.c;
|
||||
return i + (config != null ? config.hashCode() : 0);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return SizeConfigStrategy.b(this.b, this.c);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.Poolable
|
||||
public void a() {
|
||||
this.a.a(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public String b(int i, int i2, Bitmap.Config config) {
|
||||
return b(Util.a(i, i2, config), config);
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public int b(Bitmap bitmap) {
|
||||
return Util.a(bitmap);
|
||||
}
|
||||
|
||||
static String b(int i, Bitmap.Config config) {
|
||||
return "[" + i + "](" + config + ")";
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.bitmap_recycle.LruPoolStrategy
|
||||
public Bitmap a(int i, int i2, Bitmap.Config config) {
|
||||
Key a = a(Util.a(i, i2, config), config);
|
||||
Bitmap a2 = this.b.a((GroupedLinkedMap<Key, Bitmap>) a);
|
||||
if (a2 != null) {
|
||||
a(Integer.valueOf(a.b), a2);
|
||||
a2.reconfigure(i, i2, a2.getConfig() != null ? a2.getConfig() : Bitmap.Config.ARGB_8888);
|
||||
}
|
||||
return a2;
|
||||
}
|
||||
|
||||
private Key a(int i, Bitmap.Config config) {
|
||||
Key a = this.a.a(i, config);
|
||||
for (Bitmap.Config config2 : a(config)) {
|
||||
Integer ceilingKey = b(config2).ceilingKey(Integer.valueOf(i));
|
||||
if (ceilingKey != null && ceilingKey.intValue() <= i * 8) {
|
||||
if (ceilingKey.intValue() == i) {
|
||||
if (config2 == null) {
|
||||
if (config == null) {
|
||||
return a;
|
||||
}
|
||||
} else if (config2.equals(config)) {
|
||||
return a;
|
||||
}
|
||||
}
|
||||
this.a.a(a);
|
||||
return this.a.a(ceilingKey.intValue(), config2);
|
||||
}
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
private void a(Integer num, Bitmap bitmap) {
|
||||
NavigableMap<Integer, Integer> b = b(bitmap.getConfig());
|
||||
Integer num2 = (Integer) b.get(num);
|
||||
if (num2 != null) {
|
||||
if (num2.intValue() == 1) {
|
||||
b.remove(num);
|
||||
return;
|
||||
} else {
|
||||
b.put(num, Integer.valueOf(num2.intValue() - 1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new NullPointerException("Tried to decrement empty size, size: " + num + ", removed: " + c(bitmap) + ", this: " + this);
|
||||
}
|
||||
|
||||
private static Bitmap.Config[] a(Bitmap.Config config) {
|
||||
if (Build.VERSION.SDK_INT >= 26 && Bitmap.Config.RGBA_F16.equals(config)) {
|
||||
return e;
|
||||
}
|
||||
int i = AnonymousClass1.a[config.ordinal()];
|
||||
if (i == 1) {
|
||||
return d;
|
||||
}
|
||||
if (i == 2) {
|
||||
return f;
|
||||
}
|
||||
if (i != 3) {
|
||||
return i != 4 ? new Bitmap.Config[]{config} : h;
|
||||
}
|
||||
return g;
|
||||
}
|
||||
}
|
22
sources/com/bumptech/glide/load/engine/cache/DiskCache.java
vendored
Normal file
22
sources/com/bumptech/glide/load/engine/cache/DiskCache.java
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface DiskCache {
|
||||
|
||||
public interface Factory {
|
||||
DiskCache build();
|
||||
}
|
||||
|
||||
public interface Writer {
|
||||
boolean a(File file);
|
||||
}
|
||||
|
||||
File a(Key key);
|
||||
|
||||
void a(Key key, Writer writer);
|
||||
|
||||
void clear();
|
||||
}
|
21
sources/com/bumptech/glide/load/engine/cache/DiskCacheAdapter.java
vendored
Normal file
21
sources/com/bumptech/glide/load/engine/cache/DiskCacheAdapter.java
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiskCacheAdapter implements DiskCache {
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public File a(Key key) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public void a(Key key, DiskCache.Writer writer) {
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public void clear() {
|
||||
}
|
||||
}
|
83
sources/com/bumptech/glide/load/engine/cache/DiskCacheWriteLocker.java
vendored
Normal file
83
sources/com/bumptech/glide/load/engine/cache/DiskCacheWriteLocker.java
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import com.bumptech.glide.util.Preconditions;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
final class DiskCacheWriteLocker {
|
||||
private final Map<String, WriteLock> a = new HashMap();
|
||||
private final WriteLockPool b = new WriteLockPool();
|
||||
|
||||
private static class WriteLock {
|
||||
final Lock a = new ReentrantLock();
|
||||
int b;
|
||||
|
||||
WriteLock() {
|
||||
}
|
||||
}
|
||||
|
||||
DiskCacheWriteLocker() {
|
||||
}
|
||||
|
||||
void a(String str) {
|
||||
WriteLock writeLock;
|
||||
synchronized (this) {
|
||||
writeLock = this.a.get(str);
|
||||
if (writeLock == null) {
|
||||
writeLock = this.b.a();
|
||||
this.a.put(str, writeLock);
|
||||
}
|
||||
writeLock.b++;
|
||||
}
|
||||
writeLock.a.lock();
|
||||
}
|
||||
|
||||
void b(String str) {
|
||||
WriteLock writeLock;
|
||||
synchronized (this) {
|
||||
WriteLock writeLock2 = this.a.get(str);
|
||||
Preconditions.a(writeLock2);
|
||||
writeLock = writeLock2;
|
||||
if (writeLock.b < 1) {
|
||||
throw new IllegalStateException("Cannot release a lock that is not held, safeKey: " + str + ", interestedThreads: " + writeLock.b);
|
||||
}
|
||||
writeLock.b--;
|
||||
if (writeLock.b == 0) {
|
||||
WriteLock remove = this.a.remove(str);
|
||||
if (!remove.equals(writeLock)) {
|
||||
throw new IllegalStateException("Removed the wrong lock, expected to remove: " + writeLock + ", but actually removed: " + remove + ", safeKey: " + str);
|
||||
}
|
||||
this.b.a(remove);
|
||||
}
|
||||
}
|
||||
writeLock.a.unlock();
|
||||
}
|
||||
|
||||
private static class WriteLockPool {
|
||||
private final Queue<WriteLock> a = new ArrayDeque();
|
||||
|
||||
WriteLockPool() {
|
||||
}
|
||||
|
||||
WriteLock a() {
|
||||
WriteLock poll;
|
||||
synchronized (this.a) {
|
||||
poll = this.a.poll();
|
||||
}
|
||||
return poll == null ? new WriteLock() : poll;
|
||||
}
|
||||
|
||||
void a(WriteLock writeLock) {
|
||||
synchronized (this.a) {
|
||||
if (this.a.size() < 10) {
|
||||
this.a.offer(writeLock);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
31
sources/com/bumptech/glide/load/engine/cache/DiskLruCacheFactory.java
vendored
Normal file
31
sources/com/bumptech/glide/load/engine/cache/DiskLruCacheFactory.java
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiskLruCacheFactory implements DiskCache.Factory {
|
||||
private final long a;
|
||||
private final CacheDirectoryGetter b;
|
||||
|
||||
public interface CacheDirectoryGetter {
|
||||
File a();
|
||||
}
|
||||
|
||||
public DiskLruCacheFactory(CacheDirectoryGetter cacheDirectoryGetter, long j) {
|
||||
this.a = j;
|
||||
this.b = cacheDirectoryGetter;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache.Factory
|
||||
public DiskCache build() {
|
||||
File a = this.b.a();
|
||||
if (a == null) {
|
||||
return null;
|
||||
}
|
||||
if (a.mkdirs() || (a.exists() && a.isDirectory())) {
|
||||
return DiskLruCacheWrapper.a(a, this.a);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
112
sources/com/bumptech/glide/load/engine/cache/DiskLruCacheWrapper.java
vendored
Normal file
112
sources/com/bumptech/glide/load/engine/cache/DiskLruCacheWrapper.java
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import android.util.Log;
|
||||
import com.bumptech.glide.disklrucache.DiskLruCache;
|
||||
import com.bumptech.glide.load.Key;
|
||||
import com.bumptech.glide.load.engine.cache.DiskCache;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public class DiskLruCacheWrapper implements DiskCache {
|
||||
private final File b;
|
||||
private final long c;
|
||||
private DiskLruCache e;
|
||||
private final DiskCacheWriteLocker d = new DiskCacheWriteLocker();
|
||||
private final SafeKeyGenerator a = new SafeKeyGenerator();
|
||||
|
||||
@Deprecated
|
||||
protected DiskLruCacheWrapper(File file, long j) {
|
||||
this.b = file;
|
||||
this.c = j;
|
||||
}
|
||||
|
||||
public static DiskCache a(File file, long j) {
|
||||
return new DiskLruCacheWrapper(file, j);
|
||||
}
|
||||
|
||||
private synchronized void b() {
|
||||
this.e = null;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public synchronized void clear() {
|
||||
try {
|
||||
try {
|
||||
a().a();
|
||||
} catch (IOException e) {
|
||||
if (Log.isLoggable("DiskLruCacheWrapper", 5)) {
|
||||
Log.w("DiskLruCacheWrapper", "Unable to clear disk cache or disk cache cleared externally", e);
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
b();
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized DiskLruCache a() throws IOException {
|
||||
if (this.e == null) {
|
||||
this.e = DiskLruCache.a(this.b, 1, 1, this.c);
|
||||
}
|
||||
return this.e;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public File a(Key key) {
|
||||
String a = this.a.a(key);
|
||||
if (Log.isLoggable("DiskLruCacheWrapper", 2)) {
|
||||
Log.v("DiskLruCacheWrapper", "Get: Obtained: " + a + " for for Key: " + key);
|
||||
}
|
||||
try {
|
||||
DiskLruCache.Value b = a().b(a);
|
||||
if (b != null) {
|
||||
return b.a(0);
|
||||
}
|
||||
return null;
|
||||
} catch (IOException e) {
|
||||
if (!Log.isLoggable("DiskLruCacheWrapper", 5)) {
|
||||
return null;
|
||||
}
|
||||
Log.w("DiskLruCacheWrapper", "Unable to get from disk cache", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskCache
|
||||
public void a(Key key, DiskCache.Writer writer) {
|
||||
DiskLruCache a;
|
||||
String a2 = this.a.a(key);
|
||||
this.d.a(a2);
|
||||
try {
|
||||
if (Log.isLoggable("DiskLruCacheWrapper", 2)) {
|
||||
Log.v("DiskLruCacheWrapper", "Put: Obtained: " + a2 + " for for Key: " + key);
|
||||
}
|
||||
try {
|
||||
a = a();
|
||||
} catch (IOException e) {
|
||||
if (Log.isLoggable("DiskLruCacheWrapper", 5)) {
|
||||
Log.w("DiskLruCacheWrapper", "Unable to put to disk cache", e);
|
||||
}
|
||||
}
|
||||
if (a.b(a2) != null) {
|
||||
return;
|
||||
}
|
||||
DiskLruCache.Editor a3 = a.a(a2);
|
||||
if (a3 != null) {
|
||||
try {
|
||||
if (writer.a(a3.a(0))) {
|
||||
a3.c();
|
||||
}
|
||||
a3.b();
|
||||
return;
|
||||
} catch (Throwable th) {
|
||||
a3.b();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
throw new IllegalStateException("Had two simultaneous puts for: " + a2);
|
||||
} finally {
|
||||
this.d.b(a2);
|
||||
}
|
||||
}
|
||||
}
|
36
sources/com/bumptech/glide/load/engine/cache/ExternalPreferredCacheDiskCacheFactory.java
vendored
Normal file
36
sources/com/bumptech/glide/load/engine/cache/ExternalPreferredCacheDiskCacheFactory.java
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
package com.bumptech.glide.load.engine.cache;
|
||||
|
||||
import android.content.Context;
|
||||
import com.bumptech.glide.load.engine.cache.DiskLruCacheFactory;
|
||||
import java.io.File;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public final class ExternalPreferredCacheDiskCacheFactory extends DiskLruCacheFactory {
|
||||
public ExternalPreferredCacheDiskCacheFactory(Context context, long j) {
|
||||
this(context, "image_manager_disk_cache", j);
|
||||
}
|
||||
|
||||
public ExternalPreferredCacheDiskCacheFactory(final Context context, final String str, long j) {
|
||||
super(new DiskLruCacheFactory.CacheDirectoryGetter() { // from class: com.bumptech.glide.load.engine.cache.ExternalPreferredCacheDiskCacheFactory.1
|
||||
private File b() {
|
||||
File cacheDir = context.getCacheDir();
|
||||
if (cacheDir == null) {
|
||||
return null;
|
||||
}
|
||||
String str2 = str;
|
||||
return str2 != null ? new File(cacheDir, str2) : cacheDir;
|
||||
}
|
||||
|
||||
@Override // com.bumptech.glide.load.engine.cache.DiskLruCacheFactory.CacheDirectoryGetter
|
||||
public File a() {
|
||||
File externalCacheDir;
|
||||
File b = b();
|
||||
if ((b != null && b.exists()) || (externalCacheDir = context.getExternalCacheDir()) == null || !externalCacheDir.canWrite()) {
|
||||
return b;
|
||||
}
|
||||
String str2 = str;
|
||||
return str2 != null ? new File(externalCacheDir, str2) : externalCacheDir;
|
||||
}
|
||||
}, j);
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user