package com.discord.widgets.chat.input; import android.content.ContentResolver; import android.content.Context; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.IdRes; import androidx.annotation.LayoutRes; import androidx.core.view.inputmethod.InputContentInfoCompat; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import c.a.i.j4; import c.a.k.b; import com.discord.app.AppFragment; import com.discord.widgets.chat.input.expression.WidgetExpressionTray; import com.google.android.material.button.MaterialButton; import com.lytefast.flexinput.FlexInputListener; import com.lytefast.flexinput.adapters.AttachmentPreviewAdapter; import com.lytefast.flexinput.adapters.EmptyListAdapter; import com.lytefast.flexinput.fragment.FilesFragment; import com.lytefast.flexinput.fragment.FlexInputFragment; import com.lytefast.flexinput.fragment.MediaFragment; import com.lytefast.flexinput.model.Attachment; import com.lytefast.flexinput.viewmodel.FlexInputViewModel; import d0.z.d.m; import java.util.Objects; /* compiled from: WidgetChatInputAttachments.kt */ public final class WidgetChatInputAttachments { private final FlexInputFragment flexInputFragment; /* compiled from: WidgetChatInputAttachments.kt */ public static final class DiscordFilesFragment extends FilesFragment { @Override // com.lytefast.flexinput.fragment.FilesFragment public EmptyListAdapter newPermissionsRequestAdapter(View.OnClickListener onClickListener) { m.checkNotNullParameter(onClickListener, "onClickListener"); return new PermissionsEmptyListAdapter(2131558929, 2131361874, onClickListener); } } /* compiled from: WidgetChatInputAttachments.kt */ public static final class DiscordMediaFragment extends MediaFragment { @Override // com.lytefast.flexinput.fragment.MediaFragment public EmptyListAdapter newPermissionsRequestAdapter(View.OnClickListener onClickListener) { m.checkNotNullParameter(onClickListener, "onClickListener"); return new PermissionsEmptyListAdapter(2131558929, 2131361874, onClickListener); } } /* compiled from: WidgetChatInputAttachments.kt */ public static final class PermissionsEmptyListAdapter extends EmptyListAdapter { /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public PermissionsEmptyListAdapter(@LayoutRes int i, @IdRes int i2, View.OnClickListener onClickListener) { super(i, i2, onClickListener); m.checkNotNullParameter(onClickListener, "onClickListener"); } @Override // com.lytefast.flexinput.adapters.EmptyListAdapter, androidx.recyclerview.widget.RecyclerView.Adapter public EmptyListAdapter.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) { m.checkNotNullParameter(viewGroup, "parent"); EmptyListAdapter.ViewHolder onCreateViewHolder = super.onCreateViewHolder(viewGroup, i); View view = onCreateViewHolder.itemView; int i2 = 2131361874; MaterialButton materialButton = (MaterialButton) view.findViewById(2131361874); if (materialButton != null) { i2 = 2131364301; TextView textView = (TextView) view.findViewById(2131364301); if (textView != null) { m.checkNotNullExpressionValue(new j4((LinearLayout) view, materialButton, textView), "WidgetChatInputPermReqFi…ing.bind(holder.itemView)"); m.checkNotNullExpressionValue(textView, "binding.permReqText"); b.m(textView, 2131894020, new Object[0], null, 4); return onCreateViewHolder; } } throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i2))); } } public WidgetChatInputAttachments(FlexInputFragment flexInputFragment) { m.checkNotNullParameter(flexInputFragment, "flexInputFragment"); this.flexInputFragment = flexInputFragment; } public static final /* synthetic */ Fragment access$createAndConfigureExpressionFragment(WidgetChatInputAttachments widgetChatInputAttachments, FragmentManager fragmentManager, TextView textView) { return widgetChatInputAttachments.createAndConfigureExpressionFragment(fragmentManager, textView); } public static final /* synthetic */ AttachmentPreviewAdapter access$createPreviewAdapter(WidgetChatInputAttachments widgetChatInputAttachments, Context context) { return widgetChatInputAttachments.createPreviewAdapter(context); } public static final /* synthetic */ FlexInputFragment access$getFlexInputFragment$p(WidgetChatInputAttachments widgetChatInputAttachments) { return widgetChatInputAttachments.flexInputFragment; } public static final /* synthetic */ void access$setAttachmentFromPicker(WidgetChatInputAttachments widgetChatInputAttachments, Context context, InputContentInfoCompat inputContentInfoCompat) { widgetChatInputAttachments.setAttachmentFromPicker(context, inputContentInfoCompat); } private final Fragment createAndConfigureExpressionFragment(FragmentManager fragmentManager, TextView textView) { WidgetChatInputAttachments$createAndConfigureExpressionFragment$emojiPickerListener$1 widgetChatInputAttachments$createAndConfigureExpressionFragment$emojiPickerListener$1 = new WidgetChatInputAttachments$createAndConfigureExpressionFragment$emojiPickerListener$1(this); WidgetChatInputAttachments$createAndConfigureExpressionFragment$stickerPickerListener$1 widgetChatInputAttachments$createAndConfigureExpressionFragment$stickerPickerListener$1 = new WidgetChatInputAttachments$createAndConfigureExpressionFragment$stickerPickerListener$1(this); WidgetChatInputAttachments$createAndConfigureExpressionFragment$onBackspacePressedListener$1 widgetChatInputAttachments$createAndConfigureExpressionFragment$onBackspacePressedListener$1 = new WidgetChatInputAttachments$createAndConfigureExpressionFragment$onBackspacePressedListener$1(textView); Fragment findFragmentById = fragmentManager.findFragmentById(2131363187); if (!(findFragmentById instanceof WidgetExpressionTray)) { findFragmentById = null; } WidgetExpressionTray widgetExpressionTray = (WidgetExpressionTray) findFragmentById; if (widgetExpressionTray == null) { widgetExpressionTray = new WidgetExpressionTray(); } widgetExpressionTray.setEmojiPickerListener(widgetChatInputAttachments$createAndConfigureExpressionFragment$emojiPickerListener$1); widgetExpressionTray.setStickerPickerListener(widgetChatInputAttachments$createAndConfigureExpressionFragment$stickerPickerListener$1); widgetExpressionTray.setOnBackspacePressedListener(widgetChatInputAttachments$createAndConfigureExpressionFragment$onBackspacePressedListener$1); widgetExpressionTray.setOnEmojiSearchOpenedListener(new WidgetChatInputAttachments$createAndConfigureExpressionFragment$1(this)); return widgetExpressionTray; } private final > AttachmentPreviewAdapter createPreviewAdapter(Context context) { return new AttachmentPreviewAdapter<>(new WidgetChatInputAttachments$createPreviewAdapter$1(this, context)); } private final void setAttachmentFromPicker(Context context, InputContentInfoCompat inputContentInfoCompat) { ContentResolver contentResolver = context.getContentResolver(); if (contentResolver != null) { this.flexInputFragment.f(new SourcedAttachment(Attachment.Companion.b(inputContentInfoCompat, contentResolver, true, b.g(context, 2131886727, new Object[0], null, 4).toString()), "keyboard")); } } public final void addExternalAttachment(Attachment attachment) { m.checkNotNullParameter(attachment, "attachment"); this.flexInputFragment.i(new WidgetChatInputAttachments$addExternalAttachment$1(this, attachment)); } public final void configureFlexInputFragment(AppFragment appFragment) { m.checkNotNullParameter(appFragment, "fragment"); this.flexInputFragment.i(new WidgetChatInputAttachments$configureFlexInputFragment$1(this, appFragment)); appFragment.setOnBackPressed(new WidgetChatInputAttachments$configureFlexInputFragment$2(this), 1); } public final void setInputListener(FlexInputListener flexInputListener) { m.checkNotNullParameter(flexInputListener, "inputListener"); FlexInputFragment flexInputFragment = this.flexInputFragment; Objects.requireNonNull(flexInputFragment); m.checkNotNullParameter(flexInputListener, "inputListener"); flexInputFragment.n = flexInputListener; } public final void setViewModel(FlexInputViewModel flexInputViewModel) { this.flexInputFragment.r = flexInputViewModel; } }