216 lines
11 KiB
Java
216 lines
11 KiB
Java
package com.discord.widgets.auth;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
import c.a.k.b;
|
|
import c.d.b.a.a;
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
import com.discord.api.channel.Channel;
|
|
import com.discord.api.guild.Guild;
|
|
import com.discord.api.user.User;
|
|
import com.discord.databinding.ViewAuthInviteInfoBinding;
|
|
import com.discord.models.domain.ModelGuildTemplate;
|
|
import com.discord.models.domain.ModelInvite;
|
|
import com.discord.models.user.CoreUser;
|
|
import com.discord.nullserializable.NullSerializable;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.images.MGImages;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import d0.g0.t;
|
|
import d0.z.d.m;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: AuthInviteInfoView.kt */
|
|
public final class AuthInviteInfoView extends RelativeLayout {
|
|
private final ViewAuthInviteInfoBinding binding;
|
|
|
|
public AuthInviteInfoView(Context context) {
|
|
this(context, null, 0, 6, null);
|
|
}
|
|
|
|
public AuthInviteInfoView(Context context, AttributeSet attributeSet) {
|
|
this(context, attributeSet, 0, 4, null);
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AuthInviteInfoView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
m.checkNotNullParameter(context, "context");
|
|
View inflate = LayoutInflater.from(context).inflate(2131558730, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
int i2 = 2131362022;
|
|
LinearLayout linearLayout = (LinearLayout) inflate.findViewById(2131362022);
|
|
if (linearLayout != null) {
|
|
i2 = 2131362023;
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate.findViewById(2131362023);
|
|
if (simpleDraweeView != null) {
|
|
i2 = 2131362024;
|
|
TextView textView = (TextView) inflate.findViewById(2131362024);
|
|
if (textView != null) {
|
|
i2 = 2131362025;
|
|
TextView textView2 = (TextView) inflate.findViewById(2131362025);
|
|
if (textView2 != null) {
|
|
i2 = 2131362026;
|
|
ImageView imageView = (ImageView) inflate.findViewById(2131362026);
|
|
if (imageView != null) {
|
|
ViewAuthInviteInfoBinding viewAuthInviteInfoBinding = new ViewAuthInviteInfoBinding((RelativeLayout) inflate, linearLayout, simpleDraweeView, textView, textView2, imageView);
|
|
m.checkNotNullExpressionValue(viewAuthInviteInfoBinding, "ViewAuthInviteInfoBindin…rom(context), this, true)");
|
|
this.binding = viewAuthInviteInfoBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i2)));
|
|
}
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
public /* synthetic */ AuthInviteInfoView(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x007e: APUT (r2v4 java.lang.Object[]), (0 ??[int, short, byte, char]), (r11v9 java.lang.String) */
|
|
private final CharSequence getIntroText(ModelInvite modelInvite) {
|
|
User inviter = modelInvite.getInviter();
|
|
String r = inviter != null ? inviter.r() : null;
|
|
boolean z2 = r != null && (t.isBlank(r) ^ true);
|
|
if (modelInvite.getChannel() == null && modelInvite.getGuild() == null && z2) {
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
return b.g(context, 2131890528, new Object[0], null, 4);
|
|
}
|
|
Channel channel = modelInvite.getChannel();
|
|
m.checkNotNullExpressionValue(channel, "channel");
|
|
if (AnimatableValueParser.r1(channel)) {
|
|
Channel channel2 = modelInvite.getChannel();
|
|
m.checkNotNullExpressionValue(channel2, "channel");
|
|
if ((AnimatableValueParser.y0(channel2).length() == 0) || !z2) {
|
|
Context context2 = getContext();
|
|
m.checkNotNullExpressionValue(context2, "context");
|
|
return b.g(context2, 2131890531, new Object[0], null, 4);
|
|
}
|
|
Context context3 = getContext();
|
|
m.checkNotNullExpressionValue(context3, "context");
|
|
Object[] objArr = new Object[1];
|
|
User inviter2 = modelInvite.getInviter();
|
|
objArr[0] = inviter2 != null ? inviter2.r() : null;
|
|
return b.g(context3, 2131886765, objArr, null, 4);
|
|
} else if (modelInvite.getApproximateMemberCount() >= 200 || !z2) {
|
|
Context context4 = getContext();
|
|
m.checkNotNullExpressionValue(context4, "context");
|
|
return b.g(context4, 2131890529, new Object[0], null, 4);
|
|
} else {
|
|
Context context5 = getContext();
|
|
m.checkNotNullExpressionValue(context5, "context");
|
|
return b.g(context5, 2131886765, new Object[]{r}, null, 4);
|
|
}
|
|
}
|
|
|
|
public final void configureGuildTemplate(ModelGuildTemplate modelGuildTemplate) {
|
|
m.checkNotNullParameter(modelGuildTemplate, "guildTemplate");
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.authInviteInfoGuildAvatar");
|
|
simpleDraweeView.setVisibility(8);
|
|
ImageView imageView = this.binding.e;
|
|
m.checkNotNullExpressionValue(imageView, "binding.authInviteInfoTemplateIcon");
|
|
imageView.setVisibility(0);
|
|
TextView textView = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.authInviteInfoInvitedText");
|
|
b.m(textView, 2131890099, new Object[0], null, 4);
|
|
TextView textView2 = this.binding.f1647c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.authInviteInfoGuildName");
|
|
textView2.setText(modelGuildTemplate.getName());
|
|
}
|
|
|
|
public final void configureInvite(ModelInvite modelInvite) {
|
|
String str;
|
|
String f;
|
|
NullSerializable<String> a;
|
|
String r;
|
|
m.checkNotNullParameter(modelInvite, "invite");
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.authInviteInfoGuildAvatar");
|
|
boolean z2 = false;
|
|
simpleDraweeView.setVisibility(0);
|
|
ImageView imageView = this.binding.e;
|
|
m.checkNotNullExpressionValue(imageView, "binding.authInviteInfoTemplateIcon");
|
|
imageView.setVisibility(8);
|
|
Channel channel = modelInvite.getChannel();
|
|
Integer valueOf = channel != null ? Integer.valueOf(channel.A()) : null;
|
|
if ((valueOf != null && valueOf.intValue() == 5) || ((valueOf != null && valueOf.intValue() == 0) || ((valueOf != null && valueOf.intValue() == 2) || (valueOf != null && valueOf.intValue() == 13)))) {
|
|
Guild guild = modelInvite.getGuild();
|
|
if (guild != null) {
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.authInviteInfoGuildAvatar");
|
|
m.checkNotNullExpressionValue(guild, "inviteGuild");
|
|
IconUtils.setIcon$default(simpleDraweeView2, IconUtils.getForGuild$default(new com.discord.models.guild.Guild(guild), "asset://asset/images/default_icon_selected.jpg", true, null, 8, null), 2131165289, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
|
TextView textView = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView, "binding.authInviteInfoInvitedText");
|
|
textView.setText(b.k(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView2 = this.binding.f1647c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.authInviteInfoGuildName");
|
|
textView2.setText(guild.u());
|
|
return;
|
|
}
|
|
return;
|
|
}
|
|
String str2 = "";
|
|
if (valueOf != null && valueOf.intValue() == 3) {
|
|
User inviter = modelInvite.getInviter();
|
|
if (!(inviter == null || (r = inviter.r()) == null)) {
|
|
str2 = r;
|
|
}
|
|
SimpleDraweeView simpleDraweeView3 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.authInviteInfoGuildAvatar");
|
|
User inviter2 = modelInvite.getInviter();
|
|
IconUtils.setIcon$default(simpleDraweeView3, (inviter2 == null || (a = inviter2.a()) == null) ? null : a.a(), 2131165289, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
|
TextView textView3 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView3, "binding.authInviteInfoInvitedText");
|
|
textView3.setText(b.k(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView4 = this.binding.f1647c;
|
|
m.checkNotNullExpressionValue(textView4, "binding.authInviteInfoGuildName");
|
|
Channel channel2 = modelInvite.getChannel();
|
|
m.checkNotNullExpressionValue(channel2, "invite.channel");
|
|
if (AnimatableValueParser.y0(channel2).length() > 0) {
|
|
z2 = true;
|
|
}
|
|
if (z2) {
|
|
Channel channel3 = modelInvite.getChannel();
|
|
m.checkNotNullExpressionValue(channel3, "invite.channel");
|
|
str2 = AnimatableValueParser.y0(channel3);
|
|
}
|
|
textView4.setText(str2);
|
|
} else if (valueOf == null) {
|
|
User inviter3 = modelInvite.getInviter();
|
|
if (inviter3 == null || (str = inviter3.r()) == null) {
|
|
str = str2;
|
|
}
|
|
StringBuilder O = a.O(str, "#");
|
|
User inviter4 = modelInvite.getInviter();
|
|
if (!(inviter4 == null || (f = inviter4.f()) == null)) {
|
|
str2 = f;
|
|
}
|
|
O.append(str2);
|
|
String sb = O.toString();
|
|
SimpleDraweeView simpleDraweeView4 = this.binding.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView4, "binding.authInviteInfoGuildAvatar");
|
|
User inviter5 = modelInvite.getInviter();
|
|
IconUtils.setIcon$default(simpleDraweeView4, inviter5 != null ? new CoreUser(inviter5) : null, 2131165289, null, null, null, 56, null);
|
|
TextView textView5 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView5, "binding.authInviteInfoInvitedText");
|
|
textView5.setText(b.k(getIntroText(modelInvite), new Object[0], null, 2));
|
|
TextView textView6 = this.binding.f1647c;
|
|
m.checkNotNullExpressionValue(textView6, "binding.authInviteInfoGuildName");
|
|
textView6.setText(sb);
|
|
}
|
|
}
|
|
}
|