package com.discord.views.guildboost; import android.content.Context; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; import b.a.i.t2; import com.discord.R; import com.discord.utilities.drawable.DrawableCompat; import com.discord.utilities.premium.GuildBoostUtils; import d0.z.d.m; /* compiled from: GuildBoostProgressView.kt */ public final class GuildBoostProgressView extends FrameLayout { public final t2 j; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public GuildBoostProgressView(Context context, AttributeSet attributeSet) { super(context, attributeSet); m.checkNotNullParameter(context, "context"); View inflate = LayoutInflater.from(getContext()).inflate(R.layout.view_premium_guild_progress, (ViewGroup) this, false); addView(inflate); int i = R.id.progress_gem_icon; ImageView imageView = (ImageView) inflate.findViewById(R.id.progress_gem_icon); if (imageView != null) { i = R.id.progress_level_text; TextView textView = (TextView) inflate.findViewById(R.id.progress_level_text); if (textView != null) { i = R.id.progress_progress; ProgressBar progressBar = (ProgressBar) inflate.findViewById(R.id.progress_progress); if (progressBar != null) { t2 t2Var = new t2((FrameLayout) inflate, imageView, textView, progressBar); m.checkNotNullExpressionValue(t2Var, "ViewPremiumGuildProgress…rom(context), this, true)"); this.j = t2Var; return; } } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i))); } public final void a(long j, int i, int i2) { ImageView imageView = this.j.f201b; int i3 = 0; if (i == 0) { Context context = getContext(); m.checkNotNullExpressionValue(context, "context"); i3 = DrawableCompat.getThemedDrawableRes$default(context, (int) R.attr.boosted_guild_tier_0, 0, 2, (Object) null); } else if (i == 1) { i3 = R.drawable.ic_boosted_guild_tier_1; } else if (i == 2) { i3 = R.drawable.ic_boosted_guild_tier_2; } else if (i == 3) { i3 = R.drawable.ic_boosted_guild_tier_3; } imageView.setImageResource(i3); TextView textView = this.j.c; m.checkNotNullExpressionValue(textView, "binding.progressLevelText"); textView.setText(i != 0 ? i != 1 ? i != 2 ? i != 3 ? "" : getContext().getString(R.string.premium_guild_tier_3) : getContext().getString(R.string.premium_guild_tier_2) : getContext().getString(R.string.premium_guild_tier_1) : getContext().getString(R.string.premium_guild_header_badge_no_tier)); ProgressBar progressBar = this.j.d; m.checkNotNullExpressionValue(progressBar, "binding.progressProgress"); progressBar.setProgress(GuildBoostUtils.calculatePercentToNextTier$default(GuildBoostUtils.INSTANCE, j, i, i2, null, null, 24, null)); } }