116 lines
5.9 KiB
Java
116 lines
5.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.r2;
|
||
|
import c.a.l.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 r2 i;
|
||
|
|
||
|
/* compiled from: PremiumGuildSubscriptionUpsellView.kt */
|
||
|
public static final class a extends o implements Function1<RenderContext, Unit> {
|
||
|
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(2131558786, (ViewGroup) this, false);
|
||
|
addView(inflate);
|
||
|
int i = 2131365501;
|
||
|
TextView textView = (TextView) inflate.findViewById(2131365501);
|
||
|
if (textView != null) {
|
||
|
i = 2131365502;
|
||
|
TextView textView2 = (TextView) inflate.findViewById(2131365502);
|
||
|
if (textView2 != null) {
|
||
|
i = 2131365503;
|
||
|
TextView textView3 = (TextView) inflate.findViewById(2131365503);
|
||
|
if (textView3 != null) {
|
||
|
r2 r2Var = new r2((LinearLayout) inflate, textView, textView2, textView3);
|
||
|
m.checkNotNullExpressionValue(r2Var, "ViewPremiumUpsellInfoBin…rom(context), this, true)");
|
||
|
this.i = r2Var;
|
||
|
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.f147c;
|
||
|
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, 2131886947, new Object[]{PremiumUtilsKt.getFormattedPriceUsd(price, context)}, null, 4);
|
||
|
Context context2 = getContext();
|
||
|
m.checkNotNullExpressionValue(context2, "context");
|
||
|
CharSequence i2 = b.i(this, 2131886947, new Object[]{PremiumUtilsKt.getFormattedPriceUsd((int) (((float) subscriptionPlanType.getPrice()) * 0.7f), context2)}, null, 4);
|
||
|
CharSequence i3 = b.i(this, 2131889821, new Object[]{NumberFormat.getPercentInstance().format(Float.valueOf(0.3f))}, null, 4);
|
||
|
Context context3 = getContext();
|
||
|
m.checkNotNullExpressionValue(context3, "context");
|
||
|
CharSequence a2 = b.a(context3, 2131889830, new Object[]{i2, i}, new a(this));
|
||
|
int ordinal = premiumTier.ordinal();
|
||
|
if (ordinal == 1) {
|
||
|
TextView textView2 = this.i.b;
|
||
|
m.checkNotNullExpressionValue(textView2, "binding.viewPremiumUpsellInfoSubheading");
|
||
|
b.n(textView2, 2131889829, 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.n(textView4, 2131889834, 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.n(textView6, 2131889836, new Object[]{String.valueOf(2), i3}, null, 4);
|
||
|
TextView textView7 = this.i.d;
|
||
|
m.checkNotNullExpressionValue(textView7, "binding.viewPremiumUpsellInfoSubheadingPrice");
|
||
|
ViewExtensions.setTextAndVisibilityBy(textView7, a2);
|
||
|
}
|
||
|
}
|
||
|
}
|