what-the-bank/sources/com/scb/phone/view/fragment/bankingactions/BankingActionFragment.java

414 lines
13 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.bankingactions;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.investment.select.SelectInvestmentActivity;
import com.scb.phone.view.activity.prelogin.PinLoginActivity;
import com.scb.phone.view.adapter.bankingactions.BankingActionAdapter;
import com.scb.phone.view.custom.CustomProfileImageView;
import com.scb.phone.view.fragment.bankingactions.BankingActionFragment;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.TimeUnit;
import o.BKa;
import o.C0391Fn;
import o.C10457eEr;
import o.C12891fKc;
import o.C13389fZA;
import o.C13417fZt;
import o.C3984bMl;
import o.C8064dAG;
import o.EnumC12088erc;
import o.FG;
import o.InterfaceC12835fIj;
import o.InterfaceC13391fZD;
import o.InterfaceC6628cYf;
import o.YIo;
import o.ZI;
import o.fRR;
import o.fSJ;
import o.fSQ;
import o.gHK;
import o.guQ;
import o.nMh;
/* loaded from: classes5.dex */
public class BankingActionFragment extends Hilt_BankingActionFragment implements InterfaceC6628cYf, InterfaceC12835fIj {
private static int d = EnumC12088erc.INVESTMENT.ordinal();
@InterfaceC13391fZD
public C3984bMl bankingActionPresenter;
@BindView
CustomProfileImageView cusIvProfile;
private FG f;
private boolean g;
private fSJ i;
@BindView
ImageView ivBgBankService;
private List<FG> j;
@BindView
LinearLayout llLayoutInternetError;
@BindView
RecyclerView rvBankingActions;
@BindView
TextView tvHomeWelcomeHeadline;
@BindView
TextView tvHomeWelcomeUserName;
private C13389fZA<Integer> h = C13389fZA.d();
private boolean c = false;
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
YIo yIo;
View inflate = layoutInflater.inflate(R.layout.2131559456, viewGroup, false);
ButterKnife.c(this, inflate);
this.bankingActionPresenter.e((C3984bMl) this);
super.aa();
Y();
Z();
final C3984bMl c3984bMl = this.bankingActionPresenter;
if (c3984bMl.a.e.s() && !gHK.JURISTIC.equals(c3984bMl.d.d())) {
ZI.IeS ieS = new ZI.IeS(c3984bMl) { // from class: o.bMu
private C3984bMl b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3984bMl.d(this.b, (InterfaceC6628cYf) obj);
}
{
this.b = c3984bMl;
}
};
if (c3984bMl.f != 0) {
ieS.e(c3984bMl.f);
}
}
final C3984bMl c3984bMl2 = this.bankingActionPresenter;
ZI.IeS ieS2 = new ZI.IeS(c3984bMl2) { // from class: o.bMz
private C3984bMl d;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).d(r0.e.d(this.d.a.e.L()));
}
{
this.d = c3984bMl2;
}
};
if (c3984bMl2.f != 0) {
ieS2.e(c3984bMl2.f);
}
c3984bMl2.c();
if (gHK.INDIVIDUAL == c3984bMl2.d.d()) {
ZI.IeS ieS3 = new ZI.IeS() { // from class: o.bMH
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).i();
}
};
if (c3984bMl2.f != 0) {
ieS3.e(c3984bMl2.f);
}
C8064dAG a = c3984bMl2.b.a();
if (a == null || (yIo = a.r) == null || !yIo.y) {
ZI.IeS ieS4 = new ZI.IeS() { // from class: o.bMG
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).d();
}
};
if (c3984bMl2.f != 0) {
ieS4.e(c3984bMl2.f);
}
} else {
ZI.IeS ieS5 = new ZI.IeS(c3984bMl2) { // from class: o.bMy
private C3984bMl b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C3984bMl.b(this.b, (InterfaceC6628cYf) obj);
}
{
this.b = c3984bMl2;
}
};
if (c3984bMl2.f != 0) {
ieS5.e(c3984bMl2.f);
}
}
} else {
ZI.IeS ieS6 = new ZI.IeS() { // from class: o.bMG
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).d();
}
};
if (c3984bMl2.f != 0) {
ieS6.e(c3984bMl2.f);
}
}
return inflate;
}
@Override // androidx.fragment.app.Fragment
public void onViewCreated(View view, Bundle bundle) {
super.onViewCreated(view, bundle);
fSJ fsj = this.i;
if (fsj != null) {
fsj.dispose();
}
this.i = this.h.throttleFirst(700L, TimeUnit.MILLISECONDS).subscribeOn(C13417fZt.c()).subscribeOn(fRR.e()).subscribe(new fSQ(this) { // from class: o.eGY
private BankingActionFragment b;
@Override // o.fSQ
public final void c(Object obj) {
BankingActionFragment.c(this.b, (Integer) obj);
}
{
this.b = this;
}
}, new fSQ() { // from class: o.eHa
@Override // o.fSQ
public final void c(Object obj) {
guQ.e((Throwable) obj);
}
});
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
this.g = false;
}
@Override // com.scb.phone.view.fragment.BaseFragment
public final void aa() {
super.aa();
Y();
Z();
}
@Override // o.InterfaceC6628cYf
public final void e(List<FG> list) {
this.j = list;
BankingActionAdapter bankingActionAdapter = new BankingActionAdapter(this, getContext());
ArrayList<FG> arrayList = new ArrayList<>();
bankingActionAdapter.d = arrayList;
arrayList.addAll(list);
this.rvBankingActions.setAdapter(bankingActionAdapter);
this.rvBankingActions.setNestedScrollingEnabled(true);
}
@Override // o.InterfaceC6628cYf
public final void c(int i) {
this.h.onNext(Integer.valueOf(i));
}
private void a(String str) {
if (str == null || str.isEmpty()) {
return;
}
try {
Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(str));
intent.putExtra("BANKING_SERVICE_TILE_TAG", true);
startActivity(intent);
} catch (ActivityNotFoundException e) {
guQ.e(e);
}
}
@Override // o.InterfaceC6628cYf
public final void c(boolean z) {
this.llLayoutInternetError.setVisibility(z ? 8 : 0);
this.rvBankingActions.setVisibility(z ? 0 : 8);
}
@Override // o.InterfaceC6628cYf
public final void j() {
C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_SHOW_BANKING_ACTION_TUTORIAL"));
}
@Override // o.InterfaceC6628cYf
public final void e() {
if (getContext() != null) {
SelectInvestmentActivity.a(getContext());
}
}
@OnClick
public void onTryAgainButtonClick() {
this.bankingActionPresenter.c();
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroyView() {
super.onDestroyView();
this.bankingActionPresenter.w_();
fSJ fsj = this.i;
if (fsj != null) {
fsj.dispose();
}
}
@Override // o.InterfaceC6628cYf
public final void i() {
Context context = getContext();
if (context != null) {
if (this.bankingActionPresenter.a.d.d() && !this.bankingActionPresenter.a.d.e()) {
C12891fKc.azG_(new File(this.bankingActionPresenter.a.d.c(), BKa.BG_BANKING_SERVICE.component), this.ivBgBankService, nMh.getDrawable(context, R.drawable.landing_page_header));
}
this.cusIvProfile.setClickable(true);
this.cusIvProfile.setOnClickListener(new View.OnClickListener(this) { // from class: o.eGS
private BankingActionFragment a;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
BankingActionFragment.b(this.a);
}
{
this.a = this;
}
});
}
}
@Override // o.InterfaceC6628cYf
public final void c() {
this.cusIvProfile.setBorderState(5);
this.cusIvProfile.setClickable(true);
this.cusIvProfile.c();
this.c = false;
}
@Override // o.InterfaceC6628cYf
public final void a() {
this.cusIvProfile.setBorderState(2);
this.cusIvProfile.setClickable(true);
this.cusIvProfile.c();
this.c = true;
}
@Override // o.InterfaceC6628cYf
public final void b() {
this.cusIvProfile.setBorderState(1);
this.cusIvProfile.setClickable(true);
this.cusIvProfile.c();
this.c = false;
}
@Override // o.InterfaceC6628cYf
public final void d() {
this.cusIvProfile.setClickable(false);
this.cusIvProfile.setBorderState(0);
this.c = false;
}
public static /* synthetic */ void b(BankingActionFragment bankingActionFragment) {
if (bankingActionFragment.g) {
return;
}
bankingActionFragment.g = true;
Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse("scbeasy://justforyou/entrypoint?source=banking_services"));
intent.putExtra("HAS_NEW_INSIGHT", bankingActionFragment.c);
bankingActionFragment.startActivity(intent);
}
public static /* synthetic */ void c(BankingActionFragment bankingActionFragment, Integer num) {
List<FG> list = bankingActionFragment.j;
if (list == null || list.isEmpty()) {
return;
}
FG fg = bankingActionFragment.j.get(num.intValue());
bankingActionFragment.f = fg;
if (fg.c != null) {
bankingActionFragment.v(bankingActionFragment.f.c);
}
if (bankingActionFragment.f.d != null && bankingActionFragment.f.d.booleanValue() && (!(bankingActionFragment.getActivity() instanceof BaseActivity) || !((BaseActivity) bankingActionFragment.getActivity()).X() || ((bankingActionFragment.getActivity() instanceof BaseActivity) && ((BaseActivity) bankingActionFragment.getActivity()).z_()))) {
bankingActionFragment.startActivityForResult(new Intent(bankingActionFragment.getActivity(), (Class<?>) PinLoginActivity.class), 7135);
} else {
bankingActionFragment.a(bankingActionFragment.f.b);
}
}
@Override // o.InterfaceC12835fIj
public final void e(final int i) {
C3984bMl c3984bMl = this.bankingActionPresenter;
ZI.IeS ieS = new ZI.IeS(i) { // from class: o.bMp
private int d;
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).c(this.d);
}
{
this.d = i;
}
};
if (c3984bMl.f != 0) {
ieS.e(c3984bMl.f);
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onActivityResult(int i, int i2, Intent intent) {
if (i != d || i2 != -1) {
FG fg = this.f;
if (fg != null && i == 7135 && i2 == -1) {
a(fg.b);
return;
} else {
super.onActivityResult(i, i2, intent);
return;
}
}
C3984bMl c3984bMl = this.bankingActionPresenter;
ZI.IeS ieS = new ZI.IeS() { // from class: o.bMv
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6628cYf) obj).e();
}
};
if (c3984bMl.f != 0) {
ieS.e(c3984bMl.f);
}
}
@Override // o.InterfaceC9013dbh
public final void d(C0391Fn c0391Fn) {
this.tvHomeWelcomeUserName.setVisibility(TextUtils.isEmpty(c0391Fn.h) ? 8 : 0);
this.tvHomeWelcomeUserName.setText(c0391Fn.h);
this.tvHomeWelcomeHeadline.setText(c0391Fn.c);
this.cusIvProfile.setImageUrl(c0391Fn.b);
}
}