2021-06-27 20:44:35 +00:00
|
|
|
package c.a.a;
|
|
|
|
|
2021-08-10 21:50:53 +00:00
|
|
|
import android.os.Bundle;
|
|
|
|
import android.view.LayoutInflater;
|
2021-06-27 20:44:35 +00:00
|
|
|
import android.view.View;
|
2021-08-10 21:50:53 +00:00
|
|
|
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.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 java.util.Objects;
|
2021-06-27 20:44:35 +00:00
|
|
|
import kotlin.Unit;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
2021-08-10 21:50:53 +00:00
|
|
|
import kotlin.jvm.functions.Function2;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
import kotlin.reflect.KProperty;
|
2021-06-27 20:44:35 +00:00
|
|
|
/* compiled from: SelectorDialog.kt */
|
2021-08-10 21:50:53 +00:00
|
|
|
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);
|
2021-06-27 20:44:35 +00:00
|
|
|
|
2021-08-10 21:50:53 +00:00
|
|
|
/* 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 c.a.j.m a;
|
|
|
|
public final /* synthetic */ n b;
|
|
|
|
|
|
|
|
/* JADX WARNING: Illegal instructions before constructor call */
|
|
|
|
public b(n nVar, c.a.j.m mVar) {
|
|
|
|
super(r2);
|
|
|
|
m.checkNotNullParameter(mVar, "binding");
|
|
|
|
this.b = nVar;
|
|
|
|
TextView textView = mVar.a;
|
|
|
|
m.checkNotNullExpressionValue(textView, "binding.root");
|
|
|
|
this.a = mVar;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 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");
|
|
|
|
View inflate = layoutInflater2.inflate(R.layout.dialog_simple_selector_item, viewGroup2, false);
|
|
|
|
Objects.requireNonNull(inflate, "rootView");
|
|
|
|
c.a.j.m mVar = new c.a.j.m((TextView) inflate);
|
|
|
|
m.checkNotNullExpressionValue(mVar, "DialogSimpleSelectorItem…(inflater, parent, false)");
|
|
|
|
return new b(this.this$0, mVar);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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();
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
|
2021-08-10 21:50:53 +00:00
|
|
|
@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().f120c;
|
|
|
|
m.checkNotNullExpressionValue(maxHeightRecyclerView, "binding.dialogSelections");
|
|
|
|
maxHeightRecyclerView.setAdapter(new SimpleRecyclerAdapter(j.asList(charSequenceArray), new e(this)));
|
|
|
|
MaxHeightRecyclerView maxHeightRecyclerView2 = g().f120c;
|
|
|
|
RecyclerView.Adapter adapter = maxHeightRecyclerView2.getAdapter();
|
|
|
|
if (adapter != null) {
|
|
|
|
adapter.notifyDataSetChanged();
|
|
|
|
}
|
|
|
|
maxHeightRecyclerView2.setHasFixedSize(false);
|
|
|
|
maxHeightRecyclerView2.setNestedScrollingEnabled(false);
|
|
|
|
SimpleRecyclerAdapter.Companion companion = SimpleRecyclerAdapter.Companion;
|
|
|
|
MaxHeightRecyclerView maxHeightRecyclerView3 = g().f120c;
|
|
|
|
m.checkNotNullExpressionValue(maxHeightRecyclerView3, "binding.dialogSelections");
|
|
|
|
companion.addThemedDivider(maxHeightRecyclerView3);
|
2021-06-27 20:44:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|