what-the-bank/sources/com/scb/phone/view/fragment/accountsummary/AccountSummaryFragment.java

351 lines
12 KiB
Java

package com.scb.phone.view.fragment.accountsummary;
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.ImageView;
import android.widget.TextView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import com.google.android.material.appbar.AppBarLayout;
import com.huawei.hms.support.api.entity.common.CommonConstant;
import com.scb.phone.R;
import com.scb.phone.view.activity.HomeActivity;
import com.scb.phone.view.activity.PreLoadCheckActivity;
import com.scb.phone.view.activity.investment.scbs.AddAccountConsentActivity;
import com.scb.phone.view.custom.CustomProfileImageView;
import com.scb.phone.view.custom.common.DefaultButton;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.accountsummary.AccountSummaryFragment;
import java.io.File;
import java.lang.ref.WeakReference;
import o.BKa;
import o.C0391Fn;
import o.C10457eEr;
import o.C12891fKc;
import o.C12914fKz;
import o.C2322acS;
import o.C2324acU;
import o.C8064dAG;
import o.InterfaceC13391fZD;
import o.InterfaceC6627cYe;
import o.YIo;
import o.ZI;
import o.fSJ;
import o.fSQ;
import o.gHK;
import o.glR;
import o.nMh;
/* loaded from: classes5.dex */
public class AccountSummaryFragment extends Hilt_AccountSummaryFragment implements AppBarLayout.ojQ, InterfaceC6627cYe.LWm {
@BindView
DefaultButton accountSummaryAddButton;
@InterfaceC13391fZD
public C2324acU accountSummaryPresenter;
@BindView
CustomProfileImageView cusIvProfile;
private boolean h;
private fSJ i;
@BindView
ImageView ivBgAccountSummary;
@BindView
AppBarLayout mAppBarLayout;
@BindView
TextView tvHomeWelcomeHeadline;
@BindView
TextView tvHomeWelcomeUserName;
private int c = 0;
private boolean d = false;
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
YIo yIo;
View inflate = layoutInflater.inflate(R.layout.2131559435, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
this.accountSummaryPresenter.e((C2324acU) this);
if (getActivity() instanceof HomeActivity) {
((HomeActivity) getActivity()).k = true;
}
((BaseFragment) this).b = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_HIDE_SWIPE_REFRESH")).subscribe(new fSQ(this) { // from class: o.eFl
private AccountSummaryFragment e;
@Override // o.fSQ
public final void c(Object obj) {
AccountSummaryFragment.aqv_(this.e, (Intent) obj);
}
{
this.e = this;
}
}, new fSQ() { // from class: o.eFn
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
this.i = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_PROFILE_UPDATED")).subscribe(new fSQ(this) { // from class: o.eFl
private AccountSummaryFragment e;
@Override // o.fSQ
public final void c(Object obj) {
AccountSummaryFragment.aqv_(this.e, (Intent) obj);
}
{
this.e = this;
}
}, new fSQ() { // from class: o.eFn
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
super.aa();
Z();
u(getString(R.string.account_summary));
this.mAppBarLayout.e(this);
ab();
C2324acU c2324acU = this.accountSummaryPresenter;
if (c2324acU != null) {
C2322acS c2322acS = new C2322acS(c2324acU);
if (c2324acU.f != 0) {
c2322acS.e(c2324acU.f);
}
}
final C2324acU c2324acU2 = this.accountSummaryPresenter;
if (gHK.INDIVIDUAL == (getActivity() instanceof PreLoadCheckActivity ? ((PreLoadCheckActivity) getActivity()).al() : null)) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.acW
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.LWm) obj).j();
}
};
if (c2324acU2.f != 0) {
ieS.e(c2324acU2.f);
}
C8064dAG a = c2324acU2.d.a();
if (a == null || (yIo = a.r) == null || !yIo.y) {
ZI.IeS ieS2 = new ZI.IeS() { // from class: o.adb
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.LWm) obj).e();
}
};
if (c2324acU2.f != 0) {
ieS2.e(c2324acU2.f);
}
} else {
ZI.IeS ieS3 = new ZI.IeS(c2324acU2) { // from class: o.acV
private C2324acU b;
@Override // o.ZI.IeS
public final void e(Object obj) {
C2324acU.e(this.b, (InterfaceC6627cYe.LWm) obj);
}
{
this.b = c2324acU2;
}
};
if (c2324acU2.f != 0) {
ieS3.e(c2324acU2.f);
}
}
} else {
ZI.IeS ieS4 = new ZI.IeS() { // from class: o.ada
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.LWm) obj).h();
}
};
if (c2324acU2.f != 0) {
ieS4.e(c2324acU2.f);
}
ZI.IeS ieS5 = new ZI.IeS() { // from class: o.adb
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.LWm) obj).e();
}
};
if (c2324acU2.f != 0) {
ieS5.e(c2324acU2.f);
}
}
return inflate;
}
@Override // androidx.fragment.app.Fragment
public void onResume() {
super.onResume();
C2324acU c2324acU = this.accountSummaryPresenter;
if (c2324acU.b.b.Q()) {
ZI.IeS ieS = new ZI.IeS() { // from class: o.acT
@Override // o.ZI.IeS
public final void e(Object obj) {
((InterfaceC6627cYe.LWm) obj).d();
}
};
if (c2324acU.f != 0) {
ieS.e(c2324acU.f);
}
c2324acU.b.b.ac();
}
this.h = false;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
this.accountSummaryPresenter.w_();
fSJ fsj = this.i;
if (fsj != null && !fsj.isDisposed()) {
this.i.dispose();
}
super.onDestroy();
}
@Override // com.scb.phone.view.fragment.BaseFragment
public final void aa() {
super.aa();
Z();
u(getString(R.string.account_summary));
}
@Override // com.google.android.material.appbar.AppBarLayout.RVV
public final void c(AppBarLayout appBarLayout, int i) {
C12914fKz.e(new Object[]{appBarLayout, Integer.valueOf(i), new WeakReference(this.mActionBarTitle)}, 650072314, -650072295, i);
}
/* JADX INFO: Access modifiers changed from: package-private */
@OnClick
public void onAddAccountButtonClicked() {
AddAccountConsentActivity.a(getContext());
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onSaveInstanceState(Bundle bundle) {
super.onSaveInstanceState(bundle);
bundle.putString("OUTSTATE_REGISTERED_ACCOUNT", this.accountSummaryPresenter.b.b.z());
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
if (bundle != null) {
this.accountSummaryPresenter.b.b.f(bundle.getString("OUTSTATE_REGISTERED_ACCOUNT"));
}
}
@Override // o.InterfaceC6627cYe.LWm
public final void j() {
Context context = getContext();
if (context != null) {
if (this.accountSummaryPresenter.b.d.d() && !this.accountSummaryPresenter.b.d.e()) {
C12891fKc.azG_(new File(this.accountSummaryPresenter.b.d.c(), BKa.BG_ACCOUNT_SUMMARY.component), this.ivBgAccountSummary, nMh.getDrawable(context, R.drawable.landing_page_header));
}
this.cusIvProfile.setOnClickListener(new View.OnClickListener(this) { // from class: o.eFk
private AccountSummaryFragment b;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
AccountSummaryFragment.e(this.b);
}
{
this.b = this;
}
});
}
}
@Override // o.InterfaceC6627cYe.LWm
public final void h() {
this.accountSummaryAddButton.setVisibility(8);
}
@Override // o.InterfaceC6627cYe.LWm
public final void d() {
C10457eEr.aqd_(this, new Intent("com.scb.phone/BROADCAST_HOME_ACTIVITY_REFRESH"));
}
@Override // o.InterfaceC6627cYe.LWm
public final void a() {
this.cusIvProfile.setBorderState(5);
this.cusIvProfile.setClickable(true);
this.d = false;
}
@Override // o.InterfaceC6627cYe.LWm
public final void c() {
this.cusIvProfile.setBorderState(2);
this.cusIvProfile.setClickable(true);
this.d = true;
}
@Override // o.InterfaceC6627cYe.LWm
public final void b() {
this.cusIvProfile.setBorderState(1);
this.cusIvProfile.setClickable(true);
this.d = false;
}
@Override // o.InterfaceC6627cYe.LWm
public final void e() {
this.cusIvProfile.setClickable(false);
this.cusIvProfile.setBorderState(0);
this.d = false;
}
public static /* synthetic */ void aqv_(AccountSummaryFragment accountSummaryFragment, Intent intent) {
C2324acU c2324acU;
String action = intent.getAction();
if ("com.scb.phone/BROADCAST_HIDE_SWIPE_REFRESH".equals(action)) {
int i = accountSummaryFragment.c + 1;
accountSummaryFragment.c = i;
if (i == 4) {
accountSummaryFragment.u();
accountSummaryFragment.c = 0;
return;
}
return;
}
if (!"com.scb.phone/BROADCAST_PROFILE_UPDATED".equals(action) || (c2324acU = accountSummaryFragment.accountSummaryPresenter) == null) {
return;
}
C2322acS c2322acS = new C2322acS(c2324acU);
if (c2324acU.f != 0) {
c2322acS.e(c2324acU.f);
}
}
public static /* synthetic */ void e(AccountSummaryFragment accountSummaryFragment) {
if (accountSummaryFragment.h) {
return;
}
accountSummaryFragment.h = true;
Intent intent = new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse("scbeasy://justforyou/entrypoint?source=account_summary"));
intent.putExtra("HAS_NEW_INSIGHT", accountSummaryFragment.d);
accountSummaryFragment.startActivity(intent);
}
@Override // o.InterfaceC9013dbh
public final void d(C0391Fn c0391Fn) {
this.cusIvProfile.setImageUrl(c0391Fn.b);
this.tvHomeWelcomeUserName.setText(c0391Fn.h);
this.tvHomeWelcomeHeadline.setText(c0391Fn.c);
}
}