what-the-bank/sources/com/scb/phone/view/fragment/pointx/PaymentMethodCreditSelector...

480 lines
19 KiB
Java

package com.scb.phone.view.fragment.pointx;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.viewpager.widget.ViewPager;
import com.asksira.loopingviewpager.LoopingViewPager;
import com.scb.phone.R;
import com.scb.phone.view.adapter.pointx.PaymentMethodCreditSelectorAdapter;
import com.scb.phone.view.fragment.pointx.PaymentMethodCreditSelectorFragment;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import me.relex.circleindicator.CircleIndicator;
import o.AbstractC13163fSk;
import o.AbstractC14961gcz;
import o.C0367Fb;
import o.C14866gag;
import o.C14881gav;
import o.C14957gcv;
import o.C17431wiQ;
import o.C7308clo;
import o.InterfaceC12877fJu;
import o.InterfaceC13391fZD;
import o.InterfaceC14894gbR;
import o.InterfaceC16541pFg;
import o.InterfaceC9480dkY;
import o.Ule;
import o.fSJ;
import o.fSQ;
import o.glR;
import o.guQ;
import o.nMh;
import o.qeC;
/* loaded from: classes5.dex */
public final class PaymentMethodCreditSelectorFragment extends Hilt_PaymentMethodCreditSelectorFragment implements InterfaceC9480dkY.LWm, PaymentMethodCreditSelectorAdapter.RVV {
public static final HBt d = new HBt(0);
private Ule c;
private InterfaceC12877fJu f;
private fSJ g;
private PaymentMethodCreditSelectorAdapter i;
private String[] j = new String[0];
@InterfaceC13391fZD
public C7308clo presenter;
/* loaded from: classes5.dex */
public static final class HBt {
private HBt() {
}
public /* synthetic */ HBt(byte b) {
this();
}
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
String[] stringArray;
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
C7308clo c7308clo = this.presenter;
C7308clo c7308clo2 = null;
if (c7308clo == null) {
C14957gcv.a("");
c7308clo = null;
}
c7308clo.e((C7308clo) this);
Bundle arguments = getArguments();
if (arguments != null && (stringArray = arguments.getStringArray("EXTRA_ALLOW_TAGS")) != null) {
this.j = stringArray;
}
AbstractC13163fSk<Intent> Ge_ = glR.Ge_(getContext(), new IntentFilter("BROADCAST_CREDIT_CARD_SUMMARY_REFRESH"));
final Sts sts = new Sts(this);
fSQ<? super Intent> fsq = new fSQ(sts) { // from class: o.fsj
private InterfaceC14894gbR e;
@Override // o.fSQ
public final void c(Object obj) {
PaymentMethodCreditSelectorFragment.c(this.e, obj);
}
{
this.e = sts;
}
};
final LWm lWm = LWm.a;
this.g = Ge_.subscribe(fsq, new fSQ(lWm) { // from class: o.fsk
private InterfaceC14894gbR c;
@Override // o.fSQ
public final void c(Object obj) {
PaymentMethodCreditSelectorFragment.e(this.c, obj);
}
{
this.c = lWm;
}
});
C7308clo c7308clo3 = this.presenter;
if (c7308clo3 != null) {
c7308clo2 = c7308clo3;
} else {
C14957gcv.a("");
}
String[] strArr = this.j;
C14957gcv.e(strArr, "");
C17431wiQ c17431wiQ = c7308clo2.b;
C14957gcv.e(strArr, "");
List<String> asList = Arrays.asList(strArr);
C14957gcv.c(asList, "");
c17431wiQ.e(asList, true);
C17431wiQ c17431wiQ2 = c7308clo2.b;
c17431wiQ2.d(c17431wiQ2.i, new C7308clo.HBt(c7308clo2));
}
/* loaded from: classes5.dex */
static final class LWm extends AbstractC14961gcz implements InterfaceC14894gbR<Throwable, C14866gag> {
public static final LWm a = new LWm();
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Throwable th) {
guQ.a(th);
return C14866gag.c;
}
LWm() {
super(1);
}
}
/* loaded from: classes5.dex */
static final class Sts extends AbstractC14961gcz implements InterfaceC14894gbR<Intent, C14866gag> {
private PaymentMethodCreditSelectorFragment a;
@Override // o.InterfaceC14894gbR
public final /* synthetic */ C14866gag invoke(Intent intent) {
PaymentMethodCreditSelectorFragment.e(this.a);
return C14866gag.c;
}
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
Sts(PaymentMethodCreditSelectorFragment paymentMethodCreditSelectorFragment) {
super(1);
this.a = paymentMethodCreditSelectorFragment;
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.scb.phone.view.fragment.pointx.Hilt_PaymentMethodCreditSelectorFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
public final void onAttach(Context context) {
C14957gcv.e(context, "");
super.onAttach(context);
InterfaceC16541pFg parentFragment = getParentFragment();
if (context instanceof InterfaceC12877fJu) {
this.f = (InterfaceC12877fJu) context;
} else if (parentFragment instanceof InterfaceC12877fJu) {
this.f = (InterfaceC12877fJu) parentFragment;
}
}
@Override // o.InterfaceC9480dkY.LWm
public final void e(final ArrayList<C0367Fb> arrayList) {
C14957gcv.e(arrayList, "");
final Ule ule = this.c;
C14957gcv.e(ule);
InterfaceC12877fJu interfaceC12877fJu = this.f;
InterfaceC12877fJu interfaceC12877fJu2 = null;
if (interfaceC12877fJu == null) {
C14957gcv.a("");
interfaceC12877fJu = null;
}
interfaceC12877fJu.d(arrayList);
InterfaceC12877fJu interfaceC12877fJu3 = this.f;
if (interfaceC12877fJu3 == null) {
C14957gcv.a("");
} else {
interfaceC12877fJu2 = interfaceC12877fJu3;
}
interfaceC12877fJu2.b(true);
ule.c.post(new Runnable(this, ule, arrayList) { // from class: o.fsm
private PaymentMethodCreditSelectorFragment a;
private ArrayList b;
private Ule c;
@Override // java.lang.Runnable
public final void run() {
PaymentMethodCreditSelectorFragment.d(this.a, this.c, this.b);
}
{
this.a = this;
this.c = ule;
this.b = arrayList;
}
});
}
/* loaded from: classes5.dex */
public static final class RVV implements ViewPager.ojQ {
private ArrayList<C0367Fb> b;
private PaymentMethodCreditSelectorFragment c;
@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) {
}
RVV(PaymentMethodCreditSelectorFragment paymentMethodCreditSelectorFragment, ArrayList<C0367Fb> arrayList) {
this.c = paymentMethodCreditSelectorFragment;
this.b = arrayList;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
PaymentMethodCreditSelectorFragment paymentMethodCreditSelectorFragment = this.c;
C0367Fb c0367Fb = this.b.get(i);
C14957gcv.c(c0367Fb, "");
paymentMethodCreditSelectorFragment.d(c0367Fb, i);
}
}
private final void d(int i) {
Ule ule = this.c;
C14957gcv.e(ule);
int[] iArr = {i - 1, i, i + 1};
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter = null;
if (i == 0) {
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter2 = this.i;
if (paymentMethodCreditSelectorAdapter2 == null) {
C14957gcv.a("");
} else {
paymentMethodCreditSelectorAdapter = paymentMethodCreditSelectorAdapter2;
}
ule.b.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0, paymentMethodCreditSelectorAdapter.getCount() != 1 ? getResources().getDimensionPixelOffset(R.dimen.f28512131166617) : 0, 0);
} else {
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter3 = this.i;
if (paymentMethodCreditSelectorAdapter3 == null) {
C14957gcv.a("");
} else {
paymentMethodCreditSelectorAdapter = paymentMethodCreditSelectorAdapter3;
}
if (i == paymentMethodCreditSelectorAdapter.getCount() - 1) {
ule.b.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0, getResources().getDimensionPixelOffset(R.dimen.f28522131166618), 0);
} else {
ule.b.setPadding(getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0, getResources().getDimensionPixelOffset(R.dimen.f28502131166616), 0);
}
}
for (int i2 = 0; i2 < 3; i2++) {
int i3 = iArr[i2];
View findViewWithTag = ule.b.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER".concat(String.valueOf(i3)));
TextView textView = (TextView) ule.b.findViewWithTag("TAG_ACCOUNT_SOURCE_ADAPTER_TEXT".concat(String.valueOf(i3)));
Context context = ule.b.getContext();
if (findViewWithTag != null && textView != null) {
if (i == i3) {
findViewWithTag.setBackground(nMh.getDrawable(context, R.drawable.rounded_purple_view_pager));
textView.setTextColor(nMh.getColor(context, R.color.f2982131099805));
} else {
findViewWithTag.setBackground(nMh.getDrawable(context, f()));
textView.setTextColor(nMh.getColor(context, R.color.f3092131099816));
}
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d(C0367Fb c0367Fb, int i) {
d(i);
InterfaceC12877fJu interfaceC12877fJu = this.f;
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter = null;
if (interfaceC12877fJu == null) {
C14957gcv.a("");
interfaceC12877fJu = null;
}
interfaceC12877fJu.d(c0367Fb, true);
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter2 = this.i;
if (paymentMethodCreditSelectorAdapter2 == null) {
C14957gcv.a("");
} else {
paymentMethodCreditSelectorAdapter = paymentMethodCreditSelectorAdapter2;
}
paymentMethodCreditSelectorAdapter.c = i;
}
@Override // com.scb.phone.view.adapter.pointx.PaymentMethodCreditSelectorAdapter.RVV
public final void b(C0367Fb c0367Fb, int i) {
Ule ule = this.c;
C14957gcv.e(ule);
ule.b.setCurrentItem(i, true);
if (c0367Fb != null) {
d(c0367Fb, i);
}
}
@Override // o.InterfaceC9480dkY.LWm
public final void e() {
Ule ule = this.c;
C14957gcv.e(ule);
CircleIndicator circleIndicator = ule.a;
C14957gcv.c(circleIndicator, "");
CircleIndicator circleIndicator2 = circleIndicator;
C14957gcv.e(circleIndicator2, "");
circleIndicator2.setVisibility(8);
}
@Override // o.InterfaceC9480dkY.LWm
public final void d() {
Ule ule = this.c;
C14957gcv.e(ule);
CircleIndicator circleIndicator = ule.a;
C14957gcv.c(circleIndicator, "");
CircleIndicator circleIndicator2 = circleIndicator;
C14957gcv.e(circleIndicator2, "");
circleIndicator2.setVisibility(0);
}
@Override // o.InterfaceC9480dkY.LWm
public final void a() {
InterfaceC12877fJu interfaceC12877fJu = this.f;
if (interfaceC12877fJu == null) {
C14957gcv.a("");
interfaceC12877fJu = null;
}
interfaceC12877fJu.b(false);
interfaceC12877fJu.g();
}
@Override // o.InterfaceC9480dkY.LWm
public final void c() {
InterfaceC12877fJu interfaceC12877fJu = this.f;
if (interfaceC12877fJu == null) {
C14957gcv.a("");
interfaceC12877fJu = null;
}
interfaceC12877fJu.b(false);
interfaceC12877fJu.d(new ArrayList<>());
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroyView() {
C7308clo c7308clo = null;
this.c = null;
C7308clo c7308clo2 = this.presenter;
if (c7308clo2 != null) {
c7308clo = c7308clo2;
} else {
C14957gcv.a("");
}
c7308clo.w_();
super.onDestroyView();
}
public static /* synthetic */ void d(PaymentMethodCreditSelectorFragment paymentMethodCreditSelectorFragment, Ule ule, ArrayList arrayList) {
C14957gcv.e(paymentMethodCreditSelectorFragment, "");
C14957gcv.e(ule, "");
C14957gcv.e(arrayList, "");
Context context = ule.c.getContext();
C14957gcv.c(context, "");
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter = new PaymentMethodCreditSelectorAdapter(context, arrayList);
paymentMethodCreditSelectorFragment.i = paymentMethodCreditSelectorAdapter;
paymentMethodCreditSelectorAdapter.e = paymentMethodCreditSelectorFragment;
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter2 = paymentMethodCreditSelectorFragment.i;
InterfaceC12877fJu interfaceC12877fJu = null;
if (paymentMethodCreditSelectorAdapter2 == null) {
C14957gcv.a("");
paymentMethodCreditSelectorAdapter2 = null;
}
Bundle arguments = paymentMethodCreditSelectorFragment.getArguments();
paymentMethodCreditSelectorAdapter2.a = (arguments == null || !arguments.getBoolean("EXTRA_PARENT_TRANSPARENT_BACKGROUND")) ? R.drawable.bg_white_rounded_with_border : R.drawable.bg_white_rounded;
ule.b.addOnPageChangeListener(new RVV(paymentMethodCreditSelectorFragment, arrayList));
LoopingViewPager loopingViewPager = ule.b;
PaymentMethodCreditSelectorAdapter paymentMethodCreditSelectorAdapter3 = paymentMethodCreditSelectorFragment.i;
if (paymentMethodCreditSelectorAdapter3 == null) {
C14957gcv.a("");
paymentMethodCreditSelectorAdapter3 = null;
}
loopingViewPager.setAdapter(paymentMethodCreditSelectorAdapter3);
ule.b.setClipToPadding(false);
if (arrayList.size() == 1) {
ule.b.setPadding(paymentMethodCreditSelectorFragment.getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, 0, 0);
} else {
ule.b.setPadding(paymentMethodCreditSelectorFragment.getResources().getDimensionPixelOffset(R.dimen.f28532131166619), 0, paymentMethodCreditSelectorFragment.getResources().getDimensionPixelOffset(R.dimen.f28512131166617), 0);
}
ule.a.setViewPager(ule.b);
ule.b.setCurrentItem(0);
InterfaceC12877fJu interfaceC12877fJu2 = paymentMethodCreditSelectorFragment.f;
if (interfaceC12877fJu2 == null) {
C14957gcv.a("");
} else {
interfaceC12877fJu = interfaceC12877fJu2;
}
interfaceC12877fJu.d((C0367Fb) C14881gav.e((List) arrayList), false);
if (arrayList.size() >= 10) {
CircleIndicator circleIndicator = ule.a;
C14957gcv.c(circleIndicator, "");
CircleIndicator circleIndicator2 = circleIndicator;
C14957gcv.e(circleIndicator2, "");
circleIndicator2.setVisibility(8);
} else {
CircleIndicator circleIndicator3 = ule.a;
C14957gcv.c(circleIndicator3, "");
CircleIndicator circleIndicator4 = circleIndicator3;
C14957gcv.e(circleIndicator4, "");
circleIndicator4.setVisibility(0);
}
LinearLayout linearLayout = ule.c;
C14957gcv.c(linearLayout, "");
LinearLayout linearLayout2 = linearLayout;
C14957gcv.e(linearLayout2, "");
linearLayout2.setVisibility(0);
}
public static /* synthetic */ void c(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
public static /* synthetic */ void e(InterfaceC14894gbR interfaceC14894gbR, Object obj) {
C14957gcv.e(interfaceC14894gbR, "");
interfaceC14894gbR.invoke(obj);
}
public static final /* synthetic */ void e(PaymentMethodCreditSelectorFragment paymentMethodCreditSelectorFragment) {
C7308clo c7308clo = paymentMethodCreditSelectorFragment.presenter;
if (c7308clo == null) {
C14957gcv.a("");
c7308clo = null;
}
String[] strArr = paymentMethodCreditSelectorFragment.j;
C14957gcv.e(strArr, "");
C17431wiQ c17431wiQ = c7308clo.b;
C14957gcv.e(strArr, "");
List<String> asList = Arrays.asList(strArr);
C14957gcv.c(asList, "");
c17431wiQ.e(asList);
C17431wiQ c17431wiQ2 = c7308clo.b;
c17431wiQ2.d(c17431wiQ2.i, new C7308clo.HBt(c7308clo));
}
private final int f() {
Bundle arguments = getArguments();
return (arguments == null || !arguments.getBoolean("EXTRA_PARENT_TRANSPARENT_BACKGROUND")) ? R.drawable.bg_white_rounded_with_border : R.drawable.bg_white_rounded;
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
View inflate = layoutInflater.inflate(R.layout.2131559807, viewGroup, false);
int i = R.id.ci_card_indicator;
CircleIndicator circleIndicator = (CircleIndicator) qeC.e(inflate, R.id.ci_card_indicator);
if (circleIndicator != null) {
i = R.id.ll_layout_cards;
LinearLayout linearLayout = (LinearLayout) qeC.e(inflate, R.id.ll_layout_cards);
if (linearLayout != null) {
i = R.id.vp_card;
LoopingViewPager loopingViewPager = (LoopingViewPager) qeC.e(inflate, R.id.vp_card);
if (loopingViewPager != null) {
Ule ule = new Ule((LinearLayout) inflate, circleIndicator, linearLayout, loopingViewPager);
this.c = ule;
C14957gcv.e(ule);
LinearLayout linearLayout2 = ule.d;
C14957gcv.c(linearLayout2, "");
return linearLayout2;
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
}