package o; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemClock; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; /* renamed from: o.cSn, reason: case insensitive filesystem */ /* loaded from: classes.dex */ public final class C6431cSn { final sqY a; int b; final List c; RVV d; public Bitmap e; int f; RVV g; boolean h; boolean i; public final TTv j; final YSJ k; private final Handler l; private boolean m; RVV n; /* renamed from: o, reason: collision with root package name */ int f8625o; private Cdw p; private HBt q; private wfh s; private boolean t; /* renamed from: o.cSn$HBt */ /* loaded from: classes.dex */ interface HBt { } /* renamed from: o.cSn$IeS */ /* loaded from: classes.dex */ public interface IeS { void a(); } private C6431cSn(sqY sqy, YSJ ysj, TTv tTv, Cdw cdw, wfh wfhVar, Bitmap bitmap) { this.c = new ArrayList(); this.k = ysj; Handler handler = new Handler(Looper.getMainLooper(), new LWm(this)); this.a = sqy; this.l = handler; this.p = cdw; this.j = tTv; Fs_(wfhVar, bitmap); } /* JADX INFO: Access modifiers changed from: package-private */ public final void e() { if (!this.i || this.m) { return; } RVV rvv = this.n; if (rvv != null) { this.n = null; d(rvv); return; } this.m = true; int j = this.j.j(); this.j.c(); this.g = new RVV(this.l, this.j.e(), SystemClock.uptimeMillis() + j); Cdw c = this.p.b(new PNS().c(new xBn(Double.valueOf(Math.random())))).c(this.j); c.a(this.g, null, c, C3107arK.d()); } final void d(RVV rvv) { this.m = false; if (this.h) { this.l.obtainMessage(2, rvv).sendToTarget(); return; } if (!this.i) { this.n = rvv; return; } if (rvv.e != null) { Bitmap bitmap = this.e; if (bitmap != null) { this.a.EP_(bitmap); this.e = null; } RVV rvv2 = this.d; this.d = rvv; for (int size = this.c.size() - 1; size >= 0; size--) { this.c.get(size).a(); } if (rvv2 != null) { this.l.obtainMessage(2, rvv2).sendToTarget(); } } e(); } /* renamed from: o.cSn$LWm */ /* loaded from: classes.dex */ class LWm implements Handler.Callback { private C6431cSn d; LWm(C6431cSn c6431cSn) { this.d = c6431cSn; } @Override // android.os.Handler.Callback public final boolean handleMessage(Message message) { if (message.what == 1) { this.d.d((RVV) message.obj); return true; } if (message.what != 2) { return false; } RVV rvv = (RVV) message.obj; YSJ ysj = this.d.k; if (rvv == null) { return false; } ysj.c(rvv); return false; } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: o.cSn$RVV */ /* loaded from: classes.dex */ public static class RVV extends qNQ { private final Handler a; final int b; private final long c; Bitmap e; @Override // o.YcZ public final /* synthetic */ void d(Object obj) { this.e = (Bitmap) obj; this.a.sendMessageAtTime(this.a.obtainMessage(1, this), this.c); } RVV(Handler handler, int i, long j) { this.a = handler; this.b = i; this.c = j; } @Override // o.YcZ public final void avx_(Drawable drawable) { this.e = null; } } /* JADX INFO: Access modifiers changed from: package-private */ public C6431cSn(Glide glide, TTv tTv, int i, int i2, wfh wfhVar, Bitmap bitmap) { this(glide.a, Glide.e(glide.c.getBaseContext()), tTv, Glide.e(glide.c.getBaseContext()).b().b(new PNS().a(LHy.e).q().p().b(i, i2)), wfhVar, bitmap); } /* JADX INFO: Access modifiers changed from: package-private */ public final void Fs_(wfh wfhVar, Bitmap bitmap) { if (wfhVar == null) { throw new NullPointerException("Argument must not be null"); } this.s = wfhVar; if (bitmap != null) { this.e = bitmap; this.p = this.p.b(new PNS().b(wfhVar, true)); this.b = FKd.FX_(bitmap); this.f8625o = bitmap.getWidth(); this.f = bitmap.getHeight(); return; } throw new NullPointerException("Argument must not be null"); } }