2021-08-03 07:33:18 +00:00
|
|
|
package com.discord.widgets.guilds.invite;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.res.Resources;
|
|
|
|
import android.content.res.TypedArray;
|
|
|
|
import android.util.AttributeSet;
|
|
|
|
import android.view.LayoutInflater;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.LinearLayout;
|
|
|
|
import android.widget.RelativeLayout;
|
|
|
|
import android.widget.TextView;
|
|
|
|
import androidx.appcompat.widget.LinearLayoutCompat;
|
|
|
|
import androidx.cardview.widget.CardView;
|
2021-08-11 06:37:47 +00:00
|
|
|
import c.a.k.b;
|
2021-08-03 07:33:18 +00:00
|
|
|
import c.d.b.a.a;
|
|
|
|
import com.airbnb.lottie.parser.AnimatableValueParser;
|
|
|
|
import com.discord.R;
|
|
|
|
import com.discord.api.channel.Channel;
|
|
|
|
import com.discord.api.guild.Guild;
|
|
|
|
import com.discord.api.guild.GuildFeature;
|
|
|
|
import com.discord.api.user.User;
|
|
|
|
import com.discord.databinding.WidgetGuildInviteInfoBinding;
|
|
|
|
import com.discord.models.domain.ModelInvite;
|
|
|
|
import com.discord.models.user.CoreUser;
|
2021-08-18 06:27:30 +00:00
|
|
|
import com.discord.models.user.MeUser;
|
|
|
|
import com.discord.stores.StoreStream;
|
2021-08-03 07:33:18 +00:00
|
|
|
import com.discord.utilities.error.Error;
|
|
|
|
import com.discord.utilities.icon.IconUtils;
|
|
|
|
import com.discord.utilities.images.MGImages;
|
|
|
|
import com.discord.utilities.resources.StringResourceUtilsKt;
|
|
|
|
import com.discord.utilities.string.StringUtilsKt;
|
|
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.List;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: WidgetInviteInfo.kt */
|
|
|
|
public final class WidgetInviteInfo extends LinearLayoutCompat {
|
|
|
|
private final WidgetGuildInviteInfoBinding binding;
|
|
|
|
|
|
|
|
public WidgetInviteInfo(Context context) {
|
|
|
|
this(context, null, 0, 6, null);
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetInviteInfo(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 WidgetInviteInfo(Context context, AttributeSet attributeSet, int i) {
|
|
|
|
super(context, attributeSet, i);
|
|
|
|
m.checkNotNullParameter(context, "ctx");
|
2021-08-09 22:51:56 +00:00
|
|
|
LayoutInflater.from(getContext()).inflate(R.layout.widget_guild_invite_info, this);
|
|
|
|
int i2 = R.id.invite_avatar;
|
|
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) findViewById(R.id.invite_avatar);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (simpleDraweeView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_avatar_small;
|
|
|
|
SimpleDraweeView simpleDraweeView2 = (SimpleDraweeView) findViewById(R.id.invite_avatar_small);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (simpleDraweeView2 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_avatar_small_card;
|
|
|
|
CardView cardView = (CardView) findViewById(R.id.invite_avatar_small_card);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (cardView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_avatar_small_wrap;
|
|
|
|
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.invite_avatar_small_wrap);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (relativeLayout != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_avatar_wrap;
|
|
|
|
RelativeLayout relativeLayout2 = (RelativeLayout) findViewById(R.id.invite_avatar_wrap);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (relativeLayout2 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_expired_image;
|
|
|
|
ImageView imageView = (ImageView) findViewById(R.id.invite_expired_image);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (imageView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_members_online;
|
|
|
|
TextView textView = (TextView) findViewById(R.id.invite_members_online);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_members_online_wrap;
|
|
|
|
CardView cardView2 = (CardView) findViewById(R.id.invite_members_online_wrap);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (cardView2 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_members_total;
|
|
|
|
TextView textView2 = (TextView) findViewById(R.id.invite_members_total);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView2 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_members_total_wrap;
|
|
|
|
CardView cardView3 = (CardView) findViewById(R.id.invite_members_total_wrap);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (cardView3 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_members_wrap;
|
|
|
|
LinearLayout linearLayout = (LinearLayout) findViewById(R.id.invite_members_wrap);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (linearLayout != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_message;
|
|
|
|
TextView textView3 = (TextView) findViewById(R.id.invite_message);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView3 != null) {
|
2021-08-09 22:51:56 +00:00
|
|
|
i2 = R.id.invite_title;
|
|
|
|
TextView textView4 = (TextView) findViewById(R.id.invite_title);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (textView4 != null) {
|
|
|
|
WidgetGuildInviteInfoBinding widgetGuildInviteInfoBinding = new WidgetGuildInviteInfoBinding(this, simpleDraweeView, simpleDraweeView2, cardView, relativeLayout, relativeLayout2, imageView, textView, cardView2, textView2, cardView3, linearLayout, textView3, textView4);
|
|
|
|
m.checkNotNullExpressionValue(widgetGuildInviteInfoBinding, "WidgetGuildInviteInfoBin…ater.from(context), this)");
|
|
|
|
this.binding = widgetGuildInviteInfoBinding;
|
|
|
|
Context context2 = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context2, "context");
|
|
|
|
parseAttributeSet(context2, attributeSet, i);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
throw new NullPointerException("Missing required view with ID: ".concat(getResources().getResourceName(i2)));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX INFO: this call moved to the top of the method (can break code semantics) */
|
|
|
|
public /* synthetic */ WidgetInviteInfo(Context context, AttributeSet attributeSet, int i, int i2, DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this(context, (i2 & 2) != 0 ? null : attributeSet, (i2 & 4) != 0 ? 0 : i);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ WidgetGuildInviteInfoBinding access$getBinding$p(WidgetInviteInfo widgetInviteInfo) {
|
|
|
|
return widgetInviteInfo.binding;
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureForDirectFriend(ModelInvite modelInvite) {
|
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.inviteAvatar");
|
|
|
|
User inviter = modelInvite.getInviter();
|
|
|
|
String str = null;
|
2021-08-09 22:51:56 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView, inviter != null ? new CoreUser(inviter) : null, R.dimen.avatar_size_hero, null, null, null, 56, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
User inviter2 = modelInvite.getInviter();
|
|
|
|
String r = inviter2 != null ? inviter2.r() : null;
|
|
|
|
String str2 = "";
|
|
|
|
if (r == null) {
|
|
|
|
r = str2;
|
|
|
|
}
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
User inviter3 = modelInvite.getInviter();
|
|
|
|
String r2 = inviter3 != null ? inviter3.r() : null;
|
|
|
|
if (r2 == null) {
|
|
|
|
r2 = str2;
|
|
|
|
}
|
|
|
|
sb.append(r2);
|
|
|
|
sb.append("#");
|
|
|
|
User inviter4 = modelInvite.getInviter();
|
|
|
|
if (inviter4 != null) {
|
|
|
|
str = inviter4.f();
|
|
|
|
}
|
|
|
|
if (str != null) {
|
|
|
|
str2 = str;
|
|
|
|
}
|
|
|
|
sb.append(str2);
|
|
|
|
String sb2 = sb.toString();
|
2021-08-17 07:10:14 +00:00
|
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.f1820c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.inviteAvatarSmall");
|
|
|
|
simpleDraweeView2.setVisibility(8);
|
|
|
|
RelativeLayout relativeLayout = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.inviteAvatarSmallWrap");
|
|
|
|
relativeLayout.setVisibility(8);
|
|
|
|
CardView cardView = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(cardView, "binding.inviteAvatarSmallCard");
|
|
|
|
cardView.setVisibility(8);
|
|
|
|
CardView cardView2 = this.binding.k;
|
|
|
|
m.checkNotNullExpressionValue(cardView2, "binding.inviteMembersTotalWrap");
|
|
|
|
cardView2.setVisibility(8);
|
|
|
|
CardView cardView3 = this.binding.i;
|
|
|
|
m.checkNotNullExpressionValue(cardView3, "binding.inviteMembersOnlineWrap");
|
|
|
|
cardView3.setVisibility(8);
|
|
|
|
TextView textView = this.binding.n;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.inviteTitle");
|
|
|
|
textView.setText(getInviteTitleForDirectFriend(r));
|
|
|
|
this.binding.n.setTextSize(2, 26.0f);
|
|
|
|
TextView textView2 = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.inviteMessage");
|
|
|
|
textView2.setText(getInviteSubtitleForDirectFriend(sb2));
|
|
|
|
this.binding.m.setTextSize(2, 18.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:24:0x0069, code lost:
|
|
|
|
if ((r5.length() > 0) == true) goto L_0x006d;
|
|
|
|
*/
|
|
|
|
private final void configureForGDM(ModelInvite modelInvite) {
|
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.inviteAvatar");
|
|
|
|
User inviter = modelInvite.getInviter();
|
|
|
|
String str = null;
|
2021-08-09 22:51:56 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView, inviter != null ? new CoreUser(inviter) : null, R.dimen.avatar_size_hero, null, null, null, 56, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
Channel channel = modelInvite.getChannel();
|
|
|
|
User inviter2 = modelInvite.getInviter();
|
|
|
|
if (inviter2 != null) {
|
|
|
|
str = inviter2.r();
|
|
|
|
}
|
|
|
|
if (str == null) {
|
|
|
|
str = "";
|
|
|
|
}
|
|
|
|
m.checkNotNullExpressionValue(channel, "channel");
|
|
|
|
boolean z2 = true;
|
|
|
|
int i = 0;
|
|
|
|
String y0 = AnimatableValueParser.y0(channel).length() > 0 ? AnimatableValueParser.y0(channel) : str;
|
|
|
|
if (AnimatableValueParser.r1(channel) && (r5 = channel.g()) != null) {
|
|
|
|
}
|
|
|
|
z2 = false;
|
|
|
|
if (z2) {
|
2021-08-17 07:10:14 +00:00
|
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.f1820c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.inviteAvatarSmall");
|
2021-08-09 22:51:56 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView2, channel, R.dimen.avatar_size_medium, null, 8, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
RelativeLayout relativeLayout = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.inviteAvatarSmallWrap");
|
|
|
|
if (!z2) {
|
|
|
|
i = 8;
|
|
|
|
}
|
|
|
|
relativeLayout.setVisibility(i);
|
|
|
|
TextView textView = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.inviteMessage");
|
|
|
|
textView.setText(getFormattedGuildName(y0));
|
|
|
|
TextView textView2 = this.binding.n;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.inviteTitle");
|
|
|
|
textView2.setText(getIntroTextForGroup(str, AnimatableValueParser.y0(channel)));
|
|
|
|
CardView cardView = this.binding.i;
|
|
|
|
m.checkNotNullExpressionValue(cardView, "binding.inviteMembersOnlineWrap");
|
|
|
|
cardView.setVisibility(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void configureForGuild(ModelInvite modelInvite) {
|
|
|
|
List<GuildFeature> l;
|
|
|
|
List<GuildFeature> l2;
|
|
|
|
int i = 0;
|
|
|
|
boolean z2 = modelInvite.getInviter() != null && modelInvite.getApproximateMemberCount() < 200;
|
|
|
|
String str = null;
|
|
|
|
if (z2) {
|
|
|
|
SimpleDraweeView simpleDraweeView = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.inviteAvatar");
|
|
|
|
User inviter = modelInvite.getInviter();
|
2021-08-09 22:51:56 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView, IconUtils.getForUser$default(inviter != null ? new CoreUser(inviter) : null, true, null, 4, null), (int) R.dimen.avatar_size_hero, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
2021-08-17 07:10:14 +00:00
|
|
|
SimpleDraweeView simpleDraweeView2 = this.binding.f1820c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView2, "binding.inviteAvatarSmall");
|
|
|
|
Guild guild = modelInvite.getGuild();
|
2021-08-13 06:23:11 +00:00
|
|
|
Long valueOf = guild != null ? Long.valueOf(guild.p()) : null;
|
2021-08-03 07:33:18 +00:00
|
|
|
Guild guild2 = modelInvite.getGuild();
|
2021-08-13 06:23:11 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView2, IconUtils.getForGuild$default(valueOf, guild2 != null ? guild2.o() : null, IconUtils.DEFAULT_ICON_BLURPLE, true, null, 16, null), (int) R.dimen.avatar_size_medium, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
2021-08-03 07:33:18 +00:00
|
|
|
} else {
|
|
|
|
SimpleDraweeView simpleDraweeView3 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView3, "binding.inviteAvatar");
|
|
|
|
Guild guild3 = modelInvite.getGuild();
|
2021-08-13 06:23:11 +00:00
|
|
|
Long valueOf2 = guild3 != null ? Long.valueOf(guild3.p()) : null;
|
2021-08-03 07:33:18 +00:00
|
|
|
Guild guild4 = modelInvite.getGuild();
|
2021-08-13 06:23:11 +00:00
|
|
|
IconUtils.setIcon$default(simpleDraweeView3, IconUtils.getForGuild$default(valueOf2, guild4 != null ? guild4.o() : null, IconUtils.DEFAULT_ICON_BLURPLE, true, null, 16, null), (int) R.dimen.avatar_size_hero, (Function1) null, (MGImages.ChangeDetector) null, 24, (Object) null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
CardView cardView = this.binding.i;
|
|
|
|
m.checkNotNullExpressionValue(cardView, "binding.inviteMembersOnlineWrap");
|
|
|
|
cardView.setVisibility(z2 ^ true ? 0 : 8);
|
|
|
|
CardView cardView2 = this.binding.k;
|
|
|
|
m.checkNotNullExpressionValue(cardView2, "binding.inviteMembersTotalWrap");
|
|
|
|
cardView2.setVisibility(z2 ^ true ? 0 : 8);
|
|
|
|
RelativeLayout relativeLayout = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.inviteAvatarSmallWrap");
|
|
|
|
relativeLayout.setVisibility(z2 ? 0 : 8);
|
2021-08-17 07:10:14 +00:00
|
|
|
SimpleDraweeView simpleDraweeView4 = this.binding.f1820c;
|
2021-08-03 07:33:18 +00:00
|
|
|
m.checkNotNullExpressionValue(simpleDraweeView4, "binding.inviteAvatarSmall");
|
|
|
|
if (!z2) {
|
|
|
|
i = 8;
|
|
|
|
}
|
|
|
|
simpleDraweeView4.setVisibility(i);
|
|
|
|
TextView textView = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.inviteMessage");
|
|
|
|
Guild guild5 = modelInvite.getGuild();
|
2021-08-13 06:23:11 +00:00
|
|
|
String v = guild5 != null ? guild5.v() : null;
|
|
|
|
if (v == null) {
|
|
|
|
v = "";
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
2021-08-13 06:23:11 +00:00
|
|
|
textView.setText(getFormattedGuildName(v));
|
2021-08-03 07:33:18 +00:00
|
|
|
Guild guild6 = modelInvite.getGuild();
|
|
|
|
if (guild6 == null || (l2 = guild6.l()) == null || !l2.contains(GuildFeature.VERIFIED)) {
|
|
|
|
Guild guild7 = modelInvite.getGuild();
|
|
|
|
if (!(guild7 == null || (l = guild7.l()) == null || !l.contains(GuildFeature.PARTNERED))) {
|
|
|
|
TextView textView2 = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.inviteMessage");
|
2021-08-09 22:51:56 +00:00
|
|
|
ViewExtensions.setCompoundDrawableWithIntrinsicBounds$default(textView2, R.drawable.ic_partnered_badge, 0, 0, 0, 14, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
TextView textView3 = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView3, "binding.inviteMessage");
|
2021-08-09 22:51:56 +00:00
|
|
|
ViewExtensions.setCompoundDrawableWithIntrinsicBounds$default(textView3, R.drawable.ic_verified_badge, 0, 0, 0, 14, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
TextView textView4 = this.binding.n;
|
|
|
|
m.checkNotNullExpressionValue(textView4, "binding.inviteTitle");
|
|
|
|
User inviter2 = modelInvite.getInviter();
|
|
|
|
if (inviter2 != null) {
|
|
|
|
str = inviter2.r();
|
|
|
|
}
|
|
|
|
textView4.setText(getIntroText(str));
|
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getFormattedGuildName(String str) {
|
|
|
|
return b.l(a.t("**", str, "**"), new Object[0], null, 2);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getIntroText(String str) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return str == null ? b.j(this, R.string.instant_invite_you_have_been_invited_to_join, new Object[0], null, 4) : b.j(this, R.string.auth_message_invited_by, new Object[]{str}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getIntroTextForGroup(String str, String str2) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return str2.length() > 0 ? b.j(this, R.string.auth_message_invited_by, new Object[]{str}, null, 4) : b.j(this, R.string.instant_invite_you_have_been_invited_to_join_group_dm, new Object[0], null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getInviteSubtitleForDirectFriend(String str) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return b.j(this, R.string.instant_invite_direct_friend_description, new Object[]{str}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getInviteTitleForDirectFriend(String str) {
|
2021-08-09 22:51:56 +00:00
|
|
|
return b.j(this, R.string.instant_invite_you_have_been_invited_to_chat, new Object[]{str}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getMembersCount(int i) {
|
|
|
|
Resources resources = getResources();
|
|
|
|
m.checkNotNullExpressionValue(resources, "resources");
|
|
|
|
Context context = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
return b.j(this, R.string.instant_invite_guild_members_total, new Object[]{StringResourceUtilsKt.getQuantityString(resources, context, (int) R.plurals.instant_invite_guild_members_total_count, i, Integer.valueOf(i))}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final CharSequence getMembersOnlineCount(int i) {
|
|
|
|
Context context = getContext();
|
|
|
|
m.checkNotNullExpressionValue(context, "context");
|
2021-08-09 22:51:56 +00:00
|
|
|
return b.j(this, R.string.instant_invite_guild_members_online, new Object[]{StringUtilsKt.format(i, context)}, null, 4);
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private final void parseAttributeSet(Context context, AttributeSet attributeSet, int i) {
|
|
|
|
if (attributeSet != null) {
|
|
|
|
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R.a.WidgetInviteInfo, i, 0);
|
|
|
|
m.checkNotNullExpressionValue(obtainStyledAttributes, "context.obtainStyledAttr…iteInfo, defStyleAttr, 0)");
|
|
|
|
obtainStyledAttributes.recycle();
|
|
|
|
post(new WidgetInviteInfo$parseAttributeSet$1(this, (int) obtainStyledAttributes.getDimension(0, 0.0f), (int) obtainStyledAttributes.getDimension(1, 0.0f)));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void configureUI(ModelInvite modelInvite) {
|
|
|
|
m.checkNotNullParameter(modelInvite, "model");
|
|
|
|
if (modelInvite.getGuild() == null && modelInvite.getChannel() == null && modelInvite.getInviter() != null) {
|
|
|
|
configureForDirectFriend(modelInvite);
|
|
|
|
} else if (modelInvite.getGuild() == null) {
|
|
|
|
configureForGDM(modelInvite);
|
|
|
|
} else {
|
|
|
|
configureForGuild(modelInvite);
|
|
|
|
}
|
|
|
|
LinearLayout linearLayout = this.binding.l;
|
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.inviteMembersWrap");
|
|
|
|
linearLayout.setVisibility(0);
|
|
|
|
TextView textView = this.binding.j;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.inviteMembersTotal");
|
|
|
|
textView.setText(getMembersCount(modelInvite.getApproximateMemberCount()));
|
|
|
|
TextView textView2 = this.binding.h;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.inviteMembersOnline");
|
|
|
|
textView2.setText(getMembersOnlineCount(modelInvite.getApproximatePresenceCount()));
|
|
|
|
RelativeLayout relativeLayout = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.inviteAvatarWrap");
|
|
|
|
relativeLayout.setVisibility(0);
|
|
|
|
ImageView imageView = this.binding.g;
|
|
|
|
m.checkNotNullExpressionValue(imageView, "binding.inviteExpiredImage");
|
|
|
|
imageView.setVisibility(8);
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void configureUIFailure(Error error) {
|
2021-08-09 22:51:56 +00:00
|
|
|
this.binding.n.setText(R.string.instant_invite_expired);
|
|
|
|
this.binding.m.setText(R.string.invite_button_expired);
|
2021-08-03 07:33:18 +00:00
|
|
|
if (error != null) {
|
|
|
|
Error.Response response = error.getResponse();
|
|
|
|
m.checkNotNullExpressionValue(response, "e.response");
|
|
|
|
if (response.getCode() == 30001) {
|
2021-08-18 06:27:30 +00:00
|
|
|
MeUser me2 = StoreStream.Companion.getUsers().getMe();
|
|
|
|
TextView textView = this.binding.n;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.inviteTitle");
|
|
|
|
b.m(textView, R.string.too_many_user_guilds_alert_description, new Object[0], new WidgetInviteInfo$configureUIFailure$1(me2));
|
2021-08-09 22:51:56 +00:00
|
|
|
this.binding.m.setText(R.string.too_many_user_guilds_description);
|
|
|
|
this.binding.m.setTextSize(0, getResources().getDimension(R.dimen.uikit_textsize_medium));
|
2021-08-03 07:33:18 +00:00
|
|
|
}
|
|
|
|
}
|
2021-08-18 06:27:30 +00:00
|
|
|
TextView textView2 = this.binding.m;
|
|
|
|
m.checkNotNullExpressionValue(textView2, "binding.inviteMessage");
|
|
|
|
ViewExtensions.setCompoundDrawableWithIntrinsicBounds$default(textView2, 0, 0, 0, 0, 15, null);
|
2021-08-03 07:33:18 +00:00
|
|
|
LinearLayout linearLayout = this.binding.l;
|
|
|
|
m.checkNotNullExpressionValue(linearLayout, "binding.inviteMembersWrap");
|
|
|
|
linearLayout.setVisibility(8);
|
|
|
|
RelativeLayout relativeLayout = this.binding.f;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout, "binding.inviteAvatarWrap");
|
|
|
|
relativeLayout.setVisibility(8);
|
|
|
|
RelativeLayout relativeLayout2 = this.binding.e;
|
|
|
|
m.checkNotNullExpressionValue(relativeLayout2, "binding.inviteAvatarSmallWrap");
|
|
|
|
relativeLayout2.setVisibility(8);
|
|
|
|
CardView cardView = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(cardView, "binding.inviteAvatarSmallCard");
|
|
|
|
cardView.setVisibility(8);
|
|
|
|
ImageView imageView = this.binding.g;
|
|
|
|
m.checkNotNullExpressionValue(imageView, "binding.inviteExpiredImage");
|
|
|
|
imageView.setVisibility(0);
|
|
|
|
}
|
|
|
|
}
|