jimu-decompiled/sources/com/bumptech/glide/provider/ResourceDecoderRegistry.java
2025-05-13 19:24:51 +02:00

93 lines
2.8 KiB
Java

package com.bumptech.glide.provider;
import com.bumptech.glide.load.ResourceDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
/* loaded from: classes.dex */
public class ResourceDecoderRegistry {
private final List<String> a = new ArrayList();
private final Map<String, List<Entry<?, ?>>> b = new HashMap();
private static class Entry<T, R> {
private final Class<T> a;
final Class<R> b;
final ResourceDecoder<T, R> c;
public Entry(Class<T> cls, Class<R> cls2, ResourceDecoder<T, R> resourceDecoder) {
this.a = cls;
this.b = cls2;
this.c = resourceDecoder;
}
public boolean a(Class<?> cls, Class<?> cls2) {
return this.a.isAssignableFrom(cls) && cls2.isAssignableFrom(this.b);
}
}
public synchronized void a(List<String> list) {
ArrayList<String> arrayList = new ArrayList(this.a);
this.a.clear();
this.a.addAll(list);
for (String str : arrayList) {
if (!list.contains(str)) {
this.a.add(str);
}
}
}
public synchronized <T, R> List<Class<R>> b(Class<T> cls, Class<R> cls2) {
ArrayList arrayList;
arrayList = new ArrayList();
Iterator<String> it = this.a.iterator();
while (it.hasNext()) {
List<Entry<?, ?>> list = this.b.get(it.next());
if (list != null) {
for (Entry<?, ?> entry : list) {
if (entry.a(cls, cls2) && !arrayList.contains(entry.b)) {
arrayList.add(entry.b);
}
}
}
}
return arrayList;
}
public synchronized <T, R> List<ResourceDecoder<T, R>> a(Class<T> cls, Class<R> cls2) {
ArrayList arrayList;
arrayList = new ArrayList();
Iterator<String> it = this.a.iterator();
while (it.hasNext()) {
List<Entry<?, ?>> list = this.b.get(it.next());
if (list != null) {
for (Entry<?, ?> entry : list) {
if (entry.a(cls, cls2)) {
arrayList.add(entry.c);
}
}
}
}
return arrayList;
}
public synchronized <T, R> void a(String str, ResourceDecoder<T, R> resourceDecoder, Class<T> cls, Class<R> cls2) {
a(str).add(new Entry<>(cls, cls2, resourceDecoder));
}
private synchronized List<Entry<?, ?>> a(String str) {
List<Entry<?, ?>> list;
if (!this.a.contains(str)) {
this.a.add(str);
}
list = this.b.get(str);
if (list == null) {
list = new ArrayList<>();
this.b.put(str, list);
}
return list;
}
}