discord-jadx/app/src/main/java/com/discord/widgets/chat/list/adapter/WidgetChatListAdapterItemTh...

124 lines
7.3 KiB
Java
Raw Normal View History

2021-06-27 20:44:35 +00:00
package com.discord.widgets.chat.list.adapter;
import android.text.TextWatcher;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import c.a.l.b;
import com.discord.databinding.WidgetChatListAdapterItemThreadDraftFormBinding;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreThreadDraft;
import com.discord.utilities.view.extensions.ViewExtensions;
import com.discord.views.CheckedSetting;
import com.discord.widgets.chat.input.AppFlexInputViewModel;
import com.discord.widgets.chat.list.entries.ChatListEntry;
import com.discord.widgets.chat.list.entries.ThreadDraftFormEntry;
import com.google.android.material.textfield.TextInputLayout;
import d0.z.d.m;
/* compiled from: WidgetChatListAdapterItemThreadDraftForm.kt */
public final class WidgetChatListAdapterItemThreadDraftForm extends WidgetChatListItem {
private final WidgetChatListAdapterItemThreadDraftFormBinding binding;
private final AppFlexInputViewModel flexInputViewModel;
private TextWatcher nameTextWatcher;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatListAdapterItemThreadDraftForm(WidgetChatListAdapter widgetChatListAdapter, AppFlexInputViewModel appFlexInputViewModel) {
2021-07-13 20:23:20 +00:00
super(2131558970, widgetChatListAdapter);
2021-06-27 20:44:35 +00:00
m.checkNotNullParameter(widgetChatListAdapter, "adapter");
this.flexInputViewModel = appFlexInputViewModel;
View view = this.itemView;
2021-07-13 20:23:20 +00:00
int i = 2131362073;
TextView textView = (TextView) view.findViewById(2131362073);
2021-06-27 20:44:35 +00:00
if (textView != null) {
2021-07-13 20:23:20 +00:00
i = 2131362995;
View findViewById = view.findViewById(2131362995);
2021-06-27 20:44:35 +00:00
if (findViewById != null) {
2021-07-13 20:23:20 +00:00
i = 2131364435;
CheckedSetting checkedSetting = (CheckedSetting) view.findViewById(2131364435);
2021-06-27 20:44:35 +00:00
if (checkedSetting != null) {
2021-07-13 20:23:20 +00:00
i = 2131365371;
ImageView imageView = (ImageView) view.findViewById(2131365371);
2021-06-27 20:44:35 +00:00
if (imageView != null) {
2021-07-13 20:23:20 +00:00
i = 2131365375;
TextInputLayout textInputLayout = (TextInputLayout) view.findViewById(2131365375);
2021-06-27 20:44:35 +00:00
if (textInputLayout != null) {
WidgetChatListAdapterItemThreadDraftFormBinding widgetChatListAdapterItemThreadDraftFormBinding = new WidgetChatListAdapterItemThreadDraftFormBinding((LinearLayout) view, textView, findViewById, checkedSetting, imageView, textInputLayout);
m.checkNotNullExpressionValue(widgetChatListAdapterItemThreadDraftFormBinding, "WidgetChatListAdapterIte…ormBinding.bind(itemView)");
this.binding = widgetChatListAdapterItemThreadDraftFormBinding;
return;
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
}
public static final /* synthetic */ WidgetChatListAdapter access$getAdapter$p(WidgetChatListAdapterItemThreadDraftForm widgetChatListAdapterItemThreadDraftForm) {
return (WidgetChatListAdapter) widgetChatListAdapterItemThreadDraftForm.adapter;
}
public final AppFlexInputViewModel getFlexInputViewModel() {
return this.flexInputViewModel;
}
@Override // com.discord.widgets.chat.list.adapter.WidgetChatListItem
public void onConfigure(int i, ChatListEntry chatListEntry) {
m.checkNotNullParameter(chatListEntry, "data");
super.onConfigure(i, chatListEntry);
StoreThreadDraft threadDraft = StoreStream.Companion.getThreadDraft();
ThreadDraftFormEntry threadDraftFormEntry = (ThreadDraftFormEntry) chatListEntry;
StoreThreadDraft.ThreadDraftState threadDraftState = threadDraftFormEntry.getThreadDraftState();
2021-07-13 20:23:20 +00:00
this.binding.d.setImageResource(threadDraftState.isPrivate() ? 2131232013 : 2131232012);
2021-06-27 20:44:35 +00:00
TextInputLayout textInputLayout = this.binding.e;
m.checkNotNullExpressionValue(textInputLayout, "binding.threadNameInput");
EditText editText = textInputLayout.getEditText();
if (editText != null) {
editText.removeTextChangedListener(this.nameTextWatcher);
WidgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$1 widgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$1 = new WidgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$1(this, threadDraft, threadDraftState);
editText.addTextChangedListener(widgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$1);
this.nameTextWatcher = widgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$1;
editText.setOnEditorActionListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$$inlined$apply$lambda$2(this, threadDraft, threadDraftState));
}
String threadName = threadDraftState.getThreadName();
String str = "";
if (threadName == null) {
threadName = str;
}
TextInputLayout textInputLayout2 = this.binding.e;
m.checkNotNullExpressionValue(textInputLayout2, "binding.threadNameInput");
boolean areEqual = m.areEqual(threadName, ViewExtensions.getTextOrEmpty(textInputLayout2));
boolean z2 = true;
if (!areEqual) {
TextInputLayout textInputLayout3 = this.binding.e;
m.checkNotNullExpressionValue(textInputLayout3, "binding.threadNameInput");
String threadName2 = threadDraftState.getThreadName();
if (threadName2 != null) {
str = threadName2;
}
ViewExtensions.setText(textInputLayout3, str);
}
2021-07-13 20:23:20 +00:00
CheckedSetting checkedSetting = this.binding.f1754c;
2021-06-27 20:44:35 +00:00
m.checkNotNullExpressionValue(checkedSetting, "binding.privateThreadToggle");
if (threadDraftFormEntry.getParentMessageId() != null || !threadDraftFormEntry.getCanCreatePrivateThread()) {
z2 = false;
}
checkedSetting.setVisibility(z2 ? 0 : 8);
if (threadDraftFormEntry.getCanCreatePublicThread() || threadDraftState.isPrivate()) {
2021-07-13 20:23:20 +00:00
this.binding.f1754c.setOnCheckedListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$2(threadDraft, threadDraftState));
2021-06-27 20:44:35 +00:00
} else {
2021-07-03 23:36:06 +00:00
threadDraft.setDraftState(StoreThreadDraft.ThreadDraftState.copy$default(threadDraftState, true, null, null, false, 14, null));
2021-07-13 20:23:20 +00:00
this.binding.f1754c.setOnCheckedListener(null);
2021-06-27 20:44:35 +00:00
}
2021-07-13 20:23:20 +00:00
CheckedSetting checkedSetting2 = this.binding.f1754c;
2021-06-27 20:44:35 +00:00
m.checkNotNullExpressionValue(checkedSetting2, "binding.privateThreadToggle");
checkedSetting2.setChecked(threadDraftState.isPrivate());
TextView textView = this.binding.b;
m.checkNotNullExpressionValue(textView, "binding.autoArchiveDuration");
2021-07-13 20:23:20 +00:00
b.l(textView, 2131887966, new Object[0], new WidgetChatListAdapterItemThreadDraftForm$onConfigure$3(this, threadDraftState, chatListEntry, threadDraftFormEntry));
2021-07-03 23:36:06 +00:00
this.binding.b.setOnClickListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$4(this, threadDraftFormEntry));
2021-06-27 20:44:35 +00:00
}
}