package o; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Outline; import android.graphics.Paint; import android.graphics.PorterDuff; import android.graphics.PorterDuffColorFilter; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; /* loaded from: classes.dex */ final class WBR extends Drawable { float b; ColorStateList d; float e; private PorterDuffColorFilter f; private final Rect g; private ColorStateList h; private final RectF i; boolean a = false; boolean c = true; private PorterDuff.Mode m = PorterDuff.Mode.SRC_IN; private final Paint j = new Paint(5); @Override // android.graphics.drawable.Drawable public final int getOpacity() { return -3; } /* JADX INFO: Access modifiers changed from: package-private */ public WBR(ColorStateList colorStateList, float f) { this.b = f; ko_(colorStateList); this.i = new RectF(); this.g = new Rect(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void ko_(ColorStateList colorStateList) { if (colorStateList == null) { colorStateList = ColorStateList.valueOf(0); } this.d = colorStateList; this.j.setColor(colorStateList.getColorForState(getState(), this.d.getDefaultColor())); } @Override // android.graphics.drawable.Drawable public final void draw(Canvas canvas) { boolean z; Paint paint = this.j; if (this.f == null || paint.getColorFilter() != null) { z = false; } else { paint.setColorFilter(this.f); z = true; } RectF rectF = this.i; float f = this.b; canvas.drawRoundRect(rectF, f, f, paint); if (z) { paint.setColorFilter(null); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void kp_(Rect rect) { if (rect == null) { rect = getBounds(); } this.i.set(rect.left, rect.top, rect.right, rect.bottom); this.g.set(rect); if (this.a) { this.g.inset((int) Math.ceil(pvK.e(this.e, this.b, this.c)), (int) Math.ceil(pvK.b(this.e, this.b, this.c))); this.i.set(this.g); } } @Override // android.graphics.drawable.Drawable protected final void onBoundsChange(Rect rect) { super.onBoundsChange(rect); kp_(rect); } @Override // android.graphics.drawable.Drawable public final void getOutline(Outline outline) { outline.setRoundRect(this.g, this.b); } @Override // android.graphics.drawable.Drawable public final void setAlpha(int i) { this.j.setAlpha(i); } @Override // android.graphics.drawable.Drawable public final void setColorFilter(ColorFilter colorFilter) { this.j.setColorFilter(colorFilter); } @Override // android.graphics.drawable.Drawable protected final boolean onStateChange(int[] iArr) { PorterDuff.Mode mode; ColorStateList colorStateList = this.d; int colorForState = colorStateList.getColorForState(iArr, colorStateList.getDefaultColor()); boolean z = colorForState != this.j.getColor(); if (z) { this.j.setColor(colorForState); } ColorStateList colorStateList2 = this.h; if (colorStateList2 == null || (mode = this.m) == null) { return z; } this.f = (colorStateList2 == null || mode == null) ? null : new PorterDuffColorFilter(colorStateList2.getColorForState(getState(), 0), mode); return true; } @Override // android.graphics.drawable.Drawable public final boolean isStateful() { ColorStateList colorStateList; ColorStateList colorStateList2 = this.h; return (colorStateList2 != null && colorStateList2.isStateful()) || ((colorStateList = this.d) != null && colorStateList.isStateful()) || super.isStateful(); } @Override // android.graphics.drawable.Drawable public final void setTintList(ColorStateList colorStateList) { this.h = colorStateList; PorterDuff.Mode mode = this.m; this.f = (colorStateList == null || mode == null) ? null : new PorterDuffColorFilter(colorStateList.getColorForState(getState(), 0), mode); invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final void setTintMode(PorterDuff.Mode mode) { this.m = mode; ColorStateList colorStateList = this.h; this.f = (colorStateList == null || mode == null) ? null : new PorterDuffColorFilter(colorStateList.getColorForState(getState(), 0), mode); invalidateSelf(); } }