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.s2; import c.a.k.b; import com.discord.api.premium.PremiumTier; import com.discord.i18n.RenderContext; import com.discord.models.domain.premium.SubscriptionPlanType; import com.discord.utilities.billing.PremiumUtilsKt; import com.discord.utilities.color.ColorCompat; import com.discord.utilities.view.extensions.ViewExtensions; import d0.z.d.m; import d0.z.d.o; import java.text.NumberFormat; import kotlin.Unit; import kotlin.jvm.functions.Function1; /* compiled from: PremiumGuildSubscriptionUpsellView.kt */ public final class PremiumGuildSubscriptionUpsellView extends FrameLayout { public final s2 i; /* compiled from: PremiumGuildSubscriptionUpsellView.kt */ public static final class a extends o implements Function1 { public final /* synthetic */ PremiumGuildSubscriptionUpsellView this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public a(PremiumGuildSubscriptionUpsellView premiumGuildSubscriptionUpsellView) { super(1); this.this$0 = premiumGuildSubscriptionUpsellView; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public Unit invoke(RenderContext renderContext) { RenderContext renderContext2 = renderContext; m.checkNotNullParameter(renderContext2, "$receiver"); renderContext2.e = Integer.valueOf(ColorCompat.getThemedColor(this.this$0.getContext(), 2130968988)); return Unit.a; } } /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public PremiumGuildSubscriptionUpsellView(Context context, AttributeSet attributeSet) { super(context, attributeSet, 0, 0); m.checkNotNullParameter(context, "context"); View inflate = LayoutInflater.from(context).inflate(2131558793, (ViewGroup) this, false); addView(inflate); int i = 2131365657; TextView textView = (TextView) inflate.findViewById(2131365657); if (textView != null) { i = 2131365658; TextView textView2 = (TextView) inflate.findViewById(2131365658); if (textView2 != null) { i = 2131365659; TextView textView3 = (TextView) inflate.findViewById(2131365659); if (textView3 != null) { s2 s2Var = new s2((LinearLayout) inflate, textView, textView2, textView3); m.checkNotNullExpressionValue(s2Var, "ViewPremiumUpsellInfoBin…rom(context), this, true)"); this.i = s2Var; return; } } } throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i))); } public final void a(PremiumTier premiumTier, boolean z2) { m.checkNotNullParameter(premiumTier, "userPremiumTier"); TextView textView = this.i.f155c; m.checkNotNullExpressionValue(textView, "binding.viewPremiumUpsellInfoSubheadingBlurb"); textView.setVisibility(z2 ? 0 : 8); SubscriptionPlanType subscriptionPlanType = SubscriptionPlanType.PREMIUM_GUILD_MONTH; int price = subscriptionPlanType.getPrice(); Context context = getContext(); m.checkNotNullExpressionValue(context, "context"); CharSequence i = b.i(this, 2131886949, new Object[]{PremiumUtilsKt.getFormattedPriceUsd(price, context)}, null, 4); Context context2 = getContext(); m.checkNotNullExpressionValue(context2, "context"); CharSequence i2 = b.i(this, 2131886949, new Object[]{PremiumUtilsKt.getFormattedPriceUsd((int) (((float) subscriptionPlanType.getPrice()) * 0.7f), context2)}, null, 4); CharSequence i3 = b.i(this, 2131889909, new Object[]{NumberFormat.getPercentInstance().format(Float.valueOf(0.3f))}, null, 4); Context context3 = getContext(); m.checkNotNullExpressionValue(context3, "context"); CharSequence a2 = b.a(context3, 2131889918, new Object[]{i2, i}, new a(this)); int ordinal = premiumTier.ordinal(); if (ordinal == 0 || ordinal == 1) { TextView textView2 = this.i.b; m.checkNotNullExpressionValue(textView2, "binding.viewPremiumUpsellInfoSubheading"); b.m(textView2, 2131889917, new Object[]{i}, null, 4); TextView textView3 = this.i.d; m.checkNotNullExpressionValue(textView3, "binding.viewPremiumUpsellInfoSubheadingPrice"); ViewExtensions.setTextAndVisibilityBy(textView3, null); } else if (ordinal == 2) { TextView textView4 = this.i.b; m.checkNotNullExpressionValue(textView4, "binding.viewPremiumUpsellInfoSubheading"); b.m(textView4, 2131889922, new Object[]{i3}, null, 4); TextView textView5 = this.i.d; m.checkNotNullExpressionValue(textView5, "binding.viewPremiumUpsellInfoSubheadingPrice"); ViewExtensions.setTextAndVisibilityBy(textView5, a2); } else if (ordinal == 3) { TextView textView6 = this.i.b; m.checkNotNullExpressionValue(textView6, "binding.viewPremiumUpsellInfoSubheading"); b.m(textView6, 2131889924, new Object[]{String.valueOf(2), i3}, null, 4); TextView textView7 = this.i.d; m.checkNotNullExpressionValue(textView7, "binding.viewPremiumUpsellInfoSubheadingPrice"); ViewExtensions.setTextAndVisibilityBy(textView7, a2); } } }