discord-jadx/app/src/main/java/com/discord/widgets/chat/input/WidgetChatInputAttachments$...

86 lines
6.2 KiB
Java

package com.discord.widgets.chat.input;
import android.content.Context;
import androidx.appcompat.widget.AppCompatImageButton;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import c.b.a.d.d;
import com.discord.R;
import com.discord.app.AppFragment;
import com.discord.utilities.drawable.DrawableCompat;
import com.lytefast.flexinput.adapters.AttachmentPreviewAdapter;
import com.lytefast.flexinput.fragment.FlexInputFragment;
import com.lytefast.flexinput.managers.FileManager;
import com.lytefast.flexinput.model.Attachment;
import d0.t.n;
import d0.z.d.m;
import d0.z.d.o;
import java.util.List;
import java.util.Objects;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: WidgetChatInputAttachments.kt */
public final class WidgetChatInputAttachments$configureFlexInputFragment$1 extends o implements Function0<Unit> {
public final /* synthetic */ boolean $canCreateThread;
public final /* synthetic */ AppFragment $fragment;
public final /* synthetic */ WidgetChatInputAttachments this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetChatInputAttachments$configureFlexInputFragment$1(WidgetChatInputAttachments widgetChatInputAttachments, boolean z2, AppFragment appFragment) {
super(0);
this.this$0 = widgetChatInputAttachments;
this.$canCreateThread = z2;
this.$fragment = appFragment;
}
@Override // kotlin.jvm.functions.Function0
/* renamed from: invoke */
public final void mo1invoke() {
FlexInputFragment access$getFlexInputFragment$p = WidgetChatInputAttachments.access$getFlexInputFragment$p(this.this$0);
Context requireContext = access$getFlexInputFragment$p.requireContext();
m.checkNotNullExpressionValue(requireContext, "requireContext()");
Context requireContext2 = access$getFlexInputFragment$p.requireContext();
m.checkNotNullExpressionValue(requireContext2, "requireContext()");
Context requireContext3 = access$getFlexInputFragment$p.requireContext();
m.checkNotNullExpressionValue(requireContext3, "requireContext()");
List mutableListOf = n.mutableListOf(new WidgetChatInputAttachments$configureFlexInputFragment$1$1$pageArray$1(access$getFlexInputFragment$p, DrawableCompat.getThemedDrawableRes$default(requireContext, (int) R.attr.ic_flex_input_image, 0, 2, (Object) null), R.string.attachment_media), new WidgetChatInputAttachments$configureFlexInputFragment$1$1$pageArray$2(access$getFlexInputFragment$p, DrawableCompat.getThemedDrawableRes$default(requireContext2, (int) R.attr.ic_flex_input_file, 0, 2, (Object) null), R.string.attachment_files), new WidgetChatInputAttachments$configureFlexInputFragment$1$1$pageArray$3(access$getFlexInputFragment$p, DrawableCompat.getThemedDrawableRes$default(requireContext3, (int) R.attr.ic_flex_input_add_a_photo, 0, 2, (Object) null), R.string.camera));
if (this.$canCreateThread) {
Context requireContext4 = access$getFlexInputFragment$p.requireContext();
m.checkNotNullExpressionValue(requireContext4, "requireContext()");
mutableListOf.add(new WidgetChatInputAttachments$configureFlexInputFragment$1$1$page$1(access$getFlexInputFragment$p, DrawableCompat.getThemedDrawableRes$default(requireContext4, (int) R.attr.ic_flex_input_create_thread, 0, 2, (Object) null), R.string.create_thread));
}
Object[] array = mutableListOf.toArray(new d.a[0]);
Objects.requireNonNull(array, "null cannot be cast to non-null type kotlin.Array<T>");
d.a[] aVarArr = (d.a[]) array;
m.checkNotNullParameter(aVarArr, "pageSuppliers");
access$getFlexInputFragment$p.q = aVarArr;
FileManager fileManager = this.$fragment.getFileManager();
m.checkNotNullParameter(fileManager, "<set-?>");
access$getFlexInputFragment$p.o = fileManager;
access$getFlexInputFragment$p.m = new WidgetChatInputAttachments$configureFlexInputFragment$1$$special$$inlined$apply$lambda$1(this);
WidgetChatInputAttachments.access$getFlexInputFragment$p(this.this$0).k().setInputContentHandler(new WidgetChatInputAttachments$configureFlexInputFragment$1$$special$$inlined$apply$lambda$2(this));
AttachmentPreviewAdapter<Attachment<Object>> access$createPreviewAdapter = WidgetChatInputAttachments.access$createPreviewAdapter(this.this$0, this.$fragment.getContext());
m.checkNotNullParameter(access$createPreviewAdapter, "previewAdapter");
access$createPreviewAdapter.a.initFrom(access$getFlexInputFragment$p.b());
access$getFlexInputFragment$p.p = access$createPreviewAdapter;
RecyclerView recyclerView = access$getFlexInputFragment$p.j().d;
m.checkNotNullExpressionValue(recyclerView, "binding.attachmentPreviewList");
AttachmentPreviewAdapter<Attachment<Object>> attachmentPreviewAdapter = access$getFlexInputFragment$p.p;
if (attachmentPreviewAdapter == null) {
m.throwUninitializedPropertyAccessException("attachmentPreviewAdapter");
}
recyclerView.setAdapter(attachmentPreviewAdapter);
WidgetChatInputAttachments widgetChatInputAttachments = this.this$0;
FragmentManager childFragmentManager = this.$fragment.getChildFragmentManager();
m.checkNotNullExpressionValue(childFragmentManager, "fragment.childFragmentManager");
Fragment access$createAndConfigureExpressionFragment = WidgetChatInputAttachments.access$createAndConfigureExpressionFragment(widgetChatInputAttachments, childFragmentManager, WidgetChatInputAttachments.access$getFlexInputFragment$p(this.this$0).k());
if (access$createAndConfigureExpressionFragment != null) {
access$getFlexInputFragment$p.getChildFragmentManager().beginTransaction().replace(com.lytefast.flexinput.R.e.expression_tray_container, access$createAndConfigureExpressionFragment, access$createAndConfigureExpressionFragment.getClass().getSimpleName()).commit();
AppCompatImageButton appCompatImageButton = access$getFlexInputFragment$p.j().i;
m.checkNotNullExpressionValue(appCompatImageButton, "binding.expressionBtn");
appCompatImageButton.setVisibility(0);
}
}
}