159 lines
8.5 KiB
Java
159 lines
8.5 KiB
Java
package com.discord.widgets.chat.list.adapter;
|
|
|
|
import android.content.Context;
|
|
import android.view.View;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.TextView;
|
|
import c.a.l.b;
|
|
import com.discord.databinding.WidgetChatListAdapterItemStartBinding;
|
|
import com.discord.models.member.GuildMember;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.utilities.threads.ThreadUtils;
|
|
import com.discord.widgets.chat.list.entries.ChatListEntry;
|
|
import com.discord.widgets.chat.list.entries.StartOfChatEntry;
|
|
import d0.z.d.m;
|
|
/* compiled from: WidgetChatListAdapterItemStart.kt */
|
|
public final class WidgetChatListAdapterItemStart extends WidgetChatListItem {
|
|
private final WidgetChatListAdapterItemStartBinding binding;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public WidgetChatListAdapterItemStart(WidgetChatListAdapter widgetChatListAdapter) {
|
|
super(2131558957, widgetChatListAdapter);
|
|
m.checkNotNullParameter(widgetChatListAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131362527;
|
|
TextView textView = (TextView) view.findViewById(2131362527);
|
|
if (textView != null) {
|
|
i = 2131362531;
|
|
TextView textView2 = (TextView) view.findViewById(2131362531);
|
|
if (textView2 != null) {
|
|
i = 2131362540;
|
|
TextView textView3 = (TextView) view.findViewById(2131362540);
|
|
if (textView3 != null) {
|
|
i = 2131362541;
|
|
TextView textView4 = (TextView) view.findViewById(2131362541);
|
|
if (textView4 != null) {
|
|
i = 2131362561;
|
|
ImageView imageView = (ImageView) view.findViewById(2131362561);
|
|
if (imageView != null) {
|
|
WidgetChatListAdapterItemStartBinding widgetChatListAdapterItemStartBinding = new WidgetChatListAdapterItemStartBinding((LinearLayout) view, textView, textView2, textView3, textView4, imageView);
|
|
m.checkNotNullExpressionValue(widgetChatListAdapterItemStartBinding, "WidgetChatListAdapterIte…artBinding.bind(itemView)");
|
|
this.binding = widgetChatListAdapterItemStartBinding;
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
|
|
}
|
|
|
|
public static final /* synthetic */ WidgetChatListAdapter access$getAdapter$p(WidgetChatListAdapterItemStart widgetChatListAdapterItemStart) {
|
|
return (WidgetChatListAdapter) widgetChatListAdapterItemStart.adapter;
|
|
}
|
|
|
|
public static final /* synthetic */ int access$getAuthorTextColor(WidgetChatListAdapterItemStart widgetChatListAdapterItemStart, GuildMember guildMember) {
|
|
return widgetChatListAdapterItemStart.getAuthorTextColor(guildMember);
|
|
}
|
|
|
|
private final void configureChannel(long j, String str, boolean z2, boolean z3) {
|
|
TextView textView = this.binding.f1742c;
|
|
m.checkNotNullExpressionValue(textView, "binding.chatListAdapterItemHeader");
|
|
int i = 0;
|
|
b.m(textView, 2131886351, new Object[]{str}, null, 4);
|
|
TextView textView2 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView2, "binding.chatListAdapterItemSubheader1");
|
|
textView2.setVisibility(8);
|
|
ImageView imageView = this.binding.f;
|
|
m.checkNotNullExpressionValue(imageView, "binding.chatListAdapterThreadHeaderIcon");
|
|
imageView.setVisibility(8);
|
|
if (z2) {
|
|
TextView textView3 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView3, "binding.chatListAdapterItemSubheader2");
|
|
b.m(textView3, 2131886350, new Object[]{str}, null, 4);
|
|
} else {
|
|
TextView textView4 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView4, "binding.chatListAdapterItemSubheader2");
|
|
b.m(textView4, 2131886833, new Object[]{str}, null, 4);
|
|
}
|
|
this.binding.b.setOnClickListener(new WidgetChatListAdapterItemStart$configureChannel$1(this, j));
|
|
TextView textView5 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView5, "binding.chatListAdapterItemEditChannel");
|
|
b.m(textView5, 2131888200, new Object[0], null, 4);
|
|
TextView textView6 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView6, "binding.chatListAdapterItemEditChannel");
|
|
if (!z3) {
|
|
i = 8;
|
|
}
|
|
textView6.setVisibility(i);
|
|
}
|
|
|
|
/* JADX DEBUG: Can't convert new array creation: APUT found in different block: 0x0043: APUT (r4v1 java.lang.Object[]), (0 ??[int, short, byte, char]), (r6v0 java.lang.String) */
|
|
private final void configureThread(long j, String str, boolean z2, boolean z3, GuildMember guildMember, Integer num) {
|
|
TextView textView = this.binding.f1742c;
|
|
m.checkNotNullExpressionValue(textView, "binding.chatListAdapterItemHeader");
|
|
Context context = textView.getContext();
|
|
TextView textView2 = this.binding.f1742c;
|
|
m.checkNotNullExpressionValue(textView2, "binding.chatListAdapterItemHeader");
|
|
textView2.setText(str);
|
|
TextView textView3 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView3, "binding.chatListAdapterItemSubheader1");
|
|
int i = 0;
|
|
textView3.setVisibility(0);
|
|
ImageView imageView = this.binding.f;
|
|
m.checkNotNullExpressionValue(imageView, "binding.chatListAdapterThreadHeaderIcon");
|
|
imageView.setVisibility(0);
|
|
TextView textView4 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView4, "binding.chatListAdapterItemSubheader1");
|
|
Object[] objArr = new Object[1];
|
|
objArr[0] = guildMember != null ? guildMember.getNick() : null;
|
|
b.l(textView4, 2131893989, objArr, new WidgetChatListAdapterItemStart$configureThread$1(this, guildMember, context));
|
|
if (z2) {
|
|
ThreadUtils threadUtils = ThreadUtils.INSTANCE;
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
String autoArchiveDurationName = threadUtils.autoArchiveDurationName(context, num != null ? num.intValue() : 0);
|
|
TextView textView5 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView5, "binding.chatListAdapterItemSubheader2");
|
|
b.l(textView5, 2131886841, new Object[]{autoArchiveDurationName}, new WidgetChatListAdapterItemStart$configureThread$2(autoArchiveDurationName, context));
|
|
} else {
|
|
TextView textView6 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView6, "binding.chatListAdapterItemSubheader2");
|
|
b.m(textView6, 2131886833, new Object[]{str}, null, 4);
|
|
}
|
|
this.binding.b.setOnClickListener(new WidgetChatListAdapterItemStart$configureThread$3(this, j));
|
|
TextView textView7 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView7, "binding.chatListAdapterItemEditChannel");
|
|
b.m(textView7, 2131888212, new Object[0], null, 4);
|
|
TextView textView8 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView8, "binding.chatListAdapterItemEditChannel");
|
|
if (!z3) {
|
|
i = 8;
|
|
}
|
|
textView8.setVisibility(i);
|
|
}
|
|
|
|
private final int getAuthorTextColor(GuildMember guildMember) {
|
|
View view = this.itemView;
|
|
m.checkNotNullExpressionValue(view, "itemView");
|
|
return GuildMember.Companion.getColor(guildMember, ColorCompat.getThemedColor(view.getContext(), 2130968932));
|
|
}
|
|
|
|
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListItem
|
|
public void onConfigure(int i, ChatListEntry chatListEntry) {
|
|
m.checkNotNullParameter(chatListEntry, "data");
|
|
super.onConfigure(i, chatListEntry);
|
|
StartOfChatEntry startOfChatEntry = (StartOfChatEntry) chatListEntry;
|
|
long component1 = startOfChatEntry.component1();
|
|
String component2 = startOfChatEntry.component2();
|
|
boolean component3 = startOfChatEntry.component3();
|
|
boolean component4 = startOfChatEntry.component4();
|
|
boolean component5 = startOfChatEntry.component5();
|
|
if (startOfChatEntry.isThread()) {
|
|
configureThread(component1, component2, component3, component5, startOfChatEntry.getThreadCreator(), startOfChatEntry.getThreadAutoArchiveDuration());
|
|
} else {
|
|
configureChannel(component1, component2, component3, component4);
|
|
}
|
|
}
|
|
}
|