discord-jadx/app/src/main/java/c/a/a/n.java

196 lines
8.7 KiB
Java

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.j.l;
import com.discord.R;
import com.discord.app.AppDialog;
import com.discord.databinding.DialogSimpleSelectorItemBinding;
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.m;
import d0.z.d.o;
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 n extends AppDialog {
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.V(n.class, "binding", "getBinding()Lcom/discord/databinding/DialogSimpleSelectorBinding;", 0)};
public static final a j = new a(null);
public Function1<? super Integer, Unit> 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 n a(FragmentManager fragmentManager, CharSequence charSequence, CharSequence[] charSequenceArr, Function1<? super Integer, Unit> function1) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(charSequence, "title");
m.checkNotNullParameter(charSequenceArr, "options");
m.checkNotNullParameter(function1, "onSelectedListener");
n nVar = new n();
Bundle bundle = new Bundle();
bundle.putCharSequence("INTENT_DIALOG_TITLE", charSequence);
bundle.putCharSequenceArray("INTENT_DIALOG_OPTIONS", charSequenceArr);
nVar.setArguments(bundle);
nVar.k = function1;
nVar.show(fragmentManager, a0.getOrCreateKotlinClass(n.class).toString());
return nVar;
}
}
/* compiled from: SelectorDialog.kt */
public final class b extends SimpleRecyclerAdapter.ViewHolder<CharSequence> {
public final DialogSimpleSelectorItemBinding a;
public final /* synthetic */ n b;
/* JADX WARNING: Illegal instructions before constructor call */
public b(n nVar, DialogSimpleSelectorItemBinding dialogSimpleSelectorItemBinding) {
super(r2);
m.checkNotNullParameter(dialogSimpleSelectorItemBinding, "binding");
this.b = nVar;
TextView textView = dialogSimpleSelectorItemBinding.a;
m.checkNotNullExpressionValue(textView, "binding.root");
this.a = dialogSimpleSelectorItemBinding;
}
/* 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;
m.checkNotNullParameter(charSequence2, "data");
TextView textView = this.a.a;
m.checkNotNullExpressionValue(textView, "binding.root");
textView.setText(charSequence2);
this.a.a.setOnClickListener(new o(this));
}
}
/* compiled from: SelectorDialog.kt */
public static final /* synthetic */ class c extends k implements Function1<View, l> {
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;
m.checkNotNullParameter(view2, "p1");
int i2 = R.id.dialog_cancel;
MaterialButton materialButton = (MaterialButton) view2.findViewById(R.id.dialog_cancel);
if (materialButton != null) {
i2 = R.id.dialog_selections;
MaxHeightRecyclerView maxHeightRecyclerView = (MaxHeightRecyclerView) view2.findViewById(R.id.dialog_selections);
if (maxHeightRecyclerView != null) {
i2 = R.id.dialog_title;
TextView textView = (TextView) view2.findViewById(R.id.dialog_title);
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 */ n i;
public d(n nVar) {
this.i = nVar;
}
@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<LayoutInflater, ViewGroup, b> {
public final /* synthetic */ n this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public e(n nVar) {
super(2);
this.this$0 = nVar;
}
/* 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;
m.checkNotNullParameter(layoutInflater2, "inflater");
m.checkNotNullParameter(viewGroup2, "parent");
DialogSimpleSelectorItemBinding a = DialogSimpleSelectorItemBinding.a(layoutInflater2, viewGroup2, false);
m.checkNotNullExpressionValue(a, "DialogSimpleSelectorItem…(inflater, parent, false)");
return new b(this.this$0, a);
}
}
public n() {
super(R.layout.dialog_simple_selector);
}
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) {
m.checkNotNullParameter(view, "view");
super.onViewBound(view);
TextView textView = g().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().f121c;
m.checkNotNullExpressionValue(maxHeightRecyclerView, "binding.dialogSelections");
maxHeightRecyclerView.setAdapter(new SimpleRecyclerAdapter(j.asList(charSequenceArray), new e(this)));
MaxHeightRecyclerView maxHeightRecyclerView2 = g().f121c;
RecyclerView.Adapter adapter = maxHeightRecyclerView2.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
maxHeightRecyclerView2.setHasFixedSize(false);
maxHeightRecyclerView2.setNestedScrollingEnabled(false);
SimpleRecyclerAdapter.Companion companion = SimpleRecyclerAdapter.Companion;
MaxHeightRecyclerView maxHeightRecyclerView3 = g().f121c;
m.checkNotNullExpressionValue(maxHeightRecyclerView3, "binding.dialogSelections");
companion.addThemedDivider(maxHeightRecyclerView3);
}
}
}