package com.discord.views; import android.content.Context; import android.content.res.Resources; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.Path; import android.graphics.Point; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.util.TypedValue; import android.view.LayoutInflater; import android.widget.LinearLayout; import android.widget.TextView; import c.a.i.z3; import c.a.y.e0; import com.discord.utilities.color.ColorCompat; import d0.a0.a; import d0.g; import d0.z.d.m; import kotlin.Lazy; /* compiled from: VoiceUserLimitView.kt */ public final class VoiceUserLimitView extends LinearLayout { public final z3 i; public final Paint j; public final int k; public final Path l; public final Point m; public final Point n; public final Point o; public final Lazy p; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public VoiceUserLimitView(Context context, AttributeSet attributeSet) { super(context, attributeSet); m.checkNotNullParameter(context, "context"); LayoutInflater.from(getContext()).inflate(2131558839, this); int i = 2131365706; TextView textView = (TextView) findViewById(2131365706); if (textView != null) { i = 2131365707; TextView textView2 = (TextView) findViewById(2131365707); if (textView2 != null) { z3 z3Var = new z3(this, textView, textView2); m.checkNotNullExpressionValue(z3Var, "VoiceUserLimitViewBindin…ater.from(context), this)"); this.i = z3Var; Paint paint = new Paint(1); this.j = paint; Path path = new Path(); this.l = path; this.m = new Point(); this.n = new Point(); this.o = new Point(); this.p = g.lazy(new e0(this)); Resources resources = getResources(); m.checkNotNullExpressionValue(resources, "resources"); this.k = a.roundToInt(TypedValue.applyDimension(1, 6.0f, resources.getDisplayMetrics())); paint.setColor(ColorCompat.getThemedColor(getContext(), 2130968898)); paint.setStrokeWidth(2.0f); paint.setStyle(Paint.Style.FILL_AND_STROKE); paint.setAntiAlias(true); path.setFillType(Path.FillType.EVEN_ODD); return; } } throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i))); } private final Drawable getVideoCamDrawable() { return (Drawable) this.p.getValue(); } public final void a(int i, int i2, boolean z2) { TextView textView = this.i.b; m.checkNotNullExpressionValue(textView, "binding.voiceUserLimitCurrent"); textView.setText(i < 100 ? c.d.b.a.a.G(new Object[]{Integer.valueOf(i)}, 1, "%02d", "java.lang.String.format(format, *args)") : String.valueOf(i)); TextView textView2 = this.i.f195c; m.checkNotNullExpressionValue(textView2, "binding.voiceUserLimitMax"); textView2.setText(i2 < 100 ? c.d.b.a.a.G(new Object[]{Integer.valueOf(i2)}, 1, "%02d", "java.lang.String.format(format, *args)") : String.valueOf(i2)); if (z2) { this.i.b.setCompoundDrawablesWithIntrinsicBounds(getVideoCamDrawable(), (Drawable) null, (Drawable) null, (Drawable) null); } else { this.i.b.setCompoundDrawablesWithIntrinsicBounds((Drawable) null, (Drawable) null, (Drawable) null, (Drawable) null); } } @Override // android.view.View, android.view.ViewGroup public void dispatchDraw(Canvas canvas) { super.dispatchDraw(canvas); m.checkNotNull(canvas); int height = getHeight(); TextView textView = this.i.b; m.checkNotNullExpressionValue(textView, "binding.voiceUserLimitCurrent"); int width = textView.getWidth(); TextView textView2 = this.i.b; m.checkNotNullExpressionValue(textView2, "binding.voiceUserLimitCurrent"); int width2 = textView2.getWidth() + this.k; this.m.set(width, height); this.n.set(width2, 0); this.o.set(width, 0); Path path = this.l; Point point = this.m; path.moveTo((float) point.x, (float) point.y); Path path2 = this.l; Point point2 = this.n; path2.lineTo((float) point2.x, (float) point2.y); Path path3 = this.l; Point point3 = this.o; path3.lineTo((float) point3.x, (float) point3.y); Path path4 = this.l; Point point4 = this.m; path4.lineTo((float) point4.x, (float) point4.y); this.l.close(); canvas.drawPath(this.l, this.j); this.l.reset(); } }