discord-jadx/app/src/main/java/com/discord/views/guildboost/GuildBoostProgressView.java

69 lines
3.3 KiB
Java
Raw Normal View History

2021-12-17 21:59:34 +00:00
package com.discord.views.guildboost;
2021-08-03 07:33:18 +00:00
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;
2021-12-17 21:59:34 +00:00
import b.a.i.t2;
import com.discord.R;
2021-08-03 07:33:18 +00:00
import com.discord.utilities.drawable.DrawableCompat;
2021-12-17 21:59:34 +00:00
import com.discord.utilities.premium.GuildBoostUtils;
2021-11-02 06:38:17 +00:00
import d0.z.d.m;
2021-12-17 21:59:34 +00:00
/* compiled from: GuildBoostProgressView.kt */
public final class GuildBoostProgressView extends FrameLayout {
2021-12-02 18:53:44 +00:00
public final t2 j;
2021-08-03 07:33:18 +00:00
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
2021-12-17 21:59:34 +00:00
public GuildBoostProgressView(Context context, AttributeSet attributeSet) {
2021-08-03 07:33:18 +00:00
super(context, attributeSet);
m.checkNotNullParameter(context, "context");
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.view_premium_guild_progress, (ViewGroup) this, false);
2021-08-03 07:33:18 +00:00
addView(inflate);
int i = R.id.progress_gem_icon;
ImageView imageView = (ImageView) inflate.findViewById(R.id.progress_gem_icon);
2021-08-03 07:33:18 +00:00
if (imageView != null) {
i = R.id.progress_level_text;
TextView textView = (TextView) inflate.findViewById(R.id.progress_level_text);
2021-08-03 07:33:18 +00:00
if (textView != null) {
i = R.id.progress_progress;
ProgressBar progressBar = (ProgressBar) inflate.findViewById(R.id.progress_progress);
2021-08-03 07:33:18 +00:00
if (progressBar != null) {
2021-11-20 07:11:29 +00:00
t2 t2Var = new t2((FrameLayout) inflate, imageView, textView, progressBar);
m.checkNotNullExpressionValue(t2Var, "ViewPremiumGuildProgress…rom(context), this, true)");
2021-12-02 18:53:44 +00:00
this.j = t2Var;
2021-08-03 07:33:18 +00:00
return;
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
2022-02-17 09:52:29 +00:00
public final void a(long j, int i, int i2) {
2022-01-27 07:52:47 +00:00
ImageView imageView = this.j.f201b;
2021-08-03 07:33:18 +00:00
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);
2021-08-03 07:33:18 +00:00
} else if (i == 1) {
i3 = R.drawable.ic_boosted_guild_tier_1;
2021-08-03 17:47:25 +00:00
} else if (i == 2) {
i3 = R.drawable.ic_boosted_guild_tier_2;
2021-08-03 17:47:25 +00:00
} else if (i == 3) {
i3 = R.drawable.ic_boosted_guild_tier_3;
2021-08-03 07:33:18 +00:00
}
imageView.setImageResource(i3);
2021-12-17 21:59:34 +00:00
TextView textView = this.j.c;
2021-08-03 07:33:18 +00:00
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));
2021-12-02 18:53:44 +00:00
ProgressBar progressBar = this.j.d;
2021-08-03 07:33:18 +00:00
m.checkNotNullExpressionValue(progressBar, "binding.progressProgress");
2022-02-17 09:52:29 +00:00
progressBar.setProgress(GuildBoostUtils.calculatePercentToNextTier$default(GuildBoostUtils.INSTANCE, j, i, i2, null, null, 24, null));
2021-08-03 07:33:18 +00:00
}
}