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

195 lines
6.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.accountsummary;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.view.activity.BaseActivity;
import com.scb.phone.view.activity.prepaid.PrepaidDetailsActivity;
import com.scb.phone.view.adapter.accountsummary.PrepaidViewPagerAdapter;
import com.scb.phone.view.fragment.BaseFragment;
import com.scb.phone.view.fragment.accountsummary.PrepaidFragment;
import java.util.List;
import o.C1049Un;
import o.C1054Up;
import o.C14957gcv;
import o.C15296gmk;
import o.C2448aem;
import o.Dwh;
import o.InterfaceC13391fZD;
import o.InterfaceC15309gmx;
import o.InterfaceC6627cYe;
import o.fSJ;
import o.fSQ;
import o.glR;
import org.greenrobot.eventbus.ThreadMode;
/* loaded from: classes5.dex */
public class PrepaidFragment extends Hilt_PrepaidFragment implements InterfaceC6627cYe.jNh, PrepaidViewPagerAdapter.IeS {
private Dwh f;
private fSJ g;
private C1054Up h;
private PrepaidViewPagerAdapter i;
@InterfaceC13391fZD
public C2448aem prepaidCardPresenter;
@Override // androidx.fragment.app.Fragment
public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
View inflate = layoutInflater.inflate(R.layout.2131559443, viewGroup, false);
((BaseFragment) this).a = ButterKnife.c(this, inflate);
((BaseFragment) this).b = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_SWIPE_REFRESH")).subscribe(new fSQ(this) { // from class: o.eGf
private PrepaidFragment a;
@Override // o.fSQ
public final void c(Object obj) {
this.a.prepaidCardPresenter.d();
}
{
this.a = this;
}
}, new fSQ() { // from class: o.eGe
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
((BaseCardFragment) this).d = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_HOME_ACTIVITY_REFRESH")).subscribe(new fSQ(this) { // from class: o.eGn
private PrepaidFragment b;
@Override // o.fSQ
public final void c(Object obj) {
this.b.prepaidCardPresenter.d();
}
{
this.b = this;
}
}, new fSQ() { // from class: o.eGe
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
((BaseCardFragment) this).j = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_REGISTERED_ACCOUNTS_UPDATED")).subscribe(new fSQ(this) { // from class: o.eGp
private PrepaidFragment e;
@Override // o.fSQ
public final void c(Object obj) {
this.e.prepaidCardPresenter.d();
}
{
this.e = this;
}
}, new fSQ() { // from class: o.eGe
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
this.g = glR.Ge_(getContext(), new IntentFilter("com.scb.phone/BROADCAST_PREPAID_LOCK_CARD_REFRESH")).subscribe(new fSQ(this) { // from class: o.eGl
private PrepaidFragment c;
@Override // o.fSQ
public final void c(Object obj) {
this.c.prepaidCardPresenter.d();
}
{
this.c = this;
}
}, new fSQ() { // from class: o.eGe
@Override // o.fSQ
public final void c(Object obj) {
guQ.a((Throwable) obj);
}
});
C15296gmk.b().a(this);
this.prepaidCardPresenter.e((C2448aem) this);
this.f = new Dwh();
return inflate;
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onActivityCreated(Bundle bundle) {
super.onActivityCreated(bundle);
this.prepaidCardPresenter.d();
}
@Override // com.scb.phone.view.fragment.accountsummary.BaseCardFragment, com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public void onDestroy() {
C2448aem c2448aem = this.prepaidCardPresenter;
if (c2448aem != null) {
c2448aem.w_();
}
fSJ fsj = this.g;
if (fsj != null && !fsj.isDisposed()) {
this.g.dispose();
}
C15296gmk.b().b(this);
super.onDestroy();
}
@InterfaceC15309gmx(e = ThreadMode.MAIN)
public void onBlockOnlinePaymentToggleClicked(C1049Un c1049Un) {
int i = this.prepaidCardPresenter.a;
C1049Un c1049Un2 = this.h.a.get(i);
String str = c1049Un.a;
C14957gcv.e(str, "");
c1049Un2.a = str;
String str2 = c1049Un.b;
C14957gcv.e(str2, "");
c1049Un2.b = str2;
this.h.a.set(i, c1049Un2);
c(this.h);
}
@Override // com.scb.phone.view.adapter.accountsummary.PrepaidViewPagerAdapter.IeS
public final void d(int i) {
this.prepaidCardPresenter.a = i;
C1049Un c1049Un = this.i.a.get(i);
this.f.d("cardtype", C2448aem.d(c1049Un) ? "prepaid_planetscb" : "prepaid_m");
Dwh dwh = this.f;
if (getActivity() != null) {
dwh.c(((BaseActivity) getActivity()).scbAnalytics, "accountsummary_prepaid");
}
startActivity(PrepaidDetailsActivity.akF_(getContext(), this.h, c1049Un, i));
}
@Override // o.InterfaceC6627cYe.jNh
public final void c(C1054Up c1054Up) {
this.h = c1054Up;
List<C1049Un> list = c1054Up.a;
if (list.isEmpty()) {
RelativeLayout relativeLayout = this.mParentLayout;
if (relativeLayout != null) {
relativeLayout.setVisibility(8);
return;
}
return;
}
if (getContext() != null) {
this.i = new PrepaidViewPagerAdapter(getContext(), list, this);
this.mViewPager.setAdapter(this.i);
this.mViewPager.setClipToPadding(false);
this.mViewPager.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0, getResources().getDimensionPixelOffset(R.dimen.f28542131166620), 0);
this.mCircleIndicator.setViewPager(this.mViewPager);
if (list.size() >= 10) {
this.mCircleIndicator.setVisibility(8);
} else {
this.mCircleIndicator.setVisibility(0);
}
RelativeLayout relativeLayout2 = this.mParentLayout;
if (relativeLayout2 != null) {
relativeLayout2.setVisibility(0);
}
}
}
}