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-06-27 20:53:42 +00:00
|
|
|
super(2131558961, widgetChatListAdapter);
|
2021-06-27 20:44:35 +00:00
|
|
|
m.checkNotNullParameter(widgetChatListAdapter, "adapter");
|
|
|
|
this.flexInputViewModel = appFlexInputViewModel;
|
|
|
|
View view = this.itemView;
|
|
|
|
int i = 2131362070;
|
|
|
|
TextView textView = (TextView) view.findViewById(2131362070);
|
|
|
|
if (textView != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131362940;
|
|
|
|
View findViewById = view.findViewById(2131362940);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (findViewById != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131364352;
|
|
|
|
CheckedSetting checkedSetting = (CheckedSetting) view.findViewById(2131364352);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (checkedSetting != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365261;
|
|
|
|
ImageView imageView = (ImageView) view.findViewById(2131365261);
|
2021-06-27 20:44:35 +00:00
|
|
|
if (imageView != null) {
|
2021-06-27 20:53:42 +00:00
|
|
|
i = 2131365265;
|
|
|
|
TextInputLayout textInputLayout = (TextInputLayout) view.findViewById(2131365265);
|
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-06-27 20:53:42 +00:00
|
|
|
this.binding.d.setImageResource(threadDraftState.isPrivate() ? 2131231992 : 2131231991);
|
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-06-27 20:53:42 +00:00
|
|
|
CheckedSetting checkedSetting = this.binding.f1747c;
|
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-06-27 20:53:42 +00:00
|
|
|
this.binding.f1747c.setOnCheckedListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$2(threadDraft, threadDraftState));
|
2021-06-27 20:44:35 +00:00
|
|
|
} else {
|
|
|
|
threadDraft.setDraftState(StoreThreadDraft.ThreadDraftState.copy$default(threadDraftState, true, 0, null, false, 14, null));
|
2021-06-27 20:53:42 +00:00
|
|
|
this.binding.f1747c.setOnCheckedListener(null);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
2021-06-27 20:53:42 +00:00
|
|
|
CheckedSetting checkedSetting2 = this.binding.f1747c;
|
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-06-27 20:53:42 +00:00
|
|
|
b.m(textView, 2131887966, new Object[0], new WidgetChatListAdapterItemThreadDraftForm$onConfigure$3(this, threadDraftState));
|
2021-06-27 20:44:35 +00:00
|
|
|
this.binding.b.setOnClickListener(new WidgetChatListAdapterItemThreadDraftForm$onConfigure$4(this));
|
|
|
|
}
|
|
|
|
}
|