351 lines
13 KiB
Java
351 lines
13 KiB
Java
package com.scb.phone.view.fragment.address;
|
|
|
|
import android.content.Context;
|
|
import android.os.Bundle;
|
|
import android.text.Editable;
|
|
import android.text.TextUtils;
|
|
import android.text.TextWatcher;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.EditText;
|
|
import android.widget.ImageButton;
|
|
import android.widget.TextView;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import butterknife.BindView;
|
|
import butterknife.ButterKnife;
|
|
import butterknife.OnClick;
|
|
import com.scb.phone.R;
|
|
import com.scb.phone.view.adapter.address.SubDistrictSearchAdapter;
|
|
import com.scb.phone.view.fragment.BaseFragment;
|
|
import com.scb.phone.view.fragment.address.AddressSearchFragment;
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.concurrent.TimeUnit;
|
|
import o.C0398Fr;
|
|
import o.C0406Fx;
|
|
import o.C13389fZA;
|
|
import o.C13417fZt;
|
|
import o.C2550agi;
|
|
import o.InterfaceC13193fTg;
|
|
import o.InterfaceC13391fZD;
|
|
import o.InterfaceC9022dbq;
|
|
import o.InterfaceC9028dbw;
|
|
import o.PRA;
|
|
import o.VPK;
|
|
import o.YM;
|
|
import o.ZI;
|
|
import o.fRR;
|
|
import o.fSJ;
|
|
import o.fSQ;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class AddressSearchFragment extends Hilt_AddressSearchFragment implements InterfaceC9022dbq.RVV, SubDistrictSearchAdapter.RVV {
|
|
public C0398Fr c;
|
|
protected SubDistrictSearchAdapter d;
|
|
public ArrayList<C0406Fx> h;
|
|
private InterfaceC9028dbw i;
|
|
private fSJ j;
|
|
|
|
@InterfaceC13391fZD
|
|
public C2550agi presenter;
|
|
|
|
@BindView
|
|
protected RecyclerView recyclerViewAddress;
|
|
|
|
@BindView
|
|
protected ImageButton searchClearButton;
|
|
|
|
@BindView
|
|
protected EditText searchEditText;
|
|
|
|
@BindView
|
|
protected TextView tvAddressLabel;
|
|
|
|
public static AddressSearchFragment b(C0398Fr c0398Fr) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putParcelable("ADDRESS_SEARCH_DISPLAY", c0398Fr);
|
|
AddressSearchFragment addressSearchFragment = new AddressSearchFragment();
|
|
addressSearchFragment.setArguments(bundle);
|
|
return addressSearchFragment;
|
|
}
|
|
|
|
public static AddressSearchFragment e(C0398Fr c0398Fr, Throwable th) {
|
|
Bundle bundle = new Bundle();
|
|
bundle.putParcelable("ADDRESS_SEARCH_DISPLAY", c0398Fr);
|
|
bundle.putSerializable("KEY_THROWABLE", th);
|
|
AddressSearchFragment addressSearchFragment = new AddressSearchFragment();
|
|
addressSearchFragment.setArguments(bundle);
|
|
return addressSearchFragment;
|
|
}
|
|
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
@Override // com.scb.phone.view.fragment.address.Hilt_AddressSearchFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
|
|
public void onAttach(Context context) {
|
|
super.onAttach(context);
|
|
if (context instanceof InterfaceC9028dbw) {
|
|
this.i = (InterfaceC9028dbw) context;
|
|
}
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public void onDetach() {
|
|
super.onDetach();
|
|
this.i = null;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
|
|
View inflate = layoutInflater.inflate(R.layout.2131559903, viewGroup, false);
|
|
((BaseFragment) this).a = ButterKnife.c(this, inflate);
|
|
this.presenter.e((C2550agi) this);
|
|
if (getArguments() != null) {
|
|
C0398Fr c0398Fr = (C0398Fr) getArguments().getParcelable("ADDRESS_SEARCH_DISPLAY");
|
|
this.c = c0398Fr;
|
|
this.tvAddressLabel.setText(c0398Fr.e);
|
|
this.searchEditText.setHint(this.c.c);
|
|
ArrayList<C0406Fx> arrayList = new ArrayList<>();
|
|
this.h = arrayList;
|
|
arrayList.addAll(this.c.b);
|
|
SubDistrictSearchAdapter subDistrictSearchAdapter = new SubDistrictSearchAdapter(this.h, this.c.d);
|
|
this.d = subDistrictSearchAdapter;
|
|
subDistrictSearchAdapter.d = this;
|
|
this.recyclerViewAddress.d(new VPK(requireContext()), -1);
|
|
this.recyclerViewAddress.setAdapter(this.d);
|
|
Sts sts = new Sts(this);
|
|
EditText editText = this.searchEditText;
|
|
C13389fZA d = C13389fZA.d();
|
|
editText.addTextChangedListener(new TextWatcher(sts, d) { // from class: com.scb.phone.view.fragment.address.AddressSearchFragment.Sts.1
|
|
private Sts a;
|
|
private C13389fZA b;
|
|
|
|
@Override // android.text.TextWatcher
|
|
public final void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
}
|
|
|
|
{
|
|
this.a = sts;
|
|
this.b = d;
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public final void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
this.b.onNext(charSequence.toString());
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public final void afterTextChanged(Editable editable) {
|
|
if (TextUtils.isEmpty(editable.toString())) {
|
|
this.a.c.searchClearButton.setVisibility(8);
|
|
SubDistrictSearchAdapter subDistrictSearchAdapter2 = this.a.c.d;
|
|
List<C0406Fx> list = this.a.c.c.b;
|
|
subDistrictSearchAdapter2.b.clear();
|
|
subDistrictSearchAdapter2.b.addAll(list);
|
|
subDistrictSearchAdapter2.notifyDataSetChanged();
|
|
return;
|
|
}
|
|
this.a.c.searchClearButton.setVisibility(0);
|
|
}
|
|
});
|
|
this.j = d.debounce(500L, TimeUnit.MILLISECONDS).filter(new InterfaceC13193fTg() { // from class: o.eGT
|
|
@Override // o.InterfaceC13193fTg
|
|
public final boolean a(Object obj) {
|
|
return AddressSearchFragment.c((String) obj);
|
|
}
|
|
}).subscribeOn(C13417fZt.c()).observeOn(fRR.e()).subscribe(new fSQ(this) { // from class: o.eGU
|
|
private AddressSearchFragment d;
|
|
|
|
@Override // o.fSQ
|
|
public final void c(Object obj) {
|
|
AddressSearchFragment addressSearchFragment = this.d;
|
|
ArrayList<C0406Fx> arrayList2 = new ArrayList<>();
|
|
addressSearchFragment.h = arrayList2;
|
|
arrayList2.addAll(addressSearchFragment.c.b);
|
|
C2550agi c2550agi = addressSearchFragment.presenter;
|
|
ArrayList<C0406Fx> arrayList3 = addressSearchFragment.h;
|
|
YM ym = addressSearchFragment.c.d;
|
|
List arrayList4 = new ArrayList();
|
|
String lowerCase = ((String) obj).toLowerCase();
|
|
int i = C2550agi.AnonymousClass2.b[ym.ordinal()];
|
|
if (i == 1) {
|
|
YKU yku = new YKU(arrayList3);
|
|
arrayList4 = (List) new YKU(yku.a, new GEP(yku.b, new Jel(lowerCase) { // from class: o.agq
|
|
private String d;
|
|
|
|
@Override // o.Jel
|
|
public final boolean e(Object obj2) {
|
|
boolean contains;
|
|
contains = ((C0406Fx) obj2).h.toLowerCase().contains(this.d);
|
|
return contains;
|
|
}
|
|
|
|
{
|
|
this.d = lowerCase;
|
|
}
|
|
})).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
|
|
} else if (i == 2) {
|
|
YKU yku2 = new YKU(arrayList3);
|
|
arrayList4 = (List) new YKU(yku2.a, new GEP(yku2.b, new Jel(lowerCase) { // from class: o.ago
|
|
private String b;
|
|
|
|
@Override // o.Jel
|
|
public final boolean e(Object obj2) {
|
|
boolean contains;
|
|
contains = ((C0406Fx) obj2).d.toLowerCase().contains(this.b);
|
|
return contains;
|
|
}
|
|
|
|
{
|
|
this.b = lowerCase;
|
|
}
|
|
})).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
|
|
} else if (i == 3) {
|
|
YKU yku3 = new YKU(arrayList3);
|
|
arrayList4 = (List) new YKU(yku3.a, new GEP(yku3.b, new Jel(lowerCase) { // from class: o.agn
|
|
private String c;
|
|
|
|
@Override // o.Jel
|
|
public final boolean e(Object obj2) {
|
|
boolean contains;
|
|
contains = ((C0406Fx) obj2).i.toLowerCase().contains(this.c);
|
|
return contains;
|
|
}
|
|
|
|
{
|
|
this.c = lowerCase;
|
|
}
|
|
})).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
|
|
} else if (i == 4) {
|
|
YKU yku4 = new YKU(arrayList3);
|
|
arrayList4 = (List) new YKU(yku4.a, new GEP(yku4.b, new Jel(lowerCase) { // from class: o.agp
|
|
private String c;
|
|
|
|
@Override // o.Jel
|
|
public final boolean e(Object obj2) {
|
|
boolean contains;
|
|
contains = ((C0406Fx) obj2).c.contains(this.c);
|
|
return contains;
|
|
}
|
|
|
|
{
|
|
this.c = lowerCase;
|
|
}
|
|
})).a(new PRA.Sts(new PRA.AnonymousClass4(), new PRA.AnonymousClass8()));
|
|
}
|
|
ZI.IeS ieS = new ZI.IeS(arrayList4) { // from class: o.agr
|
|
private List d;
|
|
|
|
@Override // o.ZI.IeS
|
|
public final void e(Object obj2) {
|
|
((InterfaceC9022dbq.RVV) obj2).e((List<C0406Fx>) this.d);
|
|
}
|
|
|
|
{
|
|
this.d = arrayList4;
|
|
}
|
|
};
|
|
if (c2550agi.f != 0) {
|
|
ieS.e(c2550agi.f);
|
|
}
|
|
}
|
|
|
|
{
|
|
this.d = this;
|
|
}
|
|
});
|
|
}
|
|
return inflate;
|
|
}
|
|
|
|
@Override // androidx.fragment.app.Fragment
|
|
public void onViewCreated(View view, Bundle bundle) {
|
|
Throwable th;
|
|
super.onViewCreated(view, bundle);
|
|
if (getArguments() == null || (th = (Throwable) getArguments().getSerializable("KEY_THROWABLE")) == null) {
|
|
return;
|
|
}
|
|
e(this.presenter.j.e(th));
|
|
}
|
|
|
|
public static /* synthetic */ boolean c(String str) throws Throwable {
|
|
return !str.isEmpty();
|
|
}
|
|
|
|
@OnClick
|
|
public void onClearButtonClick() {
|
|
this.searchEditText.setText("");
|
|
}
|
|
|
|
@Override // o.InterfaceC9022dbq.RVV
|
|
public final void e(List<C0406Fx> list) {
|
|
SubDistrictSearchAdapter subDistrictSearchAdapter = this.d;
|
|
subDistrictSearchAdapter.b.clear();
|
|
subDistrictSearchAdapter.b.addAll(list);
|
|
subDistrictSearchAdapter.notifyDataSetChanged();
|
|
}
|
|
|
|
/* renamed from: com.scb.phone.view.fragment.address.AddressSearchFragment$4, reason: invalid class name */
|
|
/* loaded from: classes5.dex */
|
|
static /* synthetic */ class AnonymousClass4 {
|
|
static final int[] e;
|
|
|
|
static {
|
|
int[] iArr = new int[YM.values().length];
|
|
e = iArr;
|
|
try {
|
|
iArr[YM.PROVINCE.ordinal()] = 1;
|
|
} catch (NoSuchFieldError unused) {
|
|
}
|
|
try {
|
|
e[YM.DISTRICT.ordinal()] = 2;
|
|
} catch (NoSuchFieldError unused2) {
|
|
}
|
|
try {
|
|
e[YM.SUB_DISTRICT.ordinal()] = 3;
|
|
} catch (NoSuchFieldError unused3) {
|
|
}
|
|
try {
|
|
e[YM.POSTAL_CODE.ordinal()] = 4;
|
|
} catch (NoSuchFieldError unused4) {
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override // com.scb.phone.view.adapter.address.SubDistrictSearchAdapter.RVV
|
|
public final void c(C0406Fx c0406Fx) {
|
|
if (this.i != null) {
|
|
int i = AnonymousClass4.e[this.c.d.ordinal()];
|
|
if (i == 1) {
|
|
this.i.d(c0406Fx);
|
|
this.i.e(this.c);
|
|
return;
|
|
}
|
|
if (i == 2) {
|
|
this.i.b(c0406Fx);
|
|
this.i.e(this.c);
|
|
} else if (i == 3) {
|
|
this.i.e(c0406Fx);
|
|
this.i.e(this.c);
|
|
} else if (i == 4) {
|
|
this.i.c(c0406Fx.c);
|
|
this.i.c();
|
|
}
|
|
}
|
|
}
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class Sts {
|
|
final AddressSearchFragment c;
|
|
|
|
public Sts(AddressSearchFragment addressSearchFragment) {
|
|
this.c = addressSearchFragment;
|
|
}
|
|
}
|
|
|
|
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
|
|
public void onDestroyView() {
|
|
super.onDestroyView();
|
|
this.j.dispose();
|
|
}
|
|
}
|