discord-jadx/app/src/main/java/com/facebook/drawee/view/DraweeHolder.java

129 lines
3.2 KiB
Java

package com.facebook.drawee.view;
import android.graphics.drawable.Drawable;
import c.f.d.d.i;
import c.f.g.b.c;
import c.f.g.e.f0;
import c.f.g.e.g0;
import com.airbnb.lottie.parser.AnimatableValueParser;
import com.facebook.drawee.interfaces.DraweeController;
import com.facebook.drawee.interfaces.DraweeHierarchy;
import java.util.Objects;
public class DraweeHolder<DH extends DraweeHierarchy> implements g0 {
public boolean a = false;
public boolean b = false;
/* renamed from: c reason: collision with root package name */
public boolean f2173c = true;
public DH d;
public DraweeController e = null;
public final c f;
public DraweeHolder(DH dh) {
this.f = c.b ? new c() : c.a;
if (dh != null) {
h(dh);
}
}
public final void a() {
if (!this.a) {
this.f.a(c.a.ON_ATTACH_CONTROLLER);
this.a = true;
DraweeController draweeController = this.e;
if (draweeController != null && draweeController.b() != null) {
this.e.d();
}
}
}
public final void b() {
if (!this.b || !this.f2173c) {
c();
} else {
a();
}
}
public final void c() {
if (this.a) {
this.f.a(c.a.ON_DETACH_CONTROLLER);
this.a = false;
if (e()) {
this.e.a();
}
}
}
public Drawable d() {
DH dh = this.d;
if (dh == null) {
return null;
}
return dh.e();
}
public boolean e() {
DraweeController draweeController = this.e;
return draweeController != null && draweeController.b() == this.d;
}
public void f(boolean z2) {
if (this.f2173c != z2) {
this.f.a(z2 ? c.a.ON_DRAWABLE_SHOW : c.a.ON_DRAWABLE_HIDE);
this.f2173c = z2;
b();
}
}
public void g(DraweeController draweeController) {
boolean z2 = this.a;
if (z2) {
c();
}
if (e()) {
this.f.a(c.a.ON_CLEAR_OLD_CONTROLLER);
this.e.e(null);
}
this.e = draweeController;
if (draweeController != null) {
this.f.a(c.a.ON_SET_CONTROLLER);
this.e.e(this.d);
} else {
this.f.a(c.a.ON_CLEAR_CONTROLLER);
}
if (z2) {
a();
}
}
public void h(DH dh) {
this.f.a(c.a.ON_SET_HIERARCHY);
boolean e = e();
Drawable d = d();
if (d instanceof f0) {
((f0) d).k(null);
}
Objects.requireNonNull(dh);
this.d = dh;
Drawable e2 = dh.e();
f(e2 == null || e2.isVisible());
Drawable d2 = d();
if (d2 instanceof f0) {
((f0) d2).k(this);
}
if (e) {
this.e.e(dh);
}
}
public String toString() {
i F2 = AnimatableValueParser.F2(this);
F2.b("controllerAttached", this.a);
F2.b("holderAttached", this.b);
F2.b("drawableVisible", this.f2173c);
F2.c("events", this.f.toString());
return F2.toString();
}
}