package o; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.LinearGradient; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Shader; import android.graphics.drawable.Drawable; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import o.EgE; /* loaded from: classes2.dex */ public final class Gmh extends Drawable { int a; int b; final Paint c; float e; int f; int g; private ColorStateList h; FLD i; /* renamed from: o, reason: collision with root package name */ private int f8187o; private final EgE k = EgE.Sts.a; private final Path l = new Path(); private final Rect n = new Rect(); private final RectF m = new RectF(); private final RectF j = new RectF(); private final RVV t = new RVV(this, 0); boolean d = true; /* JADX INFO: Access modifiers changed from: package-private */ public Gmh(FLD fld) { this.i = fld; Paint paint = new Paint(1); this.c = paint; paint.setStyle(Paint.Style.STROKE); } public final void Jb_(ColorStateList colorStateList) { if (colorStateList != null) { this.f8187o = colorStateList.getColorForState(getState(), this.f8187o); } this.h = colorStateList; this.d = true; invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final void setColorFilter(ColorFilter colorFilter) { this.c.setColorFilter(colorFilter); invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final void draw(Canvas canvas) { if (this.d) { Paint paint = this.c; copyBounds(this.n); float height = this.e / r2.height(); paint.setShader(new LinearGradient(BitmapDescriptorFactory.HUE_RED, r2.top, BitmapDescriptorFactory.HUE_RED, r2.bottom, new int[]{Rez.a(this.g, this.f8187o), Rez.a(this.f, this.f8187o), Rez.a(Rez.d(this.f, 0), this.f8187o), Rez.a(Rez.d(this.a, 0), this.f8187o), Rez.a(this.a, this.f8187o), Rez.a(this.b, this.f8187o)}, new float[]{BitmapDescriptorFactory.HUE_RED, height, 0.5f, 0.5f, 1.0f - height, 1.0f}, Shader.TileMode.CLAMP)); this.d = false; } float strokeWidth = this.c.getStrokeWidth() / 2.0f; copyBounds(this.n); this.m.set(this.n); kdE kde = this.i.n; this.j.set(getBounds()); float min = Math.min(kde.Lk_(this.j), this.m.width() / 2.0f); FLD fld = this.i; this.j.set(getBounds()); if (fld.Ln_(this.j)) { this.m.inset(strokeWidth, strokeWidth); canvas.drawRoundRect(this.m, min, min, this.c); } } @Override // android.graphics.drawable.Drawable public final void getOutline(Outline outline) { FLD fld = this.i; this.j.set(getBounds()); if (!fld.Ln_(this.j)) { copyBounds(this.n); this.m.set(this.n); this.k.Lp_(this.i, 1.0f, this.m, null, this.l); NiE.IX_(outline, this.l); return; } kdE kde = this.i.n; this.j.set(getBounds()); outline.setRoundRect(getBounds(), kde.Lk_(this.j)); } @Override // android.graphics.drawable.Drawable public final boolean getPadding(Rect rect) { FLD fld = this.i; this.j.set(getBounds()); if (!fld.Ln_(this.j)) { return true; } int round = Math.round(this.e); rect.set(round, round, round, round); return true; } @Override // android.graphics.drawable.Drawable public final void setAlpha(int i) { this.c.setAlpha(i); invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final boolean isStateful() { ColorStateList colorStateList = this.h; return (colorStateList != null && colorStateList.isStateful()) || super.isStateful(); } @Override // android.graphics.drawable.Drawable protected final boolean onStateChange(int[] iArr) { int colorForState; ColorStateList colorStateList = this.h; if (colorStateList != null && (colorForState = colorStateList.getColorForState(iArr, this.f8187o)) != this.f8187o) { this.d = true; this.f8187o = colorForState; } if (this.d) { invalidateSelf(); } return this.d; } /* loaded from: classes2.dex */ class RVV extends Drawable.ConstantState { private Gmh a; @Override // android.graphics.drawable.Drawable.ConstantState public final int getChangingConfigurations() { return 0; } private RVV(Gmh gmh) { this.a = gmh; } /* synthetic */ RVV(Gmh gmh, byte b) { this(gmh); } @Override // android.graphics.drawable.Drawable.ConstantState public final Drawable newDrawable() { return this.a; } } @Override // android.graphics.drawable.Drawable protected final void onBoundsChange(Rect rect) { this.d = true; } @Override // android.graphics.drawable.Drawable public final int getOpacity() { return this.e > BitmapDescriptorFactory.HUE_RED ? -3 : -2; } @Override // android.graphics.drawable.Drawable public final Drawable.ConstantState getConstantState() { return this.t; } }