discord-jadx/app/src/main/java/com/discord/views/premiumguild/PremiumSubscriptionMarketin...

154 lines
7.9 KiB
Java

package com.discord.views.premiumguild;
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.LinearLayout;
import android.widget.TextView;
import c.a.i.o2;
import c.a.k.b;
import com.discord.api.premium.PremiumTier;
import com.discord.utilities.KotlinExtensionsKt;
import com.discord.utilities.resources.StringResourceUtilsKt;
import com.discord.utilities.view.extensions.ViewExtensions;
import com.google.android.material.button.MaterialButton;
import d0.z.d.m;
import java.text.NumberFormat;
import kotlin.NoWhenBranchMatchedException;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: PremiumSubscriptionMarketingView.kt */
public final class PremiumSubscriptionMarketingView extends FrameLayout {
public final o2 i;
/* compiled from: PremiumSubscriptionMarketingView.kt */
public static final class a implements View.OnClickListener {
public final /* synthetic */ Function0 i;
public a(Function0 function0) {
this.i = function0;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
this.i.mo1invoke();
}
}
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public PremiumSubscriptionMarketingView(Context context, AttributeSet attributeSet) {
super(context, attributeSet, 0, 0);
m.checkNotNullParameter(context, "context");
View inflate = LayoutInflater.from(context).inflate(2131558789, (ViewGroup) this, false);
addView(inflate);
int i = 2131365648;
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131365648);
if (linearLayout != null) {
i = 2131365649;
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131365649);
if (materialButton != null) {
LinearLayout linearLayout2 = (LinearLayout) inflate;
i = 2131365651;
TextView textView = (TextView) inflate.findViewById(2131365651);
if (textView != null) {
i = 2131365652;
TextView textView2 = (TextView) inflate.findViewById(2131365652);
if (textView2 != null) {
i = 2131365653;
TextView textView3 = (TextView) inflate.findViewById(2131365653);
if (textView3 != null) {
i = 2131365654;
TextView textView4 = (TextView) inflate.findViewById(2131365654);
if (textView4 != null) {
i = 2131365655;
TextView textView5 = (TextView) inflate.findViewById(2131365655);
if (textView5 != null) {
i = 2131365656;
TextView textView6 = (TextView) inflate.findViewById(2131365656);
if (textView6 != null) {
o2 o2Var = new o2(linearLayout2, linearLayout, materialButton, linearLayout2, textView, textView2, textView3, textView4, textView5, textView6);
m.checkNotNullExpressionValue(o2Var, "ViewPremiumMarketingBind…rom(context), this, true)");
this.i = o2Var;
return;
}
}
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
public final void a(PremiumTier premiumTier, Function0<Unit> function0) {
Unit unit;
m.checkNotNullParameter(premiumTier, "userPremiumTier");
m.checkNotNullParameter(function0, "onlearnMoreClickCallback");
Context context = getContext();
m.checkNotNullExpressionValue(context, "context");
CharSequence i18nPluralString = StringResourceUtilsKt.getI18nPluralString(context, 2131755168, 2, 2);
TextView textView = this.i.h;
m.checkNotNullExpressionValue(textView, "binding.viewPremiumMarketingNitroBoostDiscount");
NumberFormat percentInstance = NumberFormat.getPercentInstance();
Float valueOf = Float.valueOf(0.3f);
b.m(textView, 2131889909, new Object[]{percentInstance.format(valueOf)}, null, 4);
TextView textView2 = this.i.g;
m.checkNotNullExpressionValue(textView2, "binding.viewPremiumMarketingNitroBoostCount");
b.m(textView2, 2131889911, new Object[]{i18nPluralString}, null, 4);
TextView textView3 = this.i.j;
m.checkNotNullExpressionValue(textView3, "binding.viewPremiumMarke…NitroClassicBoostDiscount");
b.m(textView3, 2131889909, new Object[]{NumberFormat.getPercentInstance().format(valueOf)}, null, 4);
TextView textView4 = this.i.i;
m.checkNotNullExpressionValue(textView4, "binding.viewPremiumMarketingNitroClassicBoostCount");
b.m(textView4, 2131889910, new Object[]{i18nPluralString}, null, 4);
this.i.f134c.setOnClickListener(new a(function0));
int ordinal = premiumTier.ordinal();
if (ordinal == 0) {
TextView textView5 = this.i.e;
m.checkNotNullExpressionValue(textView5, "binding.viewPremiumMarketingMarketingSubtitle");
textView5.setVisibility(8);
unit = Unit.a;
} else if (ordinal == 1) {
LinearLayout linearLayout = this.i.d;
m.checkNotNullExpressionValue(linearLayout, "binding.viewPremiumMarketingMarketingContainer");
linearLayout.setVisibility(0);
LinearLayout linearLayout2 = this.i.b;
m.checkNotNullExpressionValue(linearLayout2, "binding.viewPremiumMarketingContainerTier1");
linearLayout2.setVisibility(0);
TextView textView6 = this.i.f;
m.checkNotNullExpressionValue(textView6, "binding.viewPremiumMarketingMarketingTitle");
ViewExtensions.setTextAndVisibilityBy(textView6, b.i(this, 2131889913, new Object[0], null, 4));
TextView textView7 = this.i.e;
m.checkNotNullExpressionValue(textView7, "binding.viewPremiumMarketingMarketingSubtitle");
textView7.setVisibility(8);
unit = Unit.a;
} else if (ordinal == 2) {
LinearLayout linearLayout3 = this.i.d;
m.checkNotNullExpressionValue(linearLayout3, "binding.viewPremiumMarketingMarketingContainer");
linearLayout3.setVisibility(0);
LinearLayout linearLayout4 = this.i.b;
m.checkNotNullExpressionValue(linearLayout4, "binding.viewPremiumMarketingContainerTier1");
linearLayout4.setVisibility(8);
TextView textView8 = this.i.f;
m.checkNotNullExpressionValue(textView8, "binding.viewPremiumMarketingMarketingTitle");
ViewExtensions.setTextAndVisibilityBy(textView8, b.i(this, 2131889914, new Object[0], null, 4));
TextView textView9 = this.i.e;
m.checkNotNullExpressionValue(textView9, "binding.viewPremiumMarketingMarketingSubtitle");
ViewExtensions.setTextAndVisibilityBy(textView9, b.i(this, 2131889915, new Object[]{String.valueOf(2)}, null, 4));
unit = Unit.a;
} else if (ordinal == 3) {
LinearLayout linearLayout5 = this.i.d;
m.checkNotNullExpressionValue(linearLayout5, "binding.viewPremiumMarketingMarketingContainer");
linearLayout5.setVisibility(8);
unit = Unit.a;
} else {
throw new NoWhenBranchMatchedException();
}
KotlinExtensionsKt.getExhaustive(unit);
}
}