package c.a.a; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.TextView; import androidx.fragment.app.Fragment; import androidx.fragment.app.FragmentManager; import androidx.recyclerview.widget.RecyclerView; import c.a.i.l; import com.discord.app.AppDialog; import com.discord.utilities.view.recycler.MaxHeightRecyclerView; import com.discord.utilities.viewbinding.FragmentViewBindingDelegate; import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt; import com.discord.utilities.views.SimpleRecyclerAdapter; import com.google.android.material.button.MaterialButton; import d0.t.j; import d0.z.d.a0; import d0.z.d.k; import d0.z.d.o; import java.util.Objects; import kotlin.Unit; import kotlin.jvm.functions.Function1; import kotlin.jvm.functions.Function2; import kotlin.jvm.internal.DefaultConstructorMarker; import kotlin.reflect.KProperty; /* compiled from: SelectorDialog.kt */ public final class m extends AppDialog { public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.V(m.class, "binding", "getBinding()Lcom/discord/databinding/DialogSimpleSelectorBinding;", 0)}; public static final a j = new a(null); public Function1 k; public final FragmentViewBindingDelegate l = FragmentViewBindingDelegateKt.viewBinding$default(this, c.i, null, 2, null); /* compiled from: SelectorDialog.kt */ public static final class a { public a(DefaultConstructorMarker defaultConstructorMarker) { } public final m a(FragmentManager fragmentManager, CharSequence charSequence, CharSequence[] charSequenceArr, Function1 function1) { d0.z.d.m.checkNotNullParameter(fragmentManager, "fragmentManager"); d0.z.d.m.checkNotNullParameter(charSequence, "title"); d0.z.d.m.checkNotNullParameter(charSequenceArr, "options"); d0.z.d.m.checkNotNullParameter(function1, "onSelectedListener"); m mVar = new m(); Bundle bundle = new Bundle(); bundle.putCharSequence("INTENT_DIALOG_TITLE", charSequence); bundle.putCharSequenceArray("INTENT_DIALOG_OPTIONS", charSequenceArr); mVar.setArguments(bundle); mVar.k = function1; mVar.show(fragmentManager, a0.getOrCreateKotlinClass(m.class).toString()); return mVar; } } /* compiled from: SelectorDialog.kt */ public final class b extends SimpleRecyclerAdapter.ViewHolder { public final c.a.i.m a; public final /* synthetic */ m b; /* JADX WARNING: Illegal instructions before constructor call */ public b(m mVar, c.a.i.m mVar2) { super(r2); d0.z.d.m.checkNotNullParameter(mVar2, "binding"); this.b = mVar; TextView textView = mVar2.a; d0.z.d.m.checkNotNullExpressionValue(textView, "binding.root"); this.a = mVar2; } /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // com.discord.utilities.views.SimpleRecyclerAdapter.ViewHolder public void bind(CharSequence charSequence) { CharSequence charSequence2 = charSequence; d0.z.d.m.checkNotNullParameter(charSequence2, "data"); TextView textView = this.a.a; d0.z.d.m.checkNotNullExpressionValue(textView, "binding.root"); textView.setText(charSequence2); this.a.a.setOnClickListener(new n(this)); } } /* compiled from: SelectorDialog.kt */ public static final /* synthetic */ class c extends k implements Function1 { public static final c i = new c(); public c() { super(1, l.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/DialogSimpleSelectorBinding;", 0); } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */ @Override // kotlin.jvm.functions.Function1 public l invoke(View view) { View view2 = view; d0.z.d.m.checkNotNullParameter(view2, "p1"); int i2 = 2131362900; MaterialButton materialButton = (MaterialButton) view2.findViewById(2131362900); if (materialButton != null) { i2 = 2131362924; MaxHeightRecyclerView maxHeightRecyclerView = (MaxHeightRecyclerView) view2.findViewById(2131362924); if (maxHeightRecyclerView != null) { i2 = 2131362925; TextView textView = (TextView) view2.findViewById(2131362925); if (textView != null) { return new l((LinearLayout) view2, materialButton, maxHeightRecyclerView, textView); } } } throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2))); } } /* compiled from: SelectorDialog.kt */ public static final class d implements View.OnClickListener { public final /* synthetic */ m i; public d(m mVar) { this.i = mVar; } @Override // android.view.View.OnClickListener public final void onClick(View view) { this.i.dismiss(); } } /* compiled from: SelectorDialog.kt */ public static final class e extends o implements Function2 { public final /* synthetic */ m this$0; /* JADX INFO: super call moved to the top of the method (can break code semantics) */ public e(m mVar) { super(2); this.this$0 = mVar; } /* Return type fixed from 'java.lang.Object' to match base method */ /* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object, java.lang.Object] */ @Override // kotlin.jvm.functions.Function2 public b invoke(LayoutInflater layoutInflater, ViewGroup viewGroup) { LayoutInflater layoutInflater2 = layoutInflater; ViewGroup viewGroup2 = viewGroup; d0.z.d.m.checkNotNullParameter(layoutInflater2, "inflater"); d0.z.d.m.checkNotNullParameter(viewGroup2, "parent"); View inflate = layoutInflater2.inflate(2131558480, viewGroup2, false); Objects.requireNonNull(inflate, "rootView"); c.a.i.m mVar = new c.a.i.m((TextView) inflate); d0.z.d.m.checkNotNullExpressionValue(mVar, "DialogSimpleSelectorItem…(inflater, parent, false)"); return new b(this.this$0, mVar); } } public m() { super(2131558479); } public final l g() { return (l) this.l.getValue((Fragment) this, i[0]); } @Override // com.discord.app.AppDialog, androidx.fragment.app.Fragment public void onPause() { super.onPause(); dismiss(); } @Override // com.discord.app.AppDialog public void onViewBound(View view) { d0.z.d.m.checkNotNullParameter(view, "view"); super.onViewBound(view); TextView textView = g().d; d0.z.d.m.checkNotNullExpressionValue(textView, "binding.dialogTitle"); textView.setText(getArgumentsOrDefault().getCharSequence("INTENT_DIALOG_TITLE", null)); g().b.setOnClickListener(new d(this)); CharSequence[] charSequenceArray = getArgumentsOrDefault().getCharSequenceArray("INTENT_DIALOG_OPTIONS"); if (charSequenceArray != null) { MaxHeightRecyclerView maxHeightRecyclerView = g().f119c; d0.z.d.m.checkNotNullExpressionValue(maxHeightRecyclerView, "binding.dialogSelections"); maxHeightRecyclerView.setAdapter(new SimpleRecyclerAdapter(j.asList(charSequenceArray), new e(this))); MaxHeightRecyclerView maxHeightRecyclerView2 = g().f119c; RecyclerView.Adapter adapter = maxHeightRecyclerView2.getAdapter(); if (adapter != null) { adapter.notifyDataSetChanged(); } maxHeightRecyclerView2.setHasFixedSize(false); maxHeightRecyclerView2.setNestedScrollingEnabled(false); SimpleRecyclerAdapter.Companion companion = SimpleRecyclerAdapter.Companion; MaxHeightRecyclerView maxHeightRecyclerView3 = g().f119c; d0.z.d.m.checkNotNullExpressionValue(maxHeightRecyclerView3, "binding.dialogSelections"); companion.addThemedDivider(maxHeightRecyclerView3); } } }