129 lines
6.2 KiB
Java
129 lines
6.2 KiB
Java
package com.discord.widgets.phone;
|
|
|
|
import android.content.Context;
|
|
import androidx.fragment.app.Fragment;
|
|
import androidx.fragment.app.FragmentManager;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import b.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.app.AppBottomSheet;
|
|
import com.discord.databinding.WidgetPhoneCountryCodeBottomSheetBinding;
|
|
import com.discord.models.phone.PhoneCountryCode;
|
|
import com.discord.stores.StorePhone;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.utilities.phone.PhoneUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegate;
|
|
import com.discord.utilities.viewbinding.FragmentViewBindingDelegateKt;
|
|
import com.google.android.material.textfield.TextInputLayout;
|
|
import d0.g0.w;
|
|
import d0.z.d.m;
|
|
import java.util.ArrayList;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
import kotlin.reflect.KProperty;
|
|
import rx.Observable;
|
|
import rx.subjects.BehaviorSubject;
|
|
/* compiled from: WidgetPhoneCountryCodeBottomSheet.kt */
|
|
/* loaded from: classes2.dex */
|
|
public final class WidgetPhoneCountryCodeBottomSheet extends AppBottomSheet {
|
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.b0(WidgetPhoneCountryCodeBottomSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetPhoneCountryCodeBottomSheetBinding;", 0)};
|
|
public static final Companion Companion = new Companion(null);
|
|
private final BehaviorSubject<String> nameFilterSubject;
|
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetPhoneCountryCodeBottomSheet$binding$2.INSTANCE, null, 2, null);
|
|
private final PhoneCountryCodeAdapter adapter = new PhoneCountryCodeAdapter();
|
|
|
|
/* compiled from: WidgetPhoneCountryCodeBottomSheet.kt */
|
|
/* loaded from: classes2.dex */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
|
|
public final void show(FragmentManager fragmentManager) {
|
|
m.checkNotNullParameter(fragmentManager, "context");
|
|
new WidgetPhoneCountryCodeBottomSheet().show(fragmentManager, WidgetPhoneCountryCodeBottomSheet.class.getName());
|
|
}
|
|
}
|
|
|
|
public WidgetPhoneCountryCodeBottomSheet() {
|
|
super(false, 1, null);
|
|
BehaviorSubject<String> l0 = BehaviorSubject.l0("");
|
|
m.checkNotNullExpressionValue(l0, "BehaviorSubject.create(\"\")");
|
|
this.nameFilterSubject = l0;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$configureUI(WidgetPhoneCountryCodeBottomSheet widgetPhoneCountryCodeBottomSheet, String str) {
|
|
widgetPhoneCountryCodeBottomSheet.configureUI(str);
|
|
}
|
|
|
|
public static final /* synthetic */ BehaviorSubject access$getNameFilterSubject$p(WidgetPhoneCountryCodeBottomSheet widgetPhoneCountryCodeBottomSheet) {
|
|
return widgetPhoneCountryCodeBottomSheet.nameFilterSubject;
|
|
}
|
|
|
|
/* JADX WARN: Code restructure failed: missing block: B:8:0x003f, code lost:
|
|
if (d0.g0.w.contains((java.lang.CharSequence) r6.getTranslatedStringForCountry(r5, r8), (java.lang.CharSequence) r11, true) != false) goto L_0x0041;
|
|
*/
|
|
/*
|
|
Code decompiled incorrectly, please refer to instructions dump.
|
|
*/
|
|
private final void configureUI(String str) {
|
|
StorePhone phone = StoreStream.Companion.getPhone();
|
|
List<PhoneCountryCode> countryCodes = phone.getCountryCodes();
|
|
ArrayList arrayList = new ArrayList();
|
|
Iterator<T> it = countryCodes.iterator();
|
|
while (true) {
|
|
boolean z2 = false;
|
|
if (it.hasNext()) {
|
|
Object next = it.next();
|
|
PhoneCountryCode phoneCountryCode = (PhoneCountryCode) next;
|
|
if (!w.contains((CharSequence) phoneCountryCode.getName(), (CharSequence) str, true)) {
|
|
PhoneUtils phoneUtils = PhoneUtils.INSTANCE;
|
|
Context requireContext = requireContext();
|
|
m.checkNotNullExpressionValue(requireContext, "requireContext()");
|
|
}
|
|
z2 = true;
|
|
if (z2) {
|
|
arrayList.add(next);
|
|
}
|
|
} else {
|
|
getBinding().f2495b.setHasFixedSize(false);
|
|
RecyclerView recyclerView = getBinding().f2495b;
|
|
m.checkNotNullExpressionValue(recyclerView, "binding.phoneCountryCodeRecycler");
|
|
recyclerView.setAdapter(this.adapter);
|
|
this.adapter.configure(arrayList, new WidgetPhoneCountryCodeBottomSheet$configureUI$1(this, phone));
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
private final WidgetPhoneCountryCodeBottomSheetBinding getBinding() {
|
|
return (WidgetPhoneCountryCodeBottomSheetBinding) this.binding$delegate.getValue((Fragment) this, $$delegatedProperties[0]);
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet
|
|
public int getContentViewResId() {
|
|
return R.layout.widget_phone_country_code_bottom_sheet;
|
|
}
|
|
|
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
|
public void onResume() {
|
|
super.onResume();
|
|
TextInputLayout textInputLayout = getBinding().c;
|
|
m.checkNotNullExpressionValue(textInputLayout, "binding.phoneCountryCodeSearch");
|
|
ViewExtensions.addBindedTextWatcher(textInputLayout, this, new WidgetPhoneCountryCodeBottomSheet$onResume$1(this));
|
|
Observable<String> p = this.nameFilterSubject.p(200L, TimeUnit.MILLISECONDS);
|
|
m.checkNotNullExpressionValue(p, "nameFilterSubject.deboun…0, TimeUnit.MILLISECONDS)");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(p, this, null, 2, null), WidgetPhoneCountryCodeBottomSheet.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetPhoneCountryCodeBottomSheet$onResume$2(this), 62, (Object) null);
|
|
configureUI("");
|
|
}
|
|
}
|