165 lines
9.2 KiB
Java
165 lines
9.2 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.k.b;
|
|
import com.discord.R;
|
|
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(R.layout.widget_chat_list_adapter_item_start, widgetChatListAdapter);
|
|
m.checkNotNullParameter(widgetChatListAdapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = R.id.chat_list_adapter_item_edit_channel;
|
|
TextView textView = (TextView) view.findViewById(R.id.chat_list_adapter_item_edit_channel);
|
|
if (textView != null) {
|
|
i = R.id.chat_list_adapter_item_header;
|
|
TextView textView2 = (TextView) view.findViewById(R.id.chat_list_adapter_item_header);
|
|
if (textView2 != null) {
|
|
i = R.id.chat_list_adapter_item_subheader1;
|
|
TextView textView3 = (TextView) view.findViewById(R.id.chat_list_adapter_item_subheader1);
|
|
if (textView3 != null) {
|
|
i = R.id.chat_list_adapter_item_subheader2;
|
|
TextView textView4 = (TextView) view.findViewById(R.id.chat_list_adapter_item_subheader2);
|
|
if (textView4 != null) {
|
|
i = R.id.chat_list_adapter_thread_header_icon;
|
|
ImageView imageView = (ImageView) view.findViewById(R.id.chat_list_adapter_thread_header_icon);
|
|
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, boolean z4) {
|
|
TextView textView = this.binding.f1826c;
|
|
m.checkNotNullExpressionValue(textView, "binding.chatListAdapterItemHeader");
|
|
int i = 0;
|
|
b.n(textView, R.string.android_welcome_message_title_channel, new Object[]{str}, null, 4);
|
|
TextView textView2 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView2, "binding.chatListAdapterItemSubheader1");
|
|
textView2.setVisibility(8);
|
|
if (z2) {
|
|
ImageView imageView = this.binding.f;
|
|
m.checkNotNullExpressionValue(imageView, "binding.chatListAdapterThreadHeaderIcon");
|
|
imageView.setVisibility(0);
|
|
this.binding.f.setImageResource(R.drawable.ic_chat_message_white_24dp);
|
|
} else {
|
|
ImageView imageView2 = this.binding.f;
|
|
m.checkNotNullExpressionValue(imageView2, "binding.chatListAdapterThreadHeaderIcon");
|
|
imageView2.setVisibility(8);
|
|
}
|
|
if (z3) {
|
|
TextView textView3 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView3, "binding.chatListAdapterItemSubheader2");
|
|
b.n(textView3, R.string.android_welcome_message_subtitle_channel, new Object[]{str}, null, 4);
|
|
} else {
|
|
TextView textView4 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView4, "binding.chatListAdapterItemSubheader2");
|
|
b.n(textView4, R.string.beginning_channel_no_history, 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.n(textView5, R.string.edit_channel, new Object[0], null, 4);
|
|
TextView textView6 = this.binding.b;
|
|
m.checkNotNullExpressionValue(textView6, "binding.chatListAdapterItemEditChannel");
|
|
if (!z4) {
|
|
i = 8;
|
|
}
|
|
textView6.setVisibility(i);
|
|
}
|
|
|
|
private final void configureThread(long j, String str, boolean z2, boolean z3, GuildMember guildMember, String str2, Integer num) {
|
|
TextView textView = this.binding.f1826c;
|
|
m.checkNotNullExpressionValue(textView, "binding.chatListAdapterItemHeader");
|
|
Context context = textView.getContext();
|
|
TextView textView2 = this.binding.f1826c;
|
|
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);
|
|
this.binding.f.setImageResource(R.drawable.ic_thread);
|
|
TextView textView4 = this.binding.d;
|
|
m.checkNotNullExpressionValue(textView4, "binding.chatListAdapterItemSubheader1");
|
|
b.m(textView4, R.string.thread_started_by, new Object[]{str2}, new WidgetChatListAdapterItemStart$configureThread$1(this, str2, context, guildMember));
|
|
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.m(textView5, R.string.beginning_thread_archive_description, new Object[]{autoArchiveDurationName}, new WidgetChatListAdapterItemStart$configureThread$2(autoArchiveDurationName, context));
|
|
} else {
|
|
TextView textView6 = this.binding.e;
|
|
m.checkNotNullExpressionValue(textView6, "binding.chatListAdapterItemSubheader2");
|
|
b.n(textView6, R.string.beginning_channel_no_history, 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.n(textView7, R.string.edit_thread, 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(), (int) R.attr.colorHeaderPrimary));
|
|
}
|
|
|
|
@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.getThreadCreatorMember(), startOfChatEntry.getThreadCreatorName(), startOfChatEntry.getThreadAutoArchiveDuration());
|
|
} else {
|
|
configureChannel(component1, component2, startOfChatEntry.isTextInVoice(), component3, component4);
|
|
}
|
|
}
|
|
}
|