what-the-bank/sources/com/scb/phone/view/fragment/transferandpay/BNPLAccountSourceSelectFrag...

538 lines
20 KiB
Java

package com.scb.phone.view.fragment.transferandpay;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.Uri;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.scb.phone.R;
import com.scb.phone.view.adapter.accountsummary.ErrorPagerAdapter;
import com.scb.phone.view.adapter.transferandpay.AccountBnplSourceAdapter;
import com.scb.phone.view.custom.common.NoSwipeViewPager;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.transferandpay.BNPLAccountSourceSelectFragment;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.AbstractC13163fSk;
import o.AbstractC14961gcz;
import o.C1173Xd;
import o.C1193Xr;
import o.C13396fZU;
import o.C14851gaI;
import o.C14866gag;
import o.C14881gav;
import o.C14930gcM;
import o.C14957gcv;
import o.C6442cSy;
import o.IDx;
import o.InterfaceC12824fIT;
import o.InterfaceC13391fZD;
import o.InterfaceC14894gbR;
import o.InterfaceC16541pFg;
import o.InterfaceC8980dbA;
import o.fSJ;
import o.fSQ;
import o.glR;
import o.guQ;
import o.jJR;
import o.nMh;
import o.pug;
/* loaded from: classes5.dex */
public final class BNPLAccountSourceSelectFragment extends Hilt_BNPLAccountSourceSelectFragment implements InterfaceC12824fIT, InterfaceC8980dbA.LWm {
public static final RVV d = new RVV(0);
@InterfaceC13391fZD
public C6442cSy accountSourcePresenter;
AccountBnplSourceAdapter c;
private ArrayList<Sts> h;
private fSJ i;
@BindView
public CircleIndicator mCircleIndicator;
@BindView
public TextView mFromTextView;
@BindView
public TextView mToTextView;
@BindView
public NoSwipeViewPager mViewPager;
private List<C1173Xd> j = C14851gaI.c;
private ErrorPagerAdapter.LWm g = ErrorPagerAdapter.LWm.NORMAL_ERROR;
/* loaded from: classes5.dex */
public interface Sts {
void d(C1173Xd c1173Xd);
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
View inflate = layoutInflater.inflate(R.layout.2131559434, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
C6442cSy c6442cSy = this.accountSourcePresenter;
C6442cSy c6442cSy2 = null;
if (c6442cSy == null) {
C14957gcv.a("");
c6442cSy = null;
}
c6442cSy.e((C6442cSy) this);
AbstractC13163fSk<Intent> Ge_ = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_REFRESH_SOURCE_ACCOUNTS"));
final LWm lWm = new LWm(this);
fSQ<? super Intent> fsq = new fSQ(lWm) { // from class: o.fCs
private InterfaceC14894gbR a;
@Override // o.fSQ
public final void c(Object obj) {
BNPLAccountSourceSelectFragment.d(this.a, obj);
}
{
this.a = lWm;
}
};
final IeS ieS = IeS.a;
this.i = Ge_.subscribe(fsq, new fSQ(ieS) { // from class: o.fCq
private InterfaceC14894gbR a;
@Override // o.fSQ
public final void c(Object obj) {
BNPLAccountSourceSelectFragment.a(this.a, obj);
}
{
this.a = ieS;
}
});
TextView textView = this.mFromTextView;
if (textView == null) {
C14957gcv.a("");
textView = null;
}
TextView textView2 = textView;
C14957gcv.e(textView2, "");
textView2.setVisibility(8);
TextView textView3 = this.mToTextView;
if (textView3 == null) {
C14957gcv.a("");
textView3 = null;
}
TextView textView4 = textView3;
C14957gcv.e(textView4, "");
textView4.setVisibility(0);
C6442cSy c6442cSy3 = this.accountSourcePresenter;
if (c6442cSy3 != null) {
c6442cSy2 = c6442cSy3;
} else {
C14957gcv.a("");
}
c6442cSy2.b();
return inflate;
}
/* loaded from: classes5.dex */
static final class IeS extends AbstractC14961gcz implements InterfaceC14894gbR<Throwable, C14866gag> {
public static final IeS a = new IeS();
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Throwable th) {
guQ.a(th);
return C14866gag.c;
}
IeS() {
super(1);
}
}
/* loaded from: classes5.dex */
static final class LWm extends AbstractC14961gcz implements InterfaceC14894gbR<Intent, C14866gag> {
private BNPLAccountSourceSelectFragment a;
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Intent intent) {
BNPLAccountSourceSelectFragment.e(this.a);
return C14866gag.c;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
LWm(BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment) {
super(1);
this.a = bNPLAccountSourceSelectFragment;
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.scb.phone.view.fragment.transferandpay.Hilt_BNPLAccountSourceSelectFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
public final void onAttach(Context context) {
ArrayList<Sts> arrayList;
C14957gcv.e(context, "");
super.onAttach(context);
ArrayList<Sts> arrayList2 = new ArrayList<>();
this.h = arrayList2;
if (context instanceof Sts) {
arrayList2.add((Sts) context);
}
if (!(getParentFragment() instanceof Sts) || (arrayList = this.h) == null) {
return;
}
InterfaceC16541pFg parentFragment = getParentFragment();
C14957gcv.d(parentFragment, "");
arrayList.add((Sts) parentFragment);
}
@Override // androidx.fragment.app.Fragment
public final void onDetach() {
super.onDetach();
ArrayList<Sts> arrayList = this.h;
if (arrayList != null) {
arrayList.clear();
}
this.h = null;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroy() {
C6442cSy c6442cSy = this.accountSourcePresenter;
if (c6442cSy == null) {
C14957gcv.a("");
c6442cSy = null;
}
c6442cSy.w_();
fSJ fsj = this.i;
if (fsj != null && !fsj.isDisposed()) {
fsj.dispose();
}
super.onDestroy();
}
private final void b(int i, int i2) {
C13396fZU<Integer, Integer> e = e(i, i2);
int intValue = e.d.intValue();
int intValue2 = e.e.intValue();
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
if (noSwipeViewPager == null) {
C14957gcv.a("");
noSwipeViewPager = null;
}
noSwipeViewPager.setPadding(intValue, 0, intValue2, 0);
}
private final C13396fZU<Integer, Integer> e(int i, int i2) {
if (i == 0) {
return new C13396fZU<>(Integer.valueOf(getResources().getDimensionPixelOffset(R.dimen.f28532131166619)), Integer.valueOf((this.c == null || i2 == 1) ? 0 : getResources().getDimensionPixelOffset(R.dimen.f28512131166617)));
}
if (this.c != null && i == i2 - 1) {
return new C13396fZU<>(Integer.valueOf(getResources().getDimensionPixelOffset(R.dimen.f28512131166617)), Integer.valueOf(getResources().getDimensionPixelOffset(R.dimen.f28522131166618)));
}
return new C13396fZU<>(Integer.valueOf(getResources().getDimensionPixelOffset(R.dimen.f28502131166616)), Integer.valueOf(getResources().getDimensionPixelOffset(R.dimen.f28502131166616)));
}
final void d(int i, int i2) {
Context context;
int[] iArr = {i - 1, i, i + 1};
b(i, i2);
for (int i3 = 0; i3 < 3; i3++) {
int i4 = iArr[i3];
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
NoSwipeViewPager noSwipeViewPager2 = null;
if (noSwipeViewPager == null) {
C14957gcv.a("");
noSwipeViewPager = null;
}
View findViewWithTag = noSwipeViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER".concat(String.valueOf(i4)));
NoSwipeViewPager noSwipeViewPager3 = this.mViewPager;
if (noSwipeViewPager3 != null) {
noSwipeViewPager2 = noSwipeViewPager3;
} else {
C14957gcv.a("");
}
TextView textView = (TextView) noSwipeViewPager2.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER_TEXT".concat(String.valueOf(i4)));
if (findViewWithTag != null && textView != null && (context = getContext()) != null) {
if (i == i4) {
findViewWithTag.setBackground(nMh.getDrawable(context, R.drawable.rounded_purple_view_pager));
textView.setTextColor(nMh.getColor(context, R.color.f2982131099805));
} else {
findViewWithTag.setBackground(nMh.getDrawable(context, R.drawable.bg_white_rounded_with_border));
textView.setTextColor(nMh.getColor(context, R.color.f3092131099816));
}
}
}
}
@Override // o.InterfaceC12824fIT
public final void a(int i) {
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
if (noSwipeViewPager == null) {
C14957gcv.a("");
noSwipeViewPager = null;
}
noSwipeViewPager.setCurrentItem(i, true);
d(i, this.j.size());
AccountBnplSourceAdapter accountBnplSourceAdapter = this.c;
if (accountBnplSourceAdapter != null) {
accountBnplSourceAdapter.c = i;
d(accountBnplSourceAdapter.a.get(i));
}
}
/* loaded from: classes5.dex */
public static final class RVV {
private RVV() {
}
public /* synthetic */ RVV(byte b) {
this();
}
}
/* loaded from: classes5.dex */
public static final class HBt implements ViewPager.ojQ {
private BNPLAccountSourceSelectFragment a;
private List<C1173Xd> b;
private NoSwipeViewPager e;
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrollStateChanged(int i) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageScrolled(int i, float f, int i2) {
}
HBt(BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment, List<C1173Xd> list, NoSwipeViewPager noSwipeViewPager) {
this.a = bNPLAccountSourceSelectFragment;
this.b = list;
this.e = noSwipeViewPager;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
C1173Xd c1173Xd;
BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment = this.a;
int size = this.b.size();
AccountBnplSourceAdapter accountBnplSourceAdapter = bNPLAccountSourceSelectFragment.c;
if (accountBnplSourceAdapter != null) {
accountBnplSourceAdapter.c = i;
}
bNPLAccountSourceSelectFragment.d(i, size);
BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment2 = this.a;
AccountBnplSourceAdapter accountBnplSourceAdapter2 = bNPLAccountSourceSelectFragment2.c;
if (accountBnplSourceAdapter2 != null) {
c1173Xd = accountBnplSourceAdapter2.a.get(this.e.getCurrentItem());
} else {
c1173Xd = null;
}
bNPLAccountSourceSelectFragment2.d(c1173Xd);
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // o.InterfaceC8980dbA.LWm
public final void d(final List<C1173Xd> list) {
List<IDx> list2;
IDx iDx;
C14957gcv.e(list, "");
this.j = list;
Context context = getContext();
if (context != null) {
final C14930gcM.RVV rvv = new C14930gcM.RVV();
C6442cSy c6442cSy = this.accountSourcePresenter;
CircleIndicator circleIndicator = null;
if (c6442cSy == null) {
C14957gcv.a("");
c6442cSy = null;
}
jJR b = c6442cSy.a.c.b();
rvv.d = (b == null || (list2 = b.e) == null || (iDx = (IDx) C14881gav.e((List) list2)) == null) ? 0 : iDx.i;
String W = W();
C14957gcv.c((Object) W, "");
this.c = new AccountBnplSourceAdapter(context, W, list, new InterfaceC12824fIT(this, list) { // from class: o.fCl
private List a;
private BNPLAccountSourceSelectFragment e;
@Override // o.InterfaceC12824fIT
public final void a(int i) {
BNPLAccountSourceSelectFragment.a(this.e, this.a, i);
}
{
this.e = this;
this.a = list;
}
}, new InterfaceC12824fIT(this, list, rvv) { // from class: o.fCn
private BNPLAccountSourceSelectFragment a;
private C14930gcM.RVV c;
private List d;
@Override // o.InterfaceC12824fIT
public final void a(int i) {
BNPLAccountSourceSelectFragment.c(this.a, this.d, this.c, i);
}
{
this.a = this;
this.d = list;
this.c = rvv;
}
});
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
if (noSwipeViewPager == null) {
C14957gcv.a("");
noSwipeViewPager = null;
}
noSwipeViewPager.setAdapter(this.c);
noSwipeViewPager.setClipToPadding(false);
noSwipeViewPager.addOnPageChangeListener(new HBt(this, list, noSwipeViewPager));
if (list.size() == 1) {
noSwipeViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, 0, 0);
} else {
noSwipeViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0, getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0);
}
AccountBnplSourceAdapter accountBnplSourceAdapter = this.c;
d(accountBnplSourceAdapter != null ? accountBnplSourceAdapter.a.get(noSwipeViewPager.getCurrentItem()) : null);
CircleIndicator circleIndicator2 = this.mCircleIndicator;
if (circleIndicator2 != null) {
circleIndicator = circleIndicator2;
} else {
C14957gcv.a("");
}
circleIndicator.setViewPager(noSwipeViewPager);
ArrayList<Sts> arrayList = this.h;
if (arrayList != null) {
for (Sts sts : arrayList) {
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d(C1173Xd c1173Xd) {
ArrayList<Sts> arrayList = this.h;
if (arrayList != null) {
Iterator<T> it = arrayList.iterator();
while (it.hasNext()) {
((Sts) it.next()).d(c1173Xd);
}
}
}
public static /* synthetic */ void d(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
public static /* synthetic */ void a(BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment, List list, int i) {
C14957gcv.e(bNPLAccountSourceSelectFragment, "");
C14957gcv.e(list, "");
NoSwipeViewPager noSwipeViewPager = bNPLAccountSourceSelectFragment.mViewPager;
if (noSwipeViewPager == null) {
C14957gcv.a("");
noSwipeViewPager = null;
}
noSwipeViewPager.setCurrentItem(i, true);
int size = list.size();
AccountBnplSourceAdapter accountBnplSourceAdapter = bNPLAccountSourceSelectFragment.c;
if (accountBnplSourceAdapter != null) {
accountBnplSourceAdapter.c = i;
}
bNPLAccountSourceSelectFragment.d(i, size);
}
public static /* synthetic */ void a(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v3, types: [T, java.lang.String] */
/* JADX WARN: Type inference failed for: r1v16, types: [T, java.lang.String] */
public static /* synthetic */ void c(BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment, List list, C14930gcM.RVV rvv, int i) {
C14957gcv.e(bNPLAccountSourceSelectFragment, "");
C14957gcv.e(list, "");
C14957gcv.e(rvv, "");
bNPLAccountSourceSelectFragment.c("bnpl_billpay_input_setting", new pug("source", bNPLAccountSourceSelectFragment.Q()), new pug("subtype", bNPLAccountSourceSelectFragment.O()));
if (C14957gcv.b(((C1173Xd) list.get(i)).m, Boolean.FALSE)) {
Object obj = rvv.d;
String str = ((C1173Xd) list.get(i)).g;
String str2 = ((C1173Xd) list.get(i)).c;
StringBuilder sb = new StringBuilder();
sb.append(obj);
sb.append("&entryProduct=");
sb.append(str);
sb.append("&loanAccNo=");
sb.append(str2);
rvv.d = sb.toString();
}
if (bNPLAccountSourceSelectFragment.accountSourcePresenter == null) {
C14957gcv.a("");
}
String str3 = (String) rvv.d;
Bundle arguments = bNPLAccountSourceSelectFragment.getArguments();
rvv.d = C6442cSy.a(str3, arguments != null ? (C1193Xr) arguments.getParcelable("EXTRA_BILL_DATA") : null);
try {
Uri parse = Uri.parse((String) rvv.d);
((C1173Xd) list.get(i)).m = Boolean.TRUE;
bNPLAccountSourceSelectFragment.j = list;
AccountBnplSourceAdapter accountBnplSourceAdapter = bNPLAccountSourceSelectFragment.c;
if (accountBnplSourceAdapter != null) {
accountBnplSourceAdapter.notifyDataSetChanged();
}
bNPLAccountSourceSelectFragment.startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, parse));
} catch (ActivityNotFoundException e) {
guQ.e(e);
}
}
public static final /* synthetic */ void e(BNPLAccountSourceSelectFragment bNPLAccountSourceSelectFragment) {
C6442cSy c6442cSy = bNPLAccountSourceSelectFragment.accountSourcePresenter;
if (c6442cSy == null) {
C14957gcv.a("");
c6442cSy = null;
}
c6442cSy.b();
}
@Override // o.InterfaceC8980dbA.LWm
public final void e() {
NoSwipeViewPager noSwipeViewPager = null;
ErrorPagerAdapter errorPagerAdapter = new ErrorPagerAdapter(requireContext(), null, this.g, null);
NoSwipeViewPager noSwipeViewPager2 = this.mViewPager;
if (noSwipeViewPager2 == null) {
C14957gcv.a("");
noSwipeViewPager2 = null;
}
noSwipeViewPager2.setAdapter(errorPagerAdapter);
noSwipeViewPager2.setClipToPadding(false);
noSwipeViewPager2.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0);
CircleIndicator circleIndicator = this.mCircleIndicator;
if (circleIndicator == null) {
C14957gcv.a("");
circleIndicator = null;
}
CircleIndicator circleIndicator2 = circleIndicator;
C14957gcv.e(circleIndicator2, "");
circleIndicator2.setVisibility(0);
NoSwipeViewPager noSwipeViewPager3 = this.mViewPager;
if (noSwipeViewPager3 != null) {
noSwipeViewPager = noSwipeViewPager3;
} else {
C14957gcv.a("");
}
circleIndicator.setViewPager(noSwipeViewPager);
}
}