discord-jadx/app/src/main/java/c/f/g/a/a/c.java

372 lines
13 KiB
Java

package c.f.g.a.a;
import android.content.res.Resources;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import c.f.d.d.e;
import c.f.d.d.i;
import c.f.g.a.a.h.b;
import c.f.g.a.a.h.f;
import c.f.g.a.a.h.h;
import c.f.g.e.p;
import c.f.j.c.w;
import c.f.j.i.a;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.facebook.cache.common.CacheKey;
import com.facebook.common.internal.Supplier;
import com.facebook.common.references.CloseableReference;
import com.facebook.common.time.AwakeTimeSinceBootClock;
import com.facebook.datasource.DataSource;
import com.facebook.drawee.controller.AbstractDraweeController;
import com.facebook.drawee.controller.AbstractDraweeControllerBuilder;
import com.facebook.drawee.drawable.ScalingUtils$ScaleType;
import com.facebook.drawee.interfaces.DraweeHierarchy;
import com.facebook.imagepipeline.image.ImageInfo;
import com.facebook.imagepipeline.request.ImageRequest;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
/* compiled from: PipelineDraweeController */
public class c extends AbstractDraweeController<CloseableReference<c.f.j.j.c>, ImageInfo> {
public CacheKey A;
public Supplier<DataSource<CloseableReference<c.f.j.j.c>>> B;
public boolean C;
public e<a> D;
public f E;
public Set<c.f.j.k.e> F;
public b G;
public c.f.g.a.a.g.b H;
public ImageRequest I;
public ImageRequest[] J;
public ImageRequest K;
/* renamed from: x reason: collision with root package name */
public final a f356x;
/* renamed from: y reason: collision with root package name */
public final e<a> f357y;
/* renamed from: z reason: collision with root package name */
public final w<CacheKey, c.f.j.j.c> f358z;
public c(Resources resources, c.f.g.b.a aVar, a aVar2, Executor executor, w<CacheKey, c.f.j.j.c> wVar, e<a> eVar) {
super(aVar, executor, null, null);
this.f356x = new a(resources, aVar2);
this.f357y = eVar;
this.f358z = wVar;
}
public synchronized void F(b bVar) {
b bVar2 = this.G;
if (bVar2 instanceof c.f.g.a.a.h.a) {
c.f.g.a.a.h.a aVar = (c.f.g.a.a.h.a) bVar2;
synchronized (aVar) {
aVar.a.add(bVar);
}
} else if (bVar2 != null) {
this.G = new c.f.g.a.a.h.a(bVar2, bVar);
} else {
this.G = bVar;
}
}
public synchronized void G(c.f.j.k.e eVar) {
if (this.F == null) {
this.F = new HashSet();
}
this.F.add(eVar);
}
public void H(Supplier<DataSource<CloseableReference<c.f.j.j.c>>> supplier, String str, CacheKey cacheKey, Object obj, e<a> eVar, b bVar) {
c.f.j.r.b.b();
n(str, obj);
this.v = false;
this.B = supplier;
K(null);
this.A = cacheKey;
this.D = null;
synchronized (this) {
this.G = null;
}
K(null);
F(null);
c.f.j.r.b.b();
}
public synchronized void I(c.f.g.a.a.h.e eVar, AbstractDraweeControllerBuilder<d, ImageRequest, CloseableReference<c.f.j.j.c>, ImageInfo> abstractDraweeControllerBuilder, Supplier<Boolean> supplier) {
f fVar = this.E;
if (fVar != null) {
fVar.c();
}
if (eVar != null) {
if (this.E == null) {
this.E = new f(AwakeTimeSinceBootClock.get(), this, supplier);
}
f fVar2 = this.E;
Objects.requireNonNull(fVar2);
if (fVar2.j == null) {
fVar2.j = new CopyOnWriteArrayList();
}
fVar2.j.add(eVar);
this.E.d(true);
h hVar = this.E.f361c;
hVar.f = abstractDraweeControllerBuilder.h;
hVar.g = null;
hVar.h = abstractDraweeControllerBuilder.i;
}
this.I = abstractDraweeControllerBuilder.h;
this.J = abstractDraweeControllerBuilder.i;
this.K = null;
}
public final Drawable J(e<a> eVar, c.f.j.j.c cVar) {
Drawable b;
if (eVar == null) {
return null;
}
Iterator<a> it = eVar.iterator();
while (it.hasNext()) {
a next = it.next();
if (next.a(cVar) && (b = next.b(cVar)) != null) {
return b;
}
}
return null;
}
public final void K(c.f.j.j.c cVar) {
String str;
p r0;
if (this.C) {
if (this.l == null) {
c.f.g.d.a aVar = new c.f.g.d.a();
c.f.g.d.b.a aVar2 = new c.f.g.d.b.a(aVar);
this.H = new c.f.g.a.a.g.b();
f(aVar2);
this.l = aVar;
c.f.g.h.a aVar3 = this.k;
if (aVar3 != null) {
aVar3.a(aVar);
}
}
if (this.G == null) {
F(this.H);
}
Drawable drawable = this.l;
if (drawable instanceof c.f.g.d.a) {
c.f.g.d.a aVar4 = (c.f.g.d.a) drawable;
String str2 = this.m;
if (str2 == null) {
str2 = "none";
}
aVar4.i = str2;
aVar4.invalidateSelf();
c.f.g.h.a aVar5 = this.k;
ScalingUtils$ScaleType scalingUtils$ScaleType = null;
if (!(aVar5 == null || (r0 = AnimatableValueParser.r0(aVar5.e())) == null)) {
scalingUtils$ScaleType = r0.m;
}
aVar4.m = scalingUtils$ScaleType;
int i = this.H.a;
switch (i) {
case 2:
str = "network";
break;
case 3:
str = "disk";
break;
case 4:
str = "memory_encoded";
break;
case 5:
str = "memory_bitmap";
break;
case 6:
str = "memory_bitmap_shortcut";
break;
case 7:
str = "local";
break;
default:
str = "unknown";
break;
}
int i2 = c.f.g.a.a.g.a.a.get(i, -1);
aVar4.B = str;
aVar4.C = i2;
aVar4.invalidateSelf();
if (cVar != null) {
int width = cVar.getWidth();
int height = cVar.getHeight();
aVar4.j = width;
aVar4.k = height;
aVar4.invalidateSelf();
aVar4.l = cVar.c();
return;
}
aVar4.c();
}
}
}
public synchronized void L(c.f.j.k.e eVar) {
Set<c.f.j.k.e> set = this.F;
if (set != null) {
set.remove(eVar);
}
}
@Override // com.facebook.drawee.controller.AbstractDraweeController, com.facebook.drawee.interfaces.DraweeController
public void e(DraweeHierarchy draweeHierarchy) {
super.e(draweeHierarchy);
K(null);
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
/* JADX INFO: finally extract failed */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public Drawable g(CloseableReference<c.f.j.j.c> closeableReference) {
CloseableReference<c.f.j.j.c> closeableReference2 = closeableReference;
try {
c.f.j.r.b.b();
AnimatableValueParser.B(CloseableReference.z(closeableReference2));
c.f.j.j.c w = closeableReference2.w();
K(w);
Drawable J = J(this.D, w);
if (J == null && (J = J(this.f357y, w)) == null && (J = this.f356x.b(w)) == null) {
throw new UnsupportedOperationException("Unrecognized image class: " + w);
}
c.f.j.r.b.b();
return J;
} catch (Throwable th) {
c.f.j.r.b.b();
throw th;
}
}
/* Return type fixed from 'java.lang.Object' to match base method */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public CloseableReference<c.f.j.j.c> h() {
c.f.j.r.b.b();
try {
w<CacheKey, c.f.j.j.c> wVar = this.f358z;
if (wVar != null) {
CacheKey cacheKey = this.A;
if (cacheKey != null) {
CloseableReference<c.f.j.j.c> closeableReference = wVar.get(cacheKey);
if (closeableReference == null || ((c.f.j.j.h) closeableReference.w().b()).d) {
c.f.j.r.b.b();
return closeableReference;
}
closeableReference.close();
}
}
return null;
} finally {
c.f.j.r.b.b();
}
}
@Override // com.facebook.drawee.controller.AbstractDraweeController
public DataSource<CloseableReference<c.f.j.j.c>> j() {
c.f.j.r.b.b();
if (c.f.d.e.a.h(2)) {
System.identityHashCode(this);
}
DataSource<CloseableReference<c.f.j.j.c>> dataSource = this.B.get();
c.f.j.r.b.b();
return dataSource;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public int k(CloseableReference<c.f.j.j.c> closeableReference) {
CloseableReference<c.f.j.j.c> closeableReference2 = closeableReference;
if (closeableReference2 == null || !closeableReference2.x()) {
return 0;
}
return System.identityHashCode(closeableReference2.n.c());
}
/* Return type fixed from 'java.lang.Object' to match base method */
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public ImageInfo l(CloseableReference<c.f.j.j.c> closeableReference) {
CloseableReference<c.f.j.j.c> closeableReference2 = closeableReference;
AnimatableValueParser.B(CloseableReference.z(closeableReference2));
return closeableReference2.w();
}
/* JADX WARNING: Code restructure failed: missing block: B:14:0x0021, code lost:
if (r0 != null) goto L_0x000d;
*/
@Override // com.facebook.drawee.controller.AbstractDraweeController
public Uri m() {
Uri uri;
ImageRequest imageRequest = this.I;
ImageRequest imageRequest2 = this.K;
ImageRequest[] imageRequestArr = this.J;
if (imageRequest == null || (uri = imageRequest.f2182c) == null) {
if (!(imageRequestArr == null || imageRequestArr.length <= 0 || imageRequestArr[0] == null)) {
ImageRequest imageRequest3 = imageRequestArr[0];
uri = imageRequest3 != null ? imageRequest3.f2182c : null;
}
if (imageRequest2 != null) {
return imageRequest2.f2182c;
}
return null;
}
return uri;
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public Map t(ImageInfo imageInfo) {
ImageInfo imageInfo2 = imageInfo;
if (imageInfo2 == null) {
return null;
}
return imageInfo2.a();
}
@Override // com.facebook.drawee.controller.AbstractDraweeController
public String toString() {
i F2 = AnimatableValueParser.F2(this);
F2.c("super", super.toString());
F2.c("dataSourceSupplier", this.B);
return F2.toString();
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.String, java.lang.Object] */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public void v(String str, CloseableReference<c.f.j.j.c> closeableReference) {
synchronized (this) {
b bVar = this.G;
if (bVar != null) {
bVar.a(str, 6, true, "PipelineDraweeController");
}
}
}
@Override // com.facebook.drawee.controller.AbstractDraweeController
public void x(Drawable drawable) {
if (drawable instanceof c.f.f.a.a) {
((c.f.f.a.a) drawable).a();
}
}
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
@Override // com.facebook.drawee.controller.AbstractDraweeController
public void z(CloseableReference<c.f.j.j.c> closeableReference) {
CloseableReference<c.f.j.j.c> closeableReference2 = closeableReference;
Class<CloseableReference> cls = CloseableReference.i;
if (closeableReference2 != null) {
closeableReference2.close();
}
}
}