discord-jadx/app/src/main/java/c/a/y/b0.java

232 lines
11 KiB
Java

package c.a.y;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.core.os.BundleKt;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.recyclerview.widget.RecyclerView;
import c.a.i.d;
import com.discord.R;
import com.discord.app.AppBottomSheet;
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.facebook.drawee.view.SimpleDraweeView;
import com.google.android.material.textview.MaterialTextView;
import d0.z.d.a0;
import d0.z.d.k;
import d0.z.d.m;
import d0.z.d.o;
import java.io.Serializable;
import java.util.List;
import kotlin.Unit;
import kotlin.jvm.functions.Function1;
import kotlin.jvm.functions.Function2;
import kotlin.jvm.internal.DefaultConstructorMarker;
import kotlin.reflect.KProperty;
/* compiled from: SelectorBottomSheet.kt */
public final class b0 extends AppBottomSheet implements i {
public static final /* synthetic */ KProperty[] i = {c.d.b.a.a.a0(b0.class, "binding", "getBinding()Lcom/discord/databinding/BottomSheetSimpleSelectorBinding;", 0)};
public static final a j = new a(null);
public Function1<? super Integer, Unit> k;
public final FragmentViewBindingDelegate l = FragmentViewBindingDelegateKt.viewBinding$default(this, b.i, null, 2, null);
/* compiled from: SelectorBottomSheet.kt */
public static final class a {
/* compiled from: SelectorBottomSheet.kt */
/* renamed from: c.a.y.b0$a$a reason: collision with other inner class name */
public static final class C0050a extends o implements Function1<Integer, Unit> {
public static final C0050a i = new C0050a();
public C0050a() {
super(1);
}
/* 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 Unit invoke(Integer num) {
num.intValue();
return Unit.a;
}
}
public a(DefaultConstructorMarker defaultConstructorMarker) {
}
/* JADX DEBUG: Multi-variable search result rejected for r6v0, resolved type: c.a.y.b0$a */
/* JADX WARN: Multi-variable type inference failed */
public static /* synthetic */ b0 b(a aVar, FragmentManager fragmentManager, String str, List list, boolean z2, Function1 function1, int i) {
boolean z3 = (i & 8) != 0 ? true : z2;
if ((i & 16) != 0) {
function1 = C0050a.i;
}
return aVar.a(fragmentManager, str, list, z3, function1);
}
public final b0 a(FragmentManager fragmentManager, String str, List<c0> list, boolean z2, Function1<? super Integer, Unit> function1) {
m.checkNotNullParameter(fragmentManager, "fragmentManager");
m.checkNotNullParameter(str, "title");
m.checkNotNullParameter(list, "options");
m.checkNotNullParameter(function1, "onSelectedListener");
b0 b0Var = new b0();
b0Var.setArguments(BundleKt.bundleOf(d0.o.to("simple_bottom_sheet_title", str), d0.o.to("simple_bottom_sheet_options", list), d0.o.to("simple_bottom_sheet_show_dividers", Boolean.valueOf(z2))));
b0Var.k = function1;
b0Var.show(fragmentManager, a0.getOrCreateKotlinClass(b0.class).toString());
return b0Var;
}
}
/* compiled from: SelectorBottomSheet.kt */
public static final /* synthetic */ class b extends k implements Function1<View, c.a.i.c> {
public static final b i = new b();
public b() {
super(1, c.a.i.c.class, "bind", "bind(Landroid/view/View;)Lcom/discord/databinding/BottomSheetSimpleSelectorBinding;", 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 c.a.i.c invoke(View view) {
View view2 = view;
m.checkNotNullParameter(view2, "p1");
int i2 = R.id.widget_simple_bottom_sheet_selector_header;
ConstraintLayout constraintLayout = (ConstraintLayout) view2.findViewById(R.id.widget_simple_bottom_sheet_selector_header);
if (constraintLayout != null) {
i2 = R.id.widget_simple_bottom_sheet_selector_placeholder;
TextView textView = (TextView) view2.findViewById(R.id.widget_simple_bottom_sheet_selector_placeholder);
if (textView != null) {
i2 = R.id.widget_simple_bottom_sheet_selector_recycler;
MaxHeightRecyclerView maxHeightRecyclerView = (MaxHeightRecyclerView) view2.findViewById(R.id.widget_simple_bottom_sheet_selector_recycler);
if (maxHeightRecyclerView != null) {
return new c.a.i.c((ConstraintLayout) view2, constraintLayout, textView, maxHeightRecyclerView);
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view2.getResources().getResourceName(i2)));
}
}
/* compiled from: SelectorBottomSheet.kt */
public static final class c extends o implements Function2<LayoutInflater, ViewGroup, e0> {
public final /* synthetic */ b0 this$0;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public c(b0 b0Var) {
super(2);
this.this$0 = b0Var;
}
/* 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 e0 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.bottom_sheet_simple_selector_item, viewGroup2, false);
int i = R.id.select_component_sheet_item_description;
MaterialTextView materialTextView = (MaterialTextView) inflate.findViewById(R.id.select_component_sheet_item_description);
if (materialTextView != null) {
i = R.id.select_component_sheet_item_icon;
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate.findViewById(R.id.select_component_sheet_item_icon);
if (simpleDraweeView != null) {
i = R.id.select_component_sheet_item_title;
MaterialTextView materialTextView2 = (MaterialTextView) inflate.findViewById(R.id.select_component_sheet_item_title);
if (materialTextView2 != null) {
d dVar = new d((ConstraintLayout) inflate, materialTextView, simpleDraweeView, materialTextView2);
m.checkNotNullExpressionValue(dVar, "BottomSheetSimpleSelecto…(inflater, parent, false)");
b0 b0Var = this.this$0;
Dialog requireDialog = b0Var.requireDialog();
m.checkNotNullExpressionValue(requireDialog, "requireDialog()");
return new e0(b0Var, requireDialog, dVar);
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
}
public b0() {
super(false, 1, null);
}
@Override // c.a.y.i
public void c(int i2) {
Function1<? super Integer, Unit> function1 = this.k;
if (function1 != null) {
function1.invoke(Integer.valueOf(i2));
}
}
public final c.a.i.c g() {
return (c.a.i.c) this.l.getValue((Fragment) this, i[0]);
}
@Override // com.discord.app.AppBottomSheet
public int getContentViewResId() {
return R.layout.bottom_sheet_simple_selector;
}
@Override // androidx.fragment.app.DialogFragment, android.content.DialogInterface.OnDismissListener
public void onDismiss(DialogInterface dialogInterface) {
m.checkNotNullParameter(dialogInterface, "dialog");
super.onDismiss(dialogInterface);
this.k = null;
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onPause() {
super.onPause();
dismiss();
}
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
m.checkNotNullParameter(view, "view");
super.onViewCreated(view, bundle);
setBottomSheetCollapsedStateDisabled();
String string = getArgumentsOrDefault().getString("simple_bottom_sheet_title");
Serializable serializable = getArgumentsOrDefault().getSerializable("simple_bottom_sheet_options");
if (!(serializable instanceof List)) {
serializable = null;
}
List list = (List) serializable;
boolean z2 = getArgumentsOrDefault().getBoolean("simple_bottom_sheet_show_dividers");
TextView textView = g().f75c;
m.checkNotNullExpressionValue(textView, "binding.widgetSimpleBottomSheetSelectorPlaceholder");
textView.setText(string);
ConstraintLayout constraintLayout = g().b;
m.checkNotNullExpressionValue(constraintLayout, "binding.widgetSimpleBottomSheetSelectorHeader");
int i2 = 0;
if (!(!(string == null || string.length() == 0))) {
i2 = 8;
}
constraintLayout.setVisibility(i2);
if (list != null) {
MaxHeightRecyclerView maxHeightRecyclerView = g().d;
m.checkNotNullExpressionValue(maxHeightRecyclerView, "binding.widgetSimpleBottomSheetSelectorRecycler");
maxHeightRecyclerView.setAdapter(new SimpleRecyclerAdapter(list, new c(this)));
MaxHeightRecyclerView maxHeightRecyclerView2 = g().d;
RecyclerView.Adapter adapter = maxHeightRecyclerView2.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
if (z2) {
SimpleRecyclerAdapter.Companion.addThemedDivider(maxHeightRecyclerView2);
}
}
}
}