package com.discord.views; import android.content.Context; import android.graphics.drawable.Drawable; import android.os.Build; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import androidx.annotation.DrawableRes; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.core.content.ContextCompat; import c.a.i.u3; import c.d.b.a.a; import com.discord.utilities.drawable.DrawableCompat; import com.discord.utilities.view.extensions.ViewExtensions; import d0.z.d.m; /* compiled from: UploadProgressView.kt */ public final class UploadProgressView extends ConstraintLayout { public static final /* synthetic */ int i = 0; public final u3 j; public final Drawable k; public final Drawable l; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public UploadProgressView(Context context, AttributeSet attributeSet) { super(context, attributeSet); m.checkNotNullParameter(context, "context"); View inflate = LayoutInflater.from(getContext()).inflate(2131558833, (ViewGroup) this, false); addView(inflate); int i2 = 2131364475; ProgressBar progressBar = (ProgressBar) inflate.findViewById(2131364475); if (progressBar != null) { i2 = 2131364479; ImageView imageView = (ImageView) inflate.findViewById(2131364479); if (imageView != null) { i2 = 2131364484; TextView textView = (TextView) inflate.findViewById(2131364484); if (textView != null) { i2 = 2131364485; TextView textView2 = (TextView) inflate.findViewById(2131364485); if (textView2 != null) { u3 u3Var = new u3((ConstraintLayout) inflate, progressBar, imageView, textView, textView2); m.checkNotNullExpressionValue(u3Var, "ViewUploadProgressBindin…rom(context), this, true)"); this.j = u3Var; this.k = ContextCompat.getDrawable(getContext(), 2131231194); this.l = ContextCompat.getDrawable(getContext(), DrawableCompat.getThemedDrawableRes$default(this, 2130969917, 0, 2, (Object) null)); return; } } } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i2))); } public final void a(CharSequence charSequence, int i2, String str) { m.checkNotNullParameter(charSequence, "title"); u3 u3Var = this.j; TextView textView = u3Var.e; m.checkNotNullExpressionValue(textView, "progressText"); textView.setText(charSequence); boolean z2 = true; if (i2 >= 0) { ProgressBar progressBar = u3Var.b; m.checkNotNullExpressionValue(progressBar, "progressBar"); progressBar.setIndeterminate(false); if (Build.VERSION.SDK_INT >= 24) { ProgressBar progressBar2 = u3Var.b; m.checkNotNullExpressionValue(progressBar2, "progressBar"); if (i2 < progressBar2.getProgress()) { z2 = false; } u3Var.b.setProgress(i2, z2); } else { ProgressBar progressBar3 = u3Var.b; m.checkNotNullExpressionValue(progressBar3, "progressBar"); progressBar3.setProgress(i2); } ProgressBar progressBar4 = u3Var.b; m.checkNotNullExpressionValue(progressBar4, "progressBar"); progressBar4.setProgressDrawable(i2 == 100 ? this.k : this.l); ProgressBar progressBar5 = u3Var.b; m.checkNotNullExpressionValue(progressBar5, "progressBar"); progressBar5.setVisibility(0); } else if (i2 == -1) { ProgressBar progressBar6 = u3Var.b; m.checkNotNullExpressionValue(progressBar6, "progressBar"); progressBar6.setVisibility(0); ProgressBar progressBar7 = u3Var.b; m.checkNotNullExpressionValue(progressBar7, "progressBar"); progressBar7.setIndeterminate(true); } else if (i2 == -2) { ProgressBar progressBar8 = u3Var.b; m.checkNotNullExpressionValue(progressBar8, "progressBar"); progressBar8.setVisibility(4); } else { throw new IllegalArgumentException(a.j("invalid argument supplied to progress: ", i2)); } TextView textView2 = u3Var.d; m.checkNotNullExpressionValue(textView2, "progressSubtext"); ViewExtensions.setTextAndVisibilityBy(textView2, str); } public final void setIcon(@DrawableRes int i2) { this.j.f169c.setImageResource(i2); } }