what-the-bank/sources/o/Etv.java

174 lines
5.0 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package o;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.Shader;
import android.graphics.drawable.Drawable;
/* loaded from: classes.dex */
public abstract class Etv extends Drawable {
private final BitmapShader b;
private int c;
final Bitmap d;
private float g;
private int h;
private boolean i;
/* renamed from: o, reason: collision with root package name */
private int f8153o;
private int j = 119;
private final Paint n = new Paint(3);
private final Matrix m = new Matrix();
final Rect a = new Rect();
private final RectF f = new RectF();
private boolean e = true;
private static boolean e(float f) {
return f > 0.05f;
}
private void c() {
this.h = this.d.getScaledWidth(this.f8153o);
this.c = this.d.getScaledHeight(this.f8153o);
}
@Override // android.graphics.drawable.Drawable
public void setFilterBitmap(boolean z) {
this.n.setFilterBitmap(z);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public void setDither(boolean z) {
this.n.setDither(z);
invalidateSelf();
}
void qk_(int i, int i2, int i3, Rect rect, Rect rect2) {
throw new UnsupportedOperationException();
}
/* JADX INFO: Access modifiers changed from: package-private */
public void e() {
if (this.e) {
if (this.i) {
int min = Math.min(this.h, this.c);
qk_(this.j, min, min, getBounds(), this.a);
int min2 = Math.min(this.a.width(), this.a.height());
this.a.inset(Math.max(0, (this.a.width() - min2) / 2), Math.max(0, (this.a.height() - min2) / 2));
this.g = min2 * 0.5f;
} else {
qk_(this.j, this.h, this.c, getBounds(), this.a);
}
this.f.set(this.a);
if (this.b != null) {
this.m.setTranslate(this.f.left, this.f.top);
this.m.preScale(this.f.width() / this.d.getWidth(), this.f.height() / this.d.getHeight());
this.b.setLocalMatrix(this.m);
this.n.setShader(this.b);
}
this.e = false;
}
}
@Override // android.graphics.drawable.Drawable
public void draw(Canvas canvas) {
Bitmap bitmap = this.d;
if (bitmap == null) {
return;
}
e();
if (this.n.getShader() == null) {
canvas.drawBitmap(bitmap, (Rect) null, this.a, this.n);
return;
}
RectF rectF = this.f;
float f = this.g;
canvas.drawRoundRect(rectF, f, f, this.n);
}
@Override // android.graphics.drawable.Drawable
public void setAlpha(int i) {
if (i != this.n.getAlpha()) {
this.n.setAlpha(i);
invalidateSelf();
}
}
@Override // android.graphics.drawable.Drawable
public int getAlpha() {
return this.n.getAlpha();
}
@Override // android.graphics.drawable.Drawable
public void setColorFilter(ColorFilter colorFilter) {
this.n.setColorFilter(colorFilter);
invalidateSelf();
}
@Override // android.graphics.drawable.Drawable
public ColorFilter getColorFilter() {
return this.n.getColorFilter();
}
private void b() {
this.g = Math.min(this.c, this.h) / 2;
}
@Override // android.graphics.drawable.Drawable
protected void onBoundsChange(Rect rect) {
super.onBoundsChange(rect);
if (this.i) {
b();
}
this.e = true;
}
@Override // android.graphics.drawable.Drawable
public int getOpacity() {
Bitmap bitmap;
return (this.j != 119 || this.i || (bitmap = this.d) == null || bitmap.hasAlpha() || this.n.getAlpha() < 255 || e(this.g)) ? -3 : -1;
}
/* JADX INFO: Access modifiers changed from: package-private */
public Etv(Resources resources, Bitmap bitmap) {
BitmapShader bitmapShader;
this.f8153o = 160;
if (resources != null) {
this.f8153o = resources.getDisplayMetrics().densityDpi;
}
this.d = bitmap;
if (bitmap != null) {
c();
Shader.TileMode tileMode = Shader.TileMode.CLAMP;
bitmapShader = new BitmapShader(bitmap, tileMode, tileMode);
} else {
this.c = -1;
this.h = -1;
bitmapShader = null;
}
this.b = bitmapShader;
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicWidth() {
return this.h;
}
@Override // android.graphics.drawable.Drawable
public int getIntrinsicHeight() {
return this.c;
}
public float d() {
return this.g;
}
}