package com.discord.widgets.chat.list.adapter; import android.text.method.LinkMovementMethod; import android.view.View; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; import androidx.cardview.widget.CardView; import androidx.constraintlayout.widget.ConstraintLayout; import androidx.constraintlayout.widget.Guideline; import c.a.l.b; import c.d.b.a.a; import com.discord.databinding.WidgetChatListAdapterItemApplicationCommandBinding; import com.discord.models.domain.ModelMessage; import com.discord.models.member.GuildMember; import com.discord.utilities.color.ColorCompat; import com.discord.utilities.time.TimeUtils; import com.discord.widgets.chat.list.entries.ChatListEntry; import com.discord.widgets.chat.list.entries.MessageEntry; import d0.g0.t; import d0.z.d.m; import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; /* compiled from: WidgetChatListAdapterItemApplicationCommand.kt */ public final class WidgetChatListAdapterItemApplicationCommand extends WidgetChatListItem { private final WidgetChatListAdapterItemApplicationCommandBinding binding; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public WidgetChatListAdapterItemApplicationCommand(WidgetChatListAdapter widgetChatListAdapter) { super(2131558922, widgetChatListAdapter); m.checkNotNullParameter(widgetChatListAdapter, "adapter"); View view = this.itemView; int i = 2131362530; ImageView imageView = (ImageView) view.findViewById(2131362530); if (imageView != null) { i = 2131362531; TextView textView = (TextView) view.findViewById(2131362531); if (textView != null) { i = 2131362532; CardView cardView = (CardView) view.findViewById(2131362532); if (cardView != null) { i = 2131362535; FrameLayout frameLayout = (FrameLayout) view.findViewById(2131362535); if (frameLayout != null) { i = 2131362539; ConstraintLayout constraintLayout = (ConstraintLayout) view.findViewById(2131362539); if (constraintLayout != null) { i = 2131362541; TextView textView2 = (TextView) view.findViewById(2131362541); if (textView2 != null) { i = 2131362544; TextView textView3 = (TextView) view.findViewById(2131362544); if (textView3 != null) { i = 2131365323; Guideline guideline = (Guideline) view.findViewById(2131365323); if (guideline != null) { WidgetChatListAdapterItemApplicationCommandBinding widgetChatListAdapterItemApplicationCommandBinding = new WidgetChatListAdapterItemApplicationCommandBinding((ConstraintLayout) view, imageView, textView, cardView, frameLayout, constraintLayout, textView2, textView3, guideline); m.checkNotNullExpressionValue(widgetChatListAdapterItemApplicationCommandBinding, "WidgetChatListAdapterIte…andBinding.bind(itemView)"); this.binding = widgetChatListAdapterItemApplicationCommandBinding; return; } } } } } } } } throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i))); } public static final /* synthetic */ WidgetChatListAdapter access$getAdapter$p(WidgetChatListAdapterItemApplicationCommand widgetChatListAdapterItemApplicationCommand) { return (WidgetChatListAdapter) widgetChatListAdapterItemApplicationCommand.adapter; } public static final /* synthetic */ WidgetChatListAdapterItemApplicationCommandBinding access$getBinding$p(WidgetChatListAdapterItemApplicationCommand widgetChatListAdapterItemApplicationCommand) { return widgetChatListAdapterItemApplicationCommand.binding; } private final int getAuthorTextColor(GuildMember guildMember) { View view = this.itemView; m.checkNotNullExpressionValue(view, "itemView"); return GuildMember.Companion.getColor(guildMember, ColorCompat.getThemedColor(view.getContext(), 2130968932)); } /* JADX WARNING: Code restructure failed: missing block: B:9:0x0048, code lost: if (r5 != null) goto L_0x004e; */ @Override // com.discord.widgets.chat.list.adapter.WidgetChatListItem public void onConfigure(int i, ChatListEntry chatListEntry) { String str; String str2; m.checkNotNullParameter(chatListEntry, "data"); super.onConfigure(i, chatListEntry); MessageEntry messageEntry = (MessageEntry) chatListEntry; ModelMessage message = messageEntry.getMessage(); GuildMember author = messageEntry.getAuthor(); Map nickOrUsernames = messageEntry.getNickOrUsernames(); int authorTextColor = getAuthorTextColor(author); WidgetChatListAdapterItemApplicationCommand$onConfigure$1 widgetChatListAdapterItemApplicationCommand$onConfigure$1 = WidgetChatListAdapterItemApplicationCommand$onConfigure$1.INSTANCE; Pattern compile = Pattern.compile("^<(/[^:]+):([0-9]*)>(.*)"); String content = message.getContent(); String str3 = ""; if (content == null) { content = str3; } Matcher matcher = compile.matcher(content); if (matcher.matches()) { str = matcher.group(1); if (str == null) { str = str3; } str2 = matcher.group(3); } else { str = "/"; } str2 = str3; String str4 = nickOrUsernames.get(Long.valueOf(message.getAuthor().i())); if (str4 != null) { str3 = str4; } View view = this.itemView; m.checkNotNullExpressionValue(view, "itemView"); int themedColor = ColorCompat.getThemedColor(view, 2130969007); TextView textView = this.binding.e; m.checkNotNullExpressionValue(textView, "binding.chatListAdapterItemTextName"); CharSequence c2 = b.c(textView, 2131893693, new Object[]{str3, str}, new WidgetChatListAdapterItemApplicationCommand$onConfigure$content$1(this, authorTextColor, message, themedColor)); TextView textView2 = this.binding.e; m.checkNotNullExpressionValue(textView2, "binding.chatListAdapterItemTextName"); textView2.setMovementMethod(LinkMovementMethod.getInstance()); TextView textView3 = this.binding.e; m.checkNotNullExpressionValue(textView3, "binding.chatListAdapterItemTextName"); textView3.setText(c2); TextView textView4 = this.binding.b; m.checkNotNullExpressionValue(textView4, "binding.chatListAdapterItemTextCommand"); textView4.setMaxLines(1); this.binding.b.setOnClickListener(new WidgetChatListAdapterItemApplicationCommand$onConfigure$2(this)); boolean z2 = !t.isBlank(str2); CardView cardView = this.binding.f1722c; m.checkNotNullExpressionValue(cardView, "binding.chatListAdapterItemTextDecorator"); int i2 = 8; cardView.setVisibility(z2 ? 0 : 8); FrameLayout frameLayout = this.binding.d; m.checkNotNullExpressionValue(frameLayout, "binding.chatListAdapterI…extDecoratorReplyLinkIcon"); if (z2) { i2 = 0; } frameLayout.setVisibility(i2); TextView textView5 = this.binding.b; m.checkNotNullExpressionValue(textView5, "binding.chatListAdapterItemTextCommand"); textView5.setText(b.g(a.T(this.itemView, "itemView", "itemView.context"), 2131887427, new Object[]{str, str2}, null, 4)); TextView textView6 = this.binding.b; m.checkNotNullExpressionValue(textView6, "binding.chatListAdapterItemTextCommand"); widgetChatListAdapterItemApplicationCommand$onConfigure$1.invoke(textView6); TextView textView7 = this.binding.f; m.checkNotNullExpressionValue(textView7, "binding.chatListAdapterItemTextTimestamp"); textView7.setText(TimeUtils.toReadableTimeString$default(a.T(this.itemView, "itemView", "itemView.context"), message.getTimestamp(), null, 4, null)); } }