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

102 lines
6.3 KiB
Java

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.k.b;
import com.discord.databinding.WidgetChatListAdapterItemThreadDraftFormBinding;
import com.discord.stores.StoreStream;
import com.discord.stores.StoreThreadDraft;
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) {
super(2131558972, widgetChatListAdapter);
m.checkNotNullParameter(widgetChatListAdapter, "adapter");
this.flexInputViewModel = appFlexInputViewModel;
View view = this.itemView;
int i = 2131362077;
TextView textView = (TextView) view.findViewById(2131362077);
if (textView != null) {
i = 2131362995;
View findViewById = view.findViewById(2131362995);
if (findViewById != null) {
i = 2131364447;
CheckedSetting checkedSetting = (CheckedSetting) view.findViewById(2131364447);
if (checkedSetting != null) {
i = 2131365386;
ImageView imageView = (ImageView) view.findViewById(2131365386);
if (imageView != null) {
i = 2131365390;
TextInputLayout textInputLayout = (TextInputLayout) view.findViewById(2131365390);
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();
this.binding.d.setImageResource(threadDraftState.isPrivate() ? 2131232021 : 2131232019);
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));
}
CheckedSetting checkedSetting = this.binding.f1755c;
m.checkNotNullExpressionValue(checkedSetting, "binding.privateThreadToggle");
checkedSetting.setVisibility(threadDraftFormEntry.getParentMessageId() == null && threadDraftFormEntry.getCanCreatePrivateThread() ? 0 : 8);
if (threadDraftFormEntry.getCanCreatePublicThread() || threadDraftState.isPrivate()) {
this.binding.f1755c.setOnCheckedListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$2(threadDraft, threadDraftState));
} else {
threadDraft.setDraftState(StoreThreadDraft.ThreadDraftState.copy$default(threadDraftState, true, null, null, false, 14, null));
this.binding.f1755c.setOnCheckedListener(null);
}
CheckedSetting checkedSetting2 = this.binding.f1755c;
m.checkNotNullExpressionValue(checkedSetting2, "binding.privateThreadToggle");
checkedSetting2.setChecked(threadDraftState.isPrivate());
TextView textView = this.binding.b;
m.checkNotNullExpressionValue(textView, "binding.autoArchiveDuration");
b.l(textView, 2131887970, new Object[0], new WidgetChatListAdapterItemThreadDraftForm$onConfigure$3(this, threadDraftState, chatListEntry, threadDraftFormEntry));
this.binding.b.setOnClickListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$4(this, threadDraftFormEntry));
}
}