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

592 lines
22 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.transferandpay;
import android.content.Context;
import android.content.IntentFilter;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import androidx.constraintlayout.widget.Group;
import androidx.viewpager.widget.ViewPager;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.adapter.accountsummary.ErrorPagerAdapter;
import com.scb.phone.view.adapter.transferandpay.AccountSourceAdapter;
import com.scb.phone.view.custom.common.NoSwipeViewPager;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.transferandpay.AccountSourceSelectFragment;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.C0693Mj;
import o.C1171Xc;
import o.C1177Xf;
import o.C6177cLD;
import o.C6583cXR;
import o.InterfaceC12824fIT;
import o.InterfaceC13391fZD;
import o.InterfaceC9010dbe;
import o.WW;
import o.YE;
import o.ZI;
import o.cLE;
import o.fSJ;
import o.fSQ;
import o.gjJ;
import o.glR;
import o.nMh;
/* loaded from: classes5.dex */
public class AccountSourceSelectFragment extends Hilt_AccountSourceSelectFragment implements ViewPager.ojQ, InterfaceC9010dbe.HBt, InterfaceC12824fIT {
@InterfaceC13391fZD
public cLE accountSourcePresenter;
@BindView
View bottomDivider;
private C1171Xc c;
public AccountSourceAdapter d;
private boolean f;
private String g;
@BindView
Group groupHappyCashSuccess;
private boolean h;
private List<Sts> i;
private ErrorPagerAdapter.LWm j = ErrorPagerAdapter.LWm.NORMAL_ERROR;
private fSJ k;
private fSJ l;
@BindView
LinearLayout llHappyCashError;
private fSJ m;
@BindView
CircleIndicator mCircleIndicator;
@BindView
TextView mFromTextView;
@BindView
LinearLayout mLlHappyCash;
@BindView
ProgressBar mPbHappyCash;
@BindView
TextView mTextDisclaimer;
@BindView
TextView mToTextView;
@BindView
TextView mTvHappyCashAvailable;
@BindView
TextView mTvHappyCashLimit;
@BindView
TextView mTvHappyCashLimitValue;
@BindView
TextView mTvHappyCashUsed;
@BindView
public NoSwipeViewPager mViewPager;
private fSJ n;
/* renamed from: o, reason: collision with root package name */
private fSJ f8072o;
/* loaded from: classes5.dex */
public interface Sts {
default void H_() {
}
void a(WW ww);
default void a_(List<WW> list) {
}
default void e_(boolean z) {
}
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageScrollStateChanged(int i) {
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageScrolled(int i, float f, int i2) {
}
public static AccountSourceSelectFragment b(C1171Xc c1171Xc) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
public static AccountSourceSelectFragment e(C1171Xc c1171Xc, String str, ErrorPagerAdapter.LWm lWm) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
bundle.putString("com.scb.phone.EXTRA_ACCOUNT_SELECTED", str);
bundle.putSerializable("EXTRA_ACCOUNT_ERROR", lWm);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
public static AccountSourceSelectFragment d(C1171Xc c1171Xc, ErrorPagerAdapter.LWm lWm) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
bundle.putSerializable("EXTRA_ACCOUNT_ERROR", lWm);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
public static AccountSourceSelectFragment a(C1171Xc c1171Xc, String str) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
bundle.putString("com.scb.phone.EXTRA_ACCOUNT_SELECTED", str);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
public static AccountSourceSelectFragment b(C1171Xc c1171Xc, String str, boolean z) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
bundle.putString("com.scb.phone.EXTRA_ACCOUNT_SELECTED", str);
bundle.putBoolean("com.scb.phone.FAVOURITE", z);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
public static AccountSourceSelectFragment d(C1171Xc c1171Xc, boolean z) {
Bundle bundle = new Bundle();
bundle.putParcelable("AccountSourceDisplayExtra", c1171Xc);
bundle.putBoolean("EXTRA_ACCOUNT_SPEEDY_CASH", z);
AccountSourceSelectFragment accountSourceSelectFragment = new AccountSourceSelectFragment();
accountSourceSelectFragment.setArguments(bundle);
return accountSourceSelectFragment;
}
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559434, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
this.accountSourcePresenter.e((cLE) this);
Bundle arguments = getArguments();
if (arguments != null) {
this.c = (C1171Xc) arguments.getParcelable("AccountSourceDisplayExtra");
this.g = arguments.getString("com.scb.phone.EXTRA_ACCOUNT_SELECTED");
this.f = arguments.getBoolean("com.scb.phone.FAVOURITE", false);
this.h = arguments.getBoolean("EXTRA_ACCOUNT_SPEEDY_CASH", false);
if (arguments.getSerializable("EXTRA_ACCOUNT_ERROR") != null) {
this.j = (ErrorPagerAdapter.LWm) arguments.getSerializable("EXTRA_ACCOUNT_ERROR");
}
}
this.mViewPager.addOnPageChangeListener(this);
this.m = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_REFRESH_SOURCE_ACCOUNTS")).subscribe(new fSQ(this) { // from class: o.fBV
private AccountSourceSelectFragment c;
@Override // o.fSQ
public final void c(Object obj) {
AccountSourceSelectFragment.b(this.c);
}
{
this.c = this;
}
}, new fSQ() { // from class: o.fBZ
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
j();
return inflate;
}
@Override // o.InterfaceC9010dbe.HBt
public final void b(C1177Xf c1177Xf) {
this.mLlHappyCash.setVisibility(0);
this.llHappyCashError.setVisibility(8);
this.mTvHappyCashUsed.setText(C6583cXR.c().format(c1177Xf.c));
this.mTvHappyCashAvailable.setText(C6583cXR.c().format(c1177Xf.e));
this.mTvHappyCashLimitValue.setText(C6583cXR.c().format(c1177Xf.b));
this.mTvHappyCashLimit.setText(String.valueOf(c1177Xf.d));
this.mPbHappyCash.setMax((int) c1177Xf.e);
this.mPbHappyCash.setProgress((int) c1177Xf.c);
}
@Override // o.InterfaceC9010dbe.HBt
public final void b() {
this.mLlHappyCash.setVisibility(8);
this.llHappyCashError.setVisibility(8);
}
@Override // o.InterfaceC9010dbe.HBt
public final void e() {
this.mLlHappyCash.setVisibility(0);
this.groupHappyCashSuccess.setVisibility(4);
this.llHappyCashError.setVisibility(0);
}
/* JADX INFO: Access modifiers changed from: private */
public void j() {
this.accountSourcePresenter.e(this.c, this.g, this.f, this.h);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.scb.phone.view.fragment.transferandpay.Hilt_AccountSourceSelectFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
public void onAttach(Context context) {
super.onAttach(context);
ArrayList arrayList = new ArrayList();
this.i = arrayList;
if (context instanceof Sts) {
arrayList.add((Sts) context);
}
if (getParentFragment() instanceof Sts) {
this.i.add((Sts) getParentFragment());
}
}
@Override // androidx.fragment.app.Fragment
public void onDetach() {
super.onDetach();
this.i.clear();
this.i = null;
}
public final void e(String str) {
AccountSourceAdapter accountSourceAdapter = this.d;
if (accountSourceAdapter != null) {
int b = accountSourceAdapter.b(str);
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
if (b == -1) {
b = 0;
}
noSwipeViewPager.setCurrentItem(b);
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
this.accountSourcePresenter.w_();
fSJ fsj = this.m;
if (fsj != null && !fsj.isDisposed()) {
this.m.dispose();
}
super.onDestroy();
}
@Override // o.InterfaceC9010dbe.HBt
public final void c(List<WW> list, int i) {
AccountSourceAdapter accountSourceAdapter = new AccountSourceAdapter(getContext(), list, this);
this.d = accountSourceAdapter;
C1171Xc c1171Xc = this.c;
accountSourceAdapter.b = c1171Xc != null && c1171Xc.e == YE.CARDLESS_ATM_FUNCTION;
this.mViewPager.setAdapter(this.d);
this.mViewPager.setClipToPadding(false);
Iterator<Sts> it = this.i.iterator();
while (it.hasNext()) {
it.next().a_(list);
}
this.mViewPager.setVisibility(0);
this.mCircleIndicator.setVisibility(0);
if (list.size() == 1) {
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, 0, 0);
} else {
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0, getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0);
}
this.mCircleIndicator.setViewPager(this.mViewPager);
this.mViewPager.setCurrentItem(i);
AccountSourceAdapter accountSourceAdapter2 = this.d;
c(accountSourceAdapter2 != null ? accountSourceAdapter2.d(this.mViewPager.getCurrentItem()) : null);
e(true);
if (list.size() >= 10) {
this.mCircleIndicator.setVisibility(8);
} else {
this.mCircleIndicator.setVisibility(0);
}
}
@Override // o.InterfaceC9010dbe.HBt
public final void b_(int i) {
int i2;
int i3;
C0693Mj c0693Mj = new C0693Mj();
if (i != 1) {
i3 = R.string.prepaid_card_request_account_error_description;
if (i == 2) {
i2 = R.string.prepaid_card_request_account_error_title;
} else if (i == 4) {
i2 = R.string.nsip_eligible_account_error_title;
i3 = R.string.nsip_eligible_account_error_description;
} else if (i != 5) {
i2 = R.string.not_eligible_account_error_title;
i3 = R.string.not_eligible_account_error_description;
} else {
i2 = R.string.prepaid_card_request_account_error_title_topup;
}
} else {
i2 = R.string.debit_card_request_account_error_title;
i3 = R.string.debit_card_request_account_error_description;
}
c0693Mj.d = getString(i2);
c0693Mj.c = getString(i3);
axA_(c0693Mj, true, null);
e(false);
this.mCircleIndicator.setVisibility(8);
}
@Override // o.InterfaceC9010dbe.HBt
public final void a() {
this.mViewPager.setAdapter(null);
this.d = null;
this.mViewPager.setVisibility(4);
this.mCircleIndicator.setVisibility(4);
}
@Override // o.InterfaceC9010dbe.HBt
public final void d() {
this.mViewPager.setVisibility(0);
this.mCircleIndicator.setVisibility(0);
}
@Override // o.InterfaceC9010dbe.HBt
public final void c(String str, int i) {
if (this.mViewPager.getAdapter() instanceof AccountSourceAdapter) {
WW d = this.d.d(this.mViewPager.getCurrentItem());
AccountSourceAdapter accountSourceAdapter = this.d;
accountSourceAdapter.e = str;
accountSourceAdapter.notifyDataSetChanged();
if (this.d.getCount() > 0) {
this.mCircleIndicator.setViewPager(this.mViewPager);
this.mViewPager.setCurrentItem(this.d.b(d.s), false);
} else {
b_(i);
}
}
}
private void e(boolean z) {
Iterator<Sts> it = this.i.iterator();
while (it.hasNext()) {
it.next().e_(z);
}
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public void onPageSelected(int i) {
c(i);
}
private void axA_(C0693Mj c0693Mj, boolean z, View.OnClickListener onClickListener) {
this.mViewPager.setAdapter(new ErrorPagerAdapter(requireContext(), c0693Mj, this.j, onClickListener));
this.mViewPager.setClipToPadding(false);
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0);
if (z) {
this.mCircleIndicator.setVisibility(0);
this.mCircleIndicator.setViewPager(this.mViewPager);
} else {
this.mCircleIndicator.setVisibility(8);
}
}
@Override // o.InterfaceC12824fIT
public final void a(int i) {
this.mViewPager.setCurrentItem(i, true);
c(i);
}
private void c(int i) {
int[] iArr = {i - 1, i, i + 1};
if (i == 0) {
AccountSourceAdapter accountSourceAdapter = this.d;
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, (accountSourceAdapter == null || accountSourceAdapter.getCount() == 1) ? 0 : getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0);
} else {
AccountSourceAdapter accountSourceAdapter2 = this.d;
if (accountSourceAdapter2 != null && i == accountSourceAdapter2.getCount() - 1) {
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0, getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0);
} else {
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0, getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0);
}
}
for (int i2 = 0; i2 < 3; i2++) {
int i3 = iArr[i2];
NoSwipeViewPager noSwipeViewPager = this.mViewPager;
if (noSwipeViewPager != null) {
View findViewWithTag = noSwipeViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER".concat(String.valueOf(i3)));
TextView textView = (TextView) this.mViewPager.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER_TEXT".concat(String.valueOf(i3)));
if (findViewWithTag != null && textView != null) {
if (i == i3) {
findViewWithTag.setBackground(nMh.getDrawable(getContext(), R.drawable.rounded_purple_view_pager));
textView.setTextColor(nMh.getColor(getContext(), R.color.f2982131099805));
} else {
Context context = getContext();
C1171Xc c1171Xc = this.c;
findViewWithTag.setBackground(nMh.getDrawable(context, (c1171Xc == null || c1171Xc.e != YE.CARDLESS_ATM_FUNCTION) ? R.drawable.bg_white_rounded : R.drawable.bg_white_rounded_with_border));
textView.setTextColor(nMh.getColor(getContext(), R.color.f3092131099816));
}
}
}
}
AccountSourceAdapter accountSourceAdapter3 = this.d;
c(accountSourceAdapter3 != null ? accountSourceAdapter3.d(this.mViewPager.getCurrentItem()) : null);
AccountSourceAdapter accountSourceAdapter4 = this.d;
if (accountSourceAdapter4 != null) {
accountSourceAdapter4.c = i;
}
}
private void c(WW ww) {
cLE cle = this.accountSourcePresenter;
if (cle.a && ww.q != null && !ww.q.isEmpty()) {
C1177Xf c1177Xf = ww.f;
if (c1177Xf != null && c1177Xf.h != null && c1177Xf.h.b.equals("1000")) {
final C1177Xf c1177Xf2 = ww.f;
ZI.IeS ieS = new ZI.IeS(c1177Xf2) { // from class: o.cLB
private C1177Xf e;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.HBt) obj).b(this.e);
}
{
this.e = c1177Xf2;
}
};
if (cle.f != 0) {
ieS.e(cle.f);
}
} else {
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.cLI
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.HBt) obj).e();
}
};
if (cle.f != 0) {
ieS2.e(cle.f);
}
}
} else {
ZI.IeS ieS3 = new ZI.IeS() { // from class: o.cLH
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC9010dbe.HBt) obj).b();
}
};
if (cle.f != 0) {
ieS3.e(cle.f);
}
}
Iterator<Sts> it = this.i.iterator();
while (it.hasNext()) {
it.next().a(ww);
}
C1171Xc c1171Xc = this.c;
if (c1171Xc == null || !c1171Xc.e.showDisclaimerValue.booleanValue()) {
return;
}
if (ww == null || gjJ.b((CharSequence) ww.g)) {
this.mTextDisclaimer.setVisibility(8);
} else {
this.mTextDisclaimer.setVisibility(0);
this.mTextDisclaimer.setText(ww.g);
}
}
public static /* synthetic */ void b(AccountSourceSelectFragment accountSourceSelectFragment) {
AccountSourceAdapter accountSourceAdapter = accountSourceSelectFragment.d;
if (accountSourceAdapter != null) {
accountSourceSelectFragment.accountSourcePresenter.c(accountSourceAdapter.d(accountSourceSelectFragment.mViewPager.getCurrentItem()).s);
} else {
accountSourceSelectFragment.accountSourcePresenter.c((String) null);
}
}
@Override // o.InterfaceC9010dbe.HBt
public final void c(C1171Xc c1171Xc) {
if (!c1171Xc.b) {
this.bottomDivider.setVisibility(8);
}
if (!c1171Xc.j) {
this.mToTextView.setVisibility(8);
} else {
this.mToTextView.setVisibility(0);
}
if (!TextUtils.isEmpty(c1171Xc.f)) {
this.mToTextView.setText(c1171Xc.f);
}
if (!c1171Xc.g) {
this.mFromTextView.setVisibility(8);
}
if (TextUtils.isEmpty(c1171Xc.d)) {
return;
}
this.mFromTextView.setText(c1171Xc.d);
}
public final void i() {
cLE cle = this.accountSourcePresenter;
C6177cLD c6177cLD = new C6177cLD(cle, null);
if (cle.f != 0) {
c6177cLD.e(cle.f);
}
}
public final void c(String str) {
cLE cle = this.accountSourcePresenter;
C6177cLD c6177cLD = new C6177cLD(cle, str);
if (cle.f != 0) {
c6177cLD.e(cle.f);
}
}
@Override // o.InterfaceC6627cYe.HBt
public final void aM_() {
C1171Xc c1171Xc = this.c;
if (c1171Xc != null && c1171Xc.c == 3) {
C0693Mj c0693Mj = new C0693Mj();
c0693Mj.d = getString(R.string.banking_select_agent_error_title);
c0693Mj.c = getString(R.string.banking_select_agent_error_description);
axA_(c0693Mj, false, new View.OnClickListener(this) { // from class: o.fBX
private AccountSourceSelectFragment c;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
this.c.j();
}
{
this.c = this;
}
});
} else {
axA_(null, true, null);
}
e(false);
List<Sts> list = this.i;
if (list != null) {
Iterator<Sts> it = list.iterator();
while (it.hasNext()) {
it.next().H_();
}
}
}
}