128 lines
6.1 KiB
Java
128 lines
6.1 KiB
Java
package com.discord.views.premiumguild;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
import androidx.cardview.widget.CardView;
|
|
import androidx.core.content.ContextCompat;
|
|
import c.a.i.l2;
|
|
import com.discord.models.guild.Guild;
|
|
import com.discord.utilities.color.ColorCompatKt;
|
|
import com.discord.utilities.drawable.DrawableCompat;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.discord.utilities.premium.PremiumGuildSubscriptionUtils;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import com.google.android.material.chip.Chip;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: PremiumGuildConfirmationView.kt */
|
|
public final class PremiumGuildConfirmationView extends CardView {
|
|
public final l2 i;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public PremiumGuildConfirmationView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
LayoutInflater.from(getContext()).inflate(2131558784, this);
|
|
int i = 2131364348;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(2131364348);
|
|
if (simpleDraweeView != null) {
|
|
i = 2131364349;
|
|
TextView textView = (TextView) findViewById(2131364349);
|
|
if (textView != null) {
|
|
i = 2131364350;
|
|
Chip chip = (Chip) findViewById(2131364350);
|
|
if (chip != null) {
|
|
i = 2131364351;
|
|
Chip chip2 = (Chip) findViewById(2131364351);
|
|
if (chip2 != null) {
|
|
i = 2131364352;
|
|
ImageView imageView = (ImageView) findViewById(2131364352);
|
|
if (imageView != null) {
|
|
l2 l2Var = new l2(this, simpleDraweeView, textView, chip, chip2, imageView);
|
|
m.checkNotNullExpressionValue(l2Var, "ViewPremiumGuildConfirma…ater.from(context), this)");
|
|
this.i = l2Var;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i)));
|
|
}
|
|
|
|
public final void b(Guild guild, int i) {
|
|
m.checkNotNullParameter(guild, "guild");
|
|
int premiumGuildTier = PremiumGuildSubscriptionUtils.INSTANCE.getPremiumGuildTier(guild.getPremiumSubscriptionCount() + i);
|
|
boolean z2 = true;
|
|
char c2 = premiumGuildTier > guild.getPremiumTier() ? 1 : premiumGuildTier < guild.getPremiumTier() ? (char) 2 : 3;
|
|
SimpleDraweeView simpleDraweeView = this.i.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.premiumGuildConfirmationAvatar");
|
|
IconUtils.setIcon$default(simpleDraweeView, IconUtils.getForGuild$default(guild, null, false, null, 14, null), 0, (Function1) null, (MGImages.ChangeDetector) null, 28, (Object) null);
|
|
TextView textView = this.i.f121c;
|
|
m.checkNotNullExpressionValue(textView, "binding.premiumGuildConfirmationGuildName");
|
|
textView.setText(guild.getName());
|
|
Chip chip = this.i.d;
|
|
m.checkNotNullExpressionValue(chip, "binding.premiumGuildConfirmationLevelInfoPrevious");
|
|
chip.setChipIcon(ContextCompat.getDrawable(getContext(), c(guild.getPremiumTier())));
|
|
Chip chip2 = this.i.d;
|
|
m.checkNotNullExpressionValue(chip2, "binding.premiumGuildConfirmationLevelInfoPrevious");
|
|
chip2.setText(d(guild.getPremiumTier()));
|
|
ImageView imageView = this.i.f;
|
|
m.checkNotNullExpressionValue(imageView, "binding.premiumGuildConfirmationUpgradeArrow");
|
|
int i2 = 0;
|
|
imageView.setVisibility(c2 != 3 ? 0 : 8);
|
|
Chip chip3 = this.i.e;
|
|
m.checkNotNullExpressionValue(chip3, "binding.premiumGuildConfirmationLevelInfoUpgrade");
|
|
if (c2 == 3) {
|
|
z2 = false;
|
|
}
|
|
if (!z2) {
|
|
i2 = 8;
|
|
}
|
|
chip3.setVisibility(i2);
|
|
if (c2 != 3) {
|
|
int i3 = c2 == 2 ? 2131100324 : 2131100249;
|
|
ImageView imageView2 = this.i.f;
|
|
m.checkNotNullExpressionValue(imageView2, "binding.premiumGuildConfirmationUpgradeArrow");
|
|
ColorCompatKt.tintWithColorResource(imageView2, i3);
|
|
Chip chip4 = this.i.e;
|
|
m.checkNotNullExpressionValue(chip4, "binding.premiumGuildConfirmationLevelInfoUpgrade");
|
|
chip4.setChipIcon(ContextCompat.getDrawable(getContext(), c(premiumGuildTier)));
|
|
Chip chip5 = this.i.e;
|
|
m.checkNotNullExpressionValue(chip5, "binding.premiumGuildConfirmationLevelInfoUpgrade");
|
|
chip5.setText(d(premiumGuildTier));
|
|
}
|
|
}
|
|
|
|
public final int c(int i) {
|
|
if (i == 0) {
|
|
return 2131231693;
|
|
}
|
|
if (i == 1) {
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
return DrawableCompat.getThemedDrawableRes$default(context, 2130969340, 0, 2, (Object) null);
|
|
} else if (i == 2) {
|
|
Context context2 = getContext();
|
|
m.checkNotNullExpressionValue(context2, "context");
|
|
return DrawableCompat.getThemedDrawableRes$default(context2, 2130969341, 0, 2, (Object) null);
|
|
} else if (i != 3) {
|
|
return 0;
|
|
} else {
|
|
Context context3 = getContext();
|
|
m.checkNotNullExpressionValue(context3, "context");
|
|
return DrawableCompat.getThemedDrawableRes$default(context3, 2130969342, 0, 2, (Object) null);
|
|
}
|
|
}
|
|
|
|
public final String d(int i) {
|
|
String string = i != 0 ? i != 1 ? i != 2 ? i != 3 ? "" : getContext().getString(2131892316) : getContext().getString(2131892315) : getContext().getString(2131892314) : getContext().getString(2131892169);
|
|
m.checkNotNullExpressionValue(string, "when (premiumTier) {\n … else -> \"\"\n }");
|
|
return string;
|
|
}
|
|
}
|