124 lines
6 KiB
Java
124 lines
6 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 c.d.b.a.a;
|
||
|
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 */
|
||
|
public final class WidgetPhoneCountryCodeBottomSheet extends AppBottomSheet {
|
||
|
public static final /* synthetic */ KProperty[] $$delegatedProperties = {a.V(WidgetPhoneCountryCodeBottomSheet.class, "binding", "getBinding()Lcom/discord/databinding/WidgetPhoneCountryCodeBottomSheetBinding;", 0)};
|
||
|
public static final Companion Companion = new Companion(null);
|
||
|
private final PhoneCountryCodeAdapter adapter;
|
||
|
private final FragmentViewBindingDelegate binding$delegate = FragmentViewBindingDelegateKt.viewBinding$default(this, WidgetPhoneCountryCodeBottomSheet$binding$2.INSTANCE, null, 2, null);
|
||
|
private final BehaviorSubject<String> nameFilterSubject;
|
||
|
|
||
|
/* compiled from: WidgetPhoneCountryCodeBottomSheet.kt */
|
||
|
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;
|
||
|
this.adapter = new PhoneCountryCodeAdapter();
|
||
|
}
|
||
|
|
||
|
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 WARNING: Code restructure failed: missing block: B:6:0x003f, code lost:
|
||
|
if (d0.g0.w.contains((java.lang.CharSequence) r6.getTranslatedStringForCountry(r5, r8), (java.lang.CharSequence) r11, true) != false) goto L_0x0041;
|
||
|
*/
|
||
|
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().b.setHasFixedSize(false);
|
||
|
RecyclerView recyclerView = getBinding().b;
|
||
|
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 2131559133;
|
||
|
}
|
||
|
|
||
|
@Override // com.discord.app.AppBottomSheet, androidx.fragment.app.Fragment
|
||
|
public void onResume() {
|
||
|
super.onResume();
|
||
|
TextInputLayout textInputLayout = getBinding().f1863c;
|
||
|
m.checkNotNullExpressionValue(textInputLayout, "binding.phoneCountryCodeSearch");
|
||
|
ViewExtensions.addBindedTextWatcher(textInputLayout, this, new WidgetPhoneCountryCodeBottomSheet$onResume$1(this));
|
||
|
Observable<String> o = this.nameFilterSubject.o(200, TimeUnit.MILLISECONDS);
|
||
|
m.checkNotNullExpressionValue(o, "nameFilterSubject.deboun…0, TimeUnit.MILLISECONDS)");
|
||
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(o, 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("");
|
||
|
}
|
||
|
}
|