234 lines
6.5 KiB
Java
234 lines
6.5 KiB
Java
|
package o;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.res.Resources;
|
||
|
import android.graphics.Bitmap;
|
||
|
import android.graphics.Canvas;
|
||
|
import android.graphics.ColorFilter;
|
||
|
import android.graphics.Paint;
|
||
|
import android.graphics.Rect;
|
||
|
import android.graphics.drawable.Animatable;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.view.Gravity;
|
||
|
import androidx.vectordrawable.graphics.drawable.Animatable2Compat;
|
||
|
import com.bumptech.glide.Glide;
|
||
|
import java.util.List;
|
||
|
import o.C6431cSn;
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public class RiR extends Drawable implements C6431cSn.IeS, Animatable, Animatable2Compat {
|
||
|
public final HBt a;
|
||
|
boolean b;
|
||
|
private boolean c;
|
||
|
private List<Animatable2Compat.AnimationCallback> d;
|
||
|
private Rect e;
|
||
|
private boolean f;
|
||
|
private boolean g;
|
||
|
private boolean h;
|
||
|
private int i;
|
||
|
private int j;
|
||
|
private Paint m;
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public int getOpacity() {
|
||
|
return -2;
|
||
|
}
|
||
|
|
||
|
public RiR(Context context, TTv tTv, wfh<Bitmap> wfhVar, int i, int i2, Bitmap bitmap) {
|
||
|
this(new HBt(new C6431cSn(Glide.a(context), tTv, i, i2, wfhVar, bitmap)));
|
||
|
}
|
||
|
|
||
|
RiR(HBt hBt) {
|
||
|
this.g = true;
|
||
|
this.j = -1;
|
||
|
this.a = hBt;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Animatable
|
||
|
public void stop() {
|
||
|
this.f = false;
|
||
|
d();
|
||
|
}
|
||
|
|
||
|
private void b() {
|
||
|
if (!(!this.b)) {
|
||
|
throw new IllegalArgumentException("You cannot start a recycled Drawable. Ensure thatyou clear any references to the Drawable when clearing the corresponding request.");
|
||
|
}
|
||
|
if (this.a.c.j.i() != 1) {
|
||
|
if (this.h) {
|
||
|
return;
|
||
|
}
|
||
|
this.h = true;
|
||
|
C6431cSn c6431cSn = this.a.c;
|
||
|
if (c6431cSn.h) {
|
||
|
throw new IllegalStateException("Cannot subscribe to a cleared frame loader");
|
||
|
}
|
||
|
if (c6431cSn.c.contains(this)) {
|
||
|
throw new IllegalStateException("Cannot subscribe twice in a row");
|
||
|
}
|
||
|
boolean isEmpty = c6431cSn.c.isEmpty();
|
||
|
c6431cSn.c.add(this);
|
||
|
if (isEmpty && !c6431cSn.i) {
|
||
|
c6431cSn.i = true;
|
||
|
c6431cSn.h = false;
|
||
|
c6431cSn.e();
|
||
|
}
|
||
|
}
|
||
|
invalidateSelf();
|
||
|
}
|
||
|
|
||
|
private void d() {
|
||
|
this.h = false;
|
||
|
C6431cSn c6431cSn = this.a.c;
|
||
|
c6431cSn.c.remove(this);
|
||
|
if (c6431cSn.c.isEmpty()) {
|
||
|
c6431cSn.i = false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public boolean setVisible(boolean z, boolean z2) {
|
||
|
if (!this.b) {
|
||
|
this.g = z;
|
||
|
if (!z) {
|
||
|
d();
|
||
|
} else if (this.f) {
|
||
|
b();
|
||
|
}
|
||
|
return super.setVisible(z, z2);
|
||
|
}
|
||
|
throw new IllegalArgumentException("Cannot change the visibility of a recycled resource. Ensure that you unset the Drawable from your View before changing the View's visibility.");
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public int getIntrinsicWidth() {
|
||
|
return this.a.c.f8625o;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public int getIntrinsicHeight() {
|
||
|
return this.a.c.f;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
protected void onBoundsChange(Rect rect) {
|
||
|
super.onBoundsChange(rect);
|
||
|
this.c = true;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void draw(Canvas canvas) {
|
||
|
Bitmap bitmap;
|
||
|
if (this.b) {
|
||
|
return;
|
||
|
}
|
||
|
if (this.c) {
|
||
|
int intrinsicWidth = getIntrinsicWidth();
|
||
|
int intrinsicHeight = getIntrinsicHeight();
|
||
|
Rect bounds = getBounds();
|
||
|
if (this.e == null) {
|
||
|
this.e = new Rect();
|
||
|
}
|
||
|
Gravity.apply(119, intrinsicWidth, intrinsicHeight, bounds, this.e);
|
||
|
this.c = false;
|
||
|
}
|
||
|
C6431cSn c6431cSn = this.a.c;
|
||
|
C6431cSn.RVV rvv = c6431cSn.d;
|
||
|
if (rvv == null) {
|
||
|
bitmap = c6431cSn.e;
|
||
|
} else {
|
||
|
bitmap = rvv.e;
|
||
|
}
|
||
|
if (this.e == null) {
|
||
|
this.e = new Rect();
|
||
|
}
|
||
|
Rect rect = this.e;
|
||
|
if (this.m == null) {
|
||
|
this.m = new Paint(2);
|
||
|
}
|
||
|
canvas.drawBitmap(bitmap, (Rect) null, rect, this.m);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void setAlpha(int i) {
|
||
|
if (this.m == null) {
|
||
|
this.m = new Paint(2);
|
||
|
}
|
||
|
this.m.setAlpha(i);
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public void setColorFilter(ColorFilter colorFilter) {
|
||
|
if (this.m == null) {
|
||
|
this.m = new Paint(2);
|
||
|
}
|
||
|
this.m.setColorFilter(colorFilter);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes.dex */
|
||
|
public static final class HBt extends Drawable.ConstantState {
|
||
|
public final C6431cSn c;
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
||
|
public final int getChangingConfigurations() {
|
||
|
return 0;
|
||
|
}
|
||
|
|
||
|
HBt(C6431cSn c6431cSn) {
|
||
|
this.c = c6431cSn;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
||
|
public final Drawable newDrawable(Resources resources) {
|
||
|
return newDrawable();
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable.ConstantState
|
||
|
public final Drawable newDrawable() {
|
||
|
return new RiR(this);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // o.C6431cSn.IeS
|
||
|
public final void a() {
|
||
|
Object callback = getCallback();
|
||
|
while (callback instanceof Drawable) {
|
||
|
callback = ((Drawable) callback).getCallback();
|
||
|
}
|
||
|
if (callback == null) {
|
||
|
stop();
|
||
|
invalidateSelf();
|
||
|
return;
|
||
|
}
|
||
|
invalidateSelf();
|
||
|
C6431cSn.RVV rvv = this.a.c.d;
|
||
|
if ((rvv != null ? rvv.b : -1) == this.a.c.j.i() - 1) {
|
||
|
this.i++;
|
||
|
}
|
||
|
int i = this.j;
|
||
|
if (i == -1 || this.i < i) {
|
||
|
return;
|
||
|
}
|
||
|
stop();
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Animatable
|
||
|
public void start() {
|
||
|
this.f = true;
|
||
|
this.i = 0;
|
||
|
if (this.g) {
|
||
|
b();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Animatable
|
||
|
public boolean isRunning() {
|
||
|
return this.h;
|
||
|
}
|
||
|
|
||
|
@Override // android.graphics.drawable.Drawable
|
||
|
public Drawable.ConstantState getConstantState() {
|
||
|
return this.a;
|
||
|
}
|
||
|
}
|