package o; import android.content.Context; import android.content.res.TypedArray; import android.graphics.Canvas; import android.graphics.ColorFilter; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Rect; import android.graphics.drawable.Drawable; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import o.SYO; /* loaded from: classes.dex */ public final class ZVM extends Drawable { private static final float c = (float) Math.toRadians(45.0d); public final Paint a; public float b; private float d; private float e; private float f; private float g; private final Path h; private float i; private int j; private final int k; private boolean m; /* renamed from: o, reason: collision with root package name */ private boolean f8483o; @Override // android.graphics.drawable.Drawable public final int getOpacity() { return -3; } public ZVM(Context context) { Paint paint = new Paint(); this.a = paint; this.h = new Path(); this.m = false; this.j = 2; paint.setStyle(Paint.Style.STROKE); paint.setStrokeJoin(Paint.Join.MITER); paint.setStrokeCap(Paint.Cap.BUTT); paint.setAntiAlias(true); TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(null, SYO.ZqN.DrawerArrowToggle, SYO.IeS.drawerArrowStyle, SYO.jbe.Base_Widget_AppCompat_DrawerArrowToggle); int color = obtainStyledAttributes.getColor(SYO.ZqN.DrawerArrowToggle_color, 0); if (color != paint.getColor()) { paint.setColor(color); invalidateSelf(); } float dimension = obtainStyledAttributes.getDimension(SYO.ZqN.DrawerArrowToggle_thickness, BitmapDescriptorFactory.HUE_RED); if (paint.getStrokeWidth() != dimension) { paint.setStrokeWidth(dimension); this.g = (float) ((dimension / 2.0f) * Math.cos(c)); invalidateSelf(); } boolean z = obtainStyledAttributes.getBoolean(SYO.ZqN.DrawerArrowToggle_spinBars, true); if (this.f8483o != z) { this.f8483o = z; invalidateSelf(); } float round = Math.round(obtainStyledAttributes.getDimension(SYO.ZqN.DrawerArrowToggle_gapBetweenBars, BitmapDescriptorFactory.HUE_RED)); if (round != this.i) { this.i = round; invalidateSelf(); } this.k = obtainStyledAttributes.getDimensionPixelSize(SYO.ZqN.DrawerArrowToggle_drawableSize, 0); this.f = Math.round(obtainStyledAttributes.getDimension(SYO.ZqN.DrawerArrowToggle_barLength, BitmapDescriptorFactory.HUE_RED)); this.e = Math.round(obtainStyledAttributes.getDimension(SYO.ZqN.DrawerArrowToggle_arrowHeadLength, BitmapDescriptorFactory.HUE_RED)); this.d = obtainStyledAttributes.getDimension(SYO.ZqN.DrawerArrowToggle_arrowShaftLength, BitmapDescriptorFactory.HUE_RED); obtainStyledAttributes.recycle(); } @Override // android.graphics.drawable.Drawable public final void draw(Canvas canvas) { Rect bounds = getBounds(); int i = this.j; boolean z = false; if (i != 0 && (i == 1 || (i == 3 ? Tlu.pw_(this) == 0 : Tlu.pw_(this) == 1))) { z = true; } float f = this.e; float sqrt = (float) Math.sqrt(f * f * 2.0f); float f2 = this.f; float f3 = this.b; float f4 = ((sqrt - f2) * f3) + f2; float f5 = f2 + ((this.d - f2) * f3); float round = Math.round((this.g * f3) + BitmapDescriptorFactory.HUE_RED); float f6 = c; float f7 = this.b; float f8 = (f6 * f7) + BitmapDescriptorFactory.HUE_RED; float f9 = z ? 0.0f : -180.0f; float f10 = f9 + (((z ? 180.0f : 0.0f) - f9) * f7); double d = f4; double d2 = f8; boolean z2 = z; float round2 = (float) Math.round(Math.cos(d2) * d); float round3 = (float) Math.round(d * Math.sin(d2)); this.h.rewind(); float strokeWidth = this.i + this.a.getStrokeWidth(); float f11 = strokeWidth + (((-this.g) - strokeWidth) * this.b); float f12 = (-f5) / 2.0f; this.h.moveTo(f12 + round, BitmapDescriptorFactory.HUE_RED); this.h.rLineTo(f5 - (round * 2.0f), BitmapDescriptorFactory.HUE_RED); this.h.moveTo(f12, f11); this.h.rLineTo(round2, round3); this.h.moveTo(f12, -f11); this.h.rLineTo(round2, -round3); this.h.close(); canvas.save(); float strokeWidth2 = this.a.getStrokeWidth(); float height = bounds.height(); canvas.translate(bounds.centerX(), ((((int) ((height - (3.0f * strokeWidth2)) - (2.0f * r7))) / 4) << 1) + (strokeWidth2 * 1.5f) + this.i); if (this.f8483o) { canvas.rotate(f10 * (this.m ^ z2 ? -1 : 1)); } else if (z2) { canvas.rotate(180.0f); } canvas.drawPath(this.h, this.a); canvas.restore(); } @Override // android.graphics.drawable.Drawable public final void setAlpha(int i) { if (i != this.a.getAlpha()) { this.a.setAlpha(i); invalidateSelf(); } } @Override // android.graphics.drawable.Drawable public final void setColorFilter(ColorFilter colorFilter) { this.a.setColorFilter(colorFilter); invalidateSelf(); } @Override // android.graphics.drawable.Drawable public final int getIntrinsicWidth() { return this.k; } @Override // android.graphics.drawable.Drawable public final int getIntrinsicHeight() { return this.k; } }