package com.scb.phone.view.fragment.transferandpay; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import androidx.appcompat.widget.LinearLayoutCompat; import androidx.viewpager.widget.ViewPager; import butterknife.BindView; import butterknife.ButterKnife; import com.asksira.loopingviewpager.LoopingViewPager; import com.huawei.hms.support.api.entity.common.CommonConstant; import com.rd.PageIndicatorView; import com.scb.phone.R; import com.scb.phone.view.fragment.BaseFragment; import java.util.ArrayList; import java.util.List; import java.util.Set; import o.C0375Fe; import o.C12486ezC; import o.C14930gcM; import o.C14957gcv; import o.C6231cMo; import o.C6232cMp; import o.InterfaceC13391fZD; import o.InterfaceC9661dnx; import o.ZI; import o.guQ; import o.pug; /* loaded from: classes5.dex */ public final class ContextualAdsFragment extends Hilt_ContextualAdsFragment implements InterfaceC9661dnx { public static final IeS d = new IeS(0); private ArrayList c; @BindView public LinearLayoutCompat contextualAdsLayout; private String f; private boolean g; private C12486ezC h; private final LWm i = new LWm(this); @BindView public PageIndicatorView indicator; private String j; private LoopingViewPager l; @BindView public LinearLayout layoutIndicator; @BindView public LinearLayoutCompat llSingleDot; /* renamed from: o, reason: collision with root package name */ private String f8073o; @InterfaceC13391fZD public C6231cMo presenter; @BindView public LoopingViewPager viewPagerAutoScroll; @BindView public LoopingViewPager viewPagerNotAutoScroll; /* loaded from: classes5.dex */ public static final class IeS { private IeS() { } public static ContextualAdsFragment a(String str, List list, String str2, String str3, boolean z) { ContextualAdsFragment contextualAdsFragment = new ContextualAdsFragment(); Bundle bundle = new Bundle(); bundle.putString("ADS_TRANSFER_FUNCTION", str); bundle.putString("ADS_TYPE", str2); bundle.putString("ADS_FIREBASE_EVENT_NAME", str3); bundle.putBoolean("ADS_IS_AUTO_SCROLL", z); bundle.putParcelableArrayList("ADS_BANNER_LIST_EXTRA_KEY", new ArrayList<>(list)); contextualAdsFragment.setArguments(bundle); return contextualAdsFragment; } public /* synthetic */ IeS(byte b) { this(); } } @Override // androidx.fragment.app.Fragment public final void onCreate(Bundle bundle) { super.onCreate(bundle); Bundle arguments = getArguments(); if (arguments != null) { String string = arguments.getString("ADS_TRANSFER_FUNCTION", "TRANSFER"); C14957gcv.c((Object) string, ""); this.f8073o = string; this.c = arguments.getParcelableArrayList("ADS_BANNER_LIST_EXTRA_KEY"); String string2 = arguments.getString("ADS_TYPE", "ADS_TRANSFER_TYPE"); C14957gcv.c((Object) string2, ""); this.f = string2; this.j = arguments.getString("ADS_FIREBASE_EVENT_NAME", null); this.g = arguments.getBoolean("ADS_IS_AUTO_SCROLL", false); } } @Override // androidx.fragment.app.Fragment public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { C14957gcv.e(layoutInflater, ""); View inflate = layoutInflater.inflate(R.layout.2131559517, viewGroup, false); ((BaseFragment) this).a = ButterKnife.c(this, inflate); final C6231cMo c6231cMo = this.presenter; String str = null; if (c6231cMo == null) { C14957gcv.a(""); c6231cMo = null; } c6231cMo.e((C6231cMo) this); String str2 = this.f8073o; if (str2 == null) { C14957gcv.a(""); str2 = null; } final ArrayList arrayList = this.c; String str3 = this.f; if (str3 == null) { C14957gcv.a(""); } else { str = str3; } String str4 = this.j; C14957gcv.e(str2, ""); C14957gcv.e(str, ""); c6231cMo.b = str2; c6231cMo.e = str; c6231cMo.d = str4; if (arrayList != null) { c6231cMo.c = arrayList; ZI.IeS ieS = new ZI.IeS(arrayList, c6231cMo) { // from class: o.cMw private C6231cMo d; private ArrayList e; @Override // o.ZI.IeS public final void e(Object obj) { C6231cMo.d(this.e, this.d, (InterfaceC9661dnx) obj); } { this.e = arrayList; this.d = c6231cMo; } }; if (c6231cMo.f != 0) { ieS.e(c6231cMo.f); } } C14957gcv.c(inflate, ""); return inflate; } @Override // androidx.fragment.app.Fragment public final void onResume() { super.onResume(); LoopingViewPager loopingViewPager = this.l; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } loopingViewPager.a.postDelayed(loopingViewPager.c, loopingViewPager.b); } @Override // androidx.fragment.app.Fragment public final void onPause() { super.onPause(); LoopingViewPager loopingViewPager = this.l; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } loopingViewPager.a.removeCallbacks(loopingViewPager.c); } @Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment public final void onDestroy() { super.onDestroy(); LoopingViewPager loopingViewPager = this.l; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } loopingViewPager.a.removeCallbacks(loopingViewPager.c); } @Override // o.InterfaceC9661dnx public final void b(List list) { C14957gcv.e(list, ""); C6231cMo c6231cMo = this.presenter; LoopingViewPager loopingViewPager = null; if (c6231cMo == null) { C14957gcv.a(""); c6231cMo = null; } final boolean z = this.g; ZI.IeS ieS = new ZI.IeS(z) { // from class: o.cMq private boolean c; @Override // o.ZI.IeS public final void e(Object obj) { C6231cMo.c(this.c, (InterfaceC9661dnx) obj); } { this.c = z; } }; if (c6231cMo.f != 0) { ieS.e(c6231cMo.f); } Context context = getContext(); if (context != null) { this.h = new C12486ezC(context, list, this.i); C6231cMo c6231cMo2 = this.presenter; if (c6231cMo2 == null) { C14957gcv.a(""); c6231cMo2 = null; } String str = this.f; if (str == null) { C14957gcv.a(""); str = null; } int size = list.size(); C14957gcv.e(str, ""); C6232cMp c6232cMp = new C6232cMp(str, size, 0); if (c6231cMo2.f != 0) { c6232cMp.e(c6231cMo2.f); } LoopingViewPager loopingViewPager2 = this.l; if (loopingViewPager2 == null) { C14957gcv.a(""); } else { loopingViewPager = loopingViewPager2; } loopingViewPager.addOnPageChangeListener(new Sts(this)); } } /* loaded from: classes5.dex */ public static final class Sts implements ViewPager.ojQ { private ContextualAdsFragment 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) { } Sts(ContextualAdsFragment contextualAdsFragment) { this.e = contextualAdsFragment; } @Override // androidx.viewpager.widget.ViewPager.ojQ public final void onPageSelected(int i) { PageIndicatorView pageIndicatorView = this.e.indicator; C12486ezC c12486ezC = null; if (pageIndicatorView == null) { C14957gcv.a(""); pageIndicatorView = null; } C12486ezC c12486ezC2 = this.e.h; if (c12486ezC2 == null) { C14957gcv.a(""); } else { c12486ezC = c12486ezC2; } int i2 = i - 1; List list = c12486ezC.e; pageIndicatorView.setSelected(i2 % ((list == null || list.isEmpty()) ? 0 : c12486ezC.e.size())); } } @Override // o.InterfaceC9661dnx public final void h() { LoopingViewPager loopingViewPager = this.viewPagerNotAutoScroll; LoopingViewPager loopingViewPager2 = null; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } LoopingViewPager loopingViewPager3 = loopingViewPager; C14957gcv.e(loopingViewPager3, ""); loopingViewPager3.setVisibility(0); LoopingViewPager loopingViewPager4 = this.viewPagerAutoScroll; if (loopingViewPager4 == null) { C14957gcv.a(""); loopingViewPager4 = null; } LoopingViewPager loopingViewPager5 = loopingViewPager4; C14957gcv.e(loopingViewPager5, ""); loopingViewPager5.setVisibility(8); LoopingViewPager loopingViewPager6 = this.viewPagerNotAutoScroll; if (loopingViewPager6 != null) { loopingViewPager2 = loopingViewPager6; } else { C14957gcv.a(""); } this.l = loopingViewPager2; } @Override // o.InterfaceC9661dnx public final void c() { LoopingViewPager loopingViewPager = this.viewPagerNotAutoScroll; LoopingViewPager loopingViewPager2 = null; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } LoopingViewPager loopingViewPager3 = loopingViewPager; C14957gcv.e(loopingViewPager3, ""); loopingViewPager3.setVisibility(8); LoopingViewPager loopingViewPager4 = this.viewPagerAutoScroll; if (loopingViewPager4 == null) { C14957gcv.a(""); loopingViewPager4 = null; } LoopingViewPager loopingViewPager5 = loopingViewPager4; C14957gcv.e(loopingViewPager5, ""); loopingViewPager5.setVisibility(0); LoopingViewPager loopingViewPager6 = this.viewPagerAutoScroll; if (loopingViewPager6 != null) { loopingViewPager2 = loopingViewPager6; } else { C14957gcv.a(""); } this.l = loopingViewPager2; } @Override // o.InterfaceC9661dnx public final void d() { LoopingViewPager loopingViewPager = this.l; C12486ezC c12486ezC = null; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } loopingViewPager.setOffscreenPageLimit(3); C12486ezC c12486ezC2 = this.h; if (c12486ezC2 == null) { C14957gcv.a(""); } else { c12486ezC = c12486ezC2; } loopingViewPager.setAdapter(c12486ezC); loopingViewPager.setPadding(loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17332131165499), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17242131165490), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17332131165499), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17242131165490)); loopingViewPager.setPageMargin(loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f16582131165424)); } @Override // o.InterfaceC9661dnx public final void b() { LoopingViewPager loopingViewPager = this.l; C12486ezC c12486ezC = null; if (loopingViewPager == null) { C14957gcv.a(""); loopingViewPager = null; } int dimension = (int) loopingViewPager.getContext().getResources().getDimension(R.dimen.f17612131165527); int dimension2 = (int) loopingViewPager.getContext().getResources().getDimension(R.dimen.f15722131165338); loopingViewPager.getLayoutParams().height = dimension2; C12486ezC c12486ezC2 = this.h; if (c12486ezC2 == null) { C14957gcv.a(""); c12486ezC2 = null; } c12486ezC2.d = Integer.valueOf(dimension2); c12486ezC2.b = Integer.valueOf(dimension); c12486ezC2.f = Integer.valueOf(R.drawable.ic_contextual_ads_placeholder); loopingViewPager.setOffscreenPageLimit(3); C12486ezC c12486ezC3 = this.h; if (c12486ezC3 == null) { C14957gcv.a(""); } else { c12486ezC = c12486ezC3; } loopingViewPager.setAdapter(c12486ezC); loopingViewPager.setPadding(loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17472131165513), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17242131165490), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17472131165513), loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f17242131165490)); loopingViewPager.setPageMargin(loopingViewPager.getResources().getDimensionPixelOffset(R.dimen.f16582131165424)); } @Override // o.InterfaceC9661dnx public final void e(int i, int i2) { LinearLayoutCompat linearLayoutCompat = this.llSingleDot; PageIndicatorView pageIndicatorView = null; if (linearLayoutCompat == null) { C14957gcv.a(""); linearLayoutCompat = null; } LinearLayoutCompat linearLayoutCompat2 = linearLayoutCompat; C14957gcv.e(linearLayoutCompat2, ""); linearLayoutCompat2.setVisibility(8); LinearLayout linearLayout = this.layoutIndicator; if (linearLayout == null) { C14957gcv.a(""); linearLayout = null; } LinearLayout linearLayout2 = linearLayout; boolean z = i > 1; C14957gcv.e(linearLayout2, ""); linearLayout2.setVisibility(z ? 0 : 8); PageIndicatorView pageIndicatorView2 = this.indicator; if (pageIndicatorView2 == null) { C14957gcv.a(""); pageIndicatorView2 = null; } pageIndicatorView2.setCount(i); PageIndicatorView pageIndicatorView3 = this.indicator; if (pageIndicatorView3 != null) { pageIndicatorView = pageIndicatorView3; } else { C14957gcv.a(""); } pageIndicatorView.setSelected(i2); } @Override // o.InterfaceC9661dnx public final void a() { LinearLayoutCompat linearLayoutCompat = this.llSingleDot; LinearLayout linearLayout = null; if (linearLayoutCompat == null) { C14957gcv.a(""); linearLayoutCompat = null; } LinearLayoutCompat linearLayoutCompat2 = linearLayoutCompat; C14957gcv.e(linearLayoutCompat2, ""); linearLayoutCompat2.setVisibility(0); LinearLayout linearLayout2 = this.layoutIndicator; if (linearLayout2 != null) { linearLayout = linearLayout2; } else { C14957gcv.a(""); } LinearLayout linearLayout3 = linearLayout; C14957gcv.e(linearLayout3, ""); linearLayout3.setVisibility(8); } @Override // o.InterfaceC9661dnx public final void e() { LinearLayoutCompat linearLayoutCompat = this.contextualAdsLayout; if (linearLayoutCompat == null) { C14957gcv.a(""); linearLayoutCompat = null; } linearLayoutCompat.setVisibility(8); } @Override // o.InterfaceC9661dnx public final void e(String str) { C14957gcv.e(str, ""); try { startActivity(new Intent(CommonConstant.ACTION.HWID_SCHEME_URL, Uri.parse(str))); } catch (ActivityNotFoundException e) { guQ.e(e, "Not able to open deeplink url: %s", str); } } @Override // o.InterfaceC9661dnx public final void b(List list, int i) { C14957gcv.e(list, ""); C12486ezC c12486ezC = this.h; String str = null; if (c12486ezC == null) { C14957gcv.a(""); c12486ezC = null; } C14957gcv.e(list, ""); c12486ezC.e = list; c12486ezC.c(list); C6231cMo c6231cMo = this.presenter; if (c6231cMo == null) { C14957gcv.a(""); c6231cMo = null; } String str2 = this.f; if (str2 == null) { C14957gcv.a(""); } else { str = str2; } int size = list.size(); C14957gcv.e(str, ""); C6232cMp c6232cMp = new C6232cMp(str, size, i); if (c6231cMo.f != 0) { c6232cMp.e(c6231cMo.f); } } @Override // o.InterfaceC9661dnx public final void c(String str, String str2, String str3, String str4) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); C14957gcv.e(str4, ""); c("slip_banner", new pug("location", str), new pug("user_action", str2), new pug("ads_id", str3), new pug("ads_name", str4)); } @Override // o.InterfaceC9661dnx public final void c(String str, String str2, String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); C14957gcv.e(str3, ""); c(str, new pug("ads_name", str3), new pug("ads_id", str2)); } /* loaded from: classes5.dex */ public static final class LWm implements C12486ezC.RVV { private ContextualAdsFragment e; LWm(ContextualAdsFragment contextualAdsFragment) { this.e = contextualAdsFragment; } @Override // o.C12486ezC.RVV public final void c(final String str, final String str2, final String str3) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); final C6231cMo c6231cMo = this.e.presenter; if (c6231cMo == null) { C14957gcv.a(""); c6231cMo = null; } C14957gcv.e(str, ""); C14957gcv.e(str2, ""); ZI.IeS ieS = new ZI.IeS(c6231cMo, str, str2, str3) { // from class: o.cMA private String a; private C6231cMo b; private String c; private String e; @Override // o.ZI.IeS public final void e(Object obj) { C6231cMo.a(this.b, this.e, this.a, this.c, (InterfaceC9661dnx) obj); } { this.b = c6231cMo; this.e = str; this.a = str2; this.c = str3; } }; if (c6231cMo.f != 0) { ieS.e(c6231cMo.f); } } @Override // o.C12486ezC.RVV public final void d(final String str, final String str2, int i) { C14957gcv.e(str, ""); C14957gcv.e(str2, ""); final C6231cMo c6231cMo = this.e.presenter; ArrayList arrayList = null; if (c6231cMo == null) { C14957gcv.a(""); c6231cMo = null; } C14957gcv.e(str, ""); C14957gcv.e(str2, ""); Set g = c6231cMo.a.a.g(); if (!g.contains(str)) { g.add(str); c6231cMo.a.a.a(g); } ArrayList arrayList2 = c6231cMo.c; if (arrayList2 == null) { C14957gcv.a(""); arrayList2 = null; } ArrayList arrayList3 = new ArrayList(); for (Object obj : arrayList2) { if (!C14957gcv.b((Object) ((C0375Fe) obj).b, (Object) str)) { arrayList3.add(obj); } } ArrayList arrayList4 = arrayList3; C14957gcv.e(arrayList4, ""); ArrayList arrayList5 = new ArrayList<>(arrayList4); c6231cMo.c = arrayList5; if (arrayList5.isEmpty()) { ZI.IeS ieS = new ZI.IeS() { // from class: o.cMs @Override // o.ZI.IeS public final void e(Object obj2) { ((InterfaceC9661dnx) obj2).e(); } }; if (c6231cMo.f != 0) { ieS.e(c6231cMo.f); } } else { final C14930gcM.IeS ieS2 = new C14930gcM.IeS(); ieS2.b = i; ArrayList arrayList6 = c6231cMo.c; if (arrayList6 == null) { C14957gcv.a(""); } else { arrayList = arrayList6; } if (i >= arrayList.size()) { ieS2.b = 0; } ZI.IeS ieS3 = new ZI.IeS(c6231cMo, ieS2) { // from class: o.cMt private C6231cMo b; private C14930gcM.IeS e; @Override // o.ZI.IeS public final void e(Object obj2) { C6231cMo.b(this.b, this.e, (InterfaceC9661dnx) obj2); } { this.b = c6231cMo; this.e = ieS2; } }; if (c6231cMo.f != 0) { ieS3.e(c6231cMo.f); } } ZI.IeS ieS4 = new ZI.IeS(c6231cMo, str, str2) { // from class: o.cMm private String c; private C6231cMo d; private String e; @Override // o.ZI.IeS public final void e(Object obj2) { C6231cMo.e(this.d, this.c, this.e, (InterfaceC9661dnx) obj2); } { this.d = c6231cMo; this.c = str; this.e = str2; } }; if (c6231cMo.f != 0) { ieS4.e(c6231cMo.f); } } } public static final ContextualAdsFragment a(String str, List list, String str2) { return IeS.a(str, list, str2, null, false); } }