what-the-bank/sources/com/scb/phone/view/fragment/cardmanagement/DeejungPlansFragment.java

310 lines
13 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.fragment.cardmanagement;
import android.content.Context;
import android.os.Build;
import android.os.Bundle;
import android.os.Parcelable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.HorizontalScrollView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.fragment.app.FragmentActivity;
import androidx.viewpager.widget.ViewPager;
import com.scb.phone.R;
import com.scb.phone.view.custom.common.FragmentWrapContentViewPager;
import com.scb.phone.view.fragment.cardmanagement.DeejungPlansFragment;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import o.C0367Fb;
import o.C0433Gl;
import o.C1048UmV;
import o.C12061erB;
import o.C14957gcv;
import o.InterfaceC10041dvK;
import o.InterfaceC9073dco;
import o.NRl;
import o.SDK;
import o.qeC;
import o.yRS;
/* loaded from: classes5.dex */
public final class DeejungPlansFragment extends Hilt_DeejungPlansFragment {
public static final LWm d = new LWm(0);
public InterfaceC9073dco c;
private C1048UmV f;
private InterfaceC10041dvK g;
private C0367Fb h;
private boolean i;
private ViewPager.ojQ j = new RVV(this);
/* loaded from: classes5.dex */
public static final class LWm {
private LWm() {
}
public static DeejungPlansFragment a(List<C0433Gl> list, C0367Fb c0367Fb, Boolean bool) {
C14957gcv.e(list, "");
DeejungPlansFragment deejungPlansFragment = new DeejungPlansFragment();
Bundle bundle = new Bundle();
ArrayList<? extends Parcelable> arrayList = new ArrayList<>();
arrayList.addAll(list);
bundle.putParcelableArrayList("com.scb.phone.view.fragment.card_management.KEY_DEEJUNG_PLAN_DISPLAY_MODELS", arrayList);
bundle.putParcelable("com.scb.phone.view.activity.card_management.DeejungPlansActivity.KEY_CREDIT_CARD_DISPLAY", c0367Fb);
bundle.putBoolean("com.scb.phone.view.fragment.card_management.KEY_IS_FROM_DEEJUNG_INSTALLMENT", bool != null ? bool.booleanValue() : true);
deejungPlansFragment.setArguments(bundle);
return deejungPlansFragment;
}
public /* synthetic */ LWm(byte b) {
this();
}
}
@Override // androidx.fragment.app.Fragment
public final void onViewCreated(View view, Bundle bundle) {
ArrayList parcelableArrayList;
Parcelable parcelable;
yRS supportFragmentManager;
InterfaceC9073dco interfaceC9073dco;
C0367Fb c0367Fb;
C14957gcv.e(view, "");
super.onViewCreated(view, bundle);
Bundle arguments = getArguments();
if (arguments != null) {
if (Build.VERSION.SDK_INT >= 33) {
parcelableArrayList = arguments.getParcelableArrayList("com.scb.phone.view.fragment.card_management.KEY_DEEJUNG_PLAN_DISPLAY_MODELS", C0433Gl.class);
} else {
parcelableArrayList = arguments.getParcelableArrayList("com.scb.phone.view.fragment.card_management.KEY_DEEJUNG_PLAN_DISPLAY_MODELS");
}
if (parcelableArrayList == null) {
parcelableArrayList = new ArrayList();
}
C12061erB c12061erB = null;
if (Build.VERSION.SDK_INT >= 33) {
parcelable = (Parcelable) arguments.getParcelable("com.scb.phone.view.activity.card_management.DeejungPlansActivity.KEY_CREDIT_CARD_DISPLAY", C0367Fb.class);
} else {
Parcelable parcelable2 = arguments.getParcelable("com.scb.phone.view.activity.card_management.DeejungPlansActivity.KEY_CREDIT_CARD_DISPLAY");
if (!(parcelable2 instanceof C0367Fb)) {
parcelable2 = null;
}
parcelable = (C0367Fb) parcelable2;
}
C0367Fb c0367Fb2 = (C0367Fb) parcelable;
if (c0367Fb2 == null) {
c0367Fb2 = new C0367Fb();
}
this.h = c0367Fb2;
this.i = arguments.getBoolean("com.scb.phone.view.fragment.card_management.KEY_IS_FROM_DEEJUNG_INSTALLMENT");
C1048UmV c1048UmV = this.f;
C14957gcv.e(c1048UmV);
HorizontalScrollView horizontalScrollView = c1048UmV.b;
horizontalScrollView.setFillViewport(true);
horizontalScrollView.setSmoothScrollingEnabled(true);
final C1048UmV c1048UmV2 = this.f;
C14957gcv.e(c1048UmV2);
Iterator it = parcelableArrayList.iterator();
int i = 0;
while (it.hasNext()) {
C0433Gl c0433Gl = (C0433Gl) it.next();
View inflate = getLayoutInflater().inflate(R.layout.2131560232, (ViewGroup) c1048UmV2.c, false);
if (inflate == null) {
throw new NullPointerException("rootView");
}
Button button = (Button) inflate;
final Button button2 = new NRl(button, button).a;
C14957gcv.c(button2, "");
button2.setText(c0433Gl.h);
button2.setTag(Integer.valueOf(i));
button2.setOnClickListener(new View.OnClickListener(this, button2, c1048UmV2) { // from class: o.eJi
private DeejungPlansFragment c;
private C1048UmV d;
private Button e;
@Override // android.view.View.OnClickListener
public final void onClick(View view2) {
DeejungPlansFragment.aqS_(this.c, this.e, this.d, view2);
}
{
this.c = this;
this.e = button2;
this.d = c1048UmV2;
}
});
c1048UmV2.c.addView(button2);
i++;
}
c1048UmV2.a.setEnableDrawDynamicViewHeight(true);
d(0, -1);
FragmentActivity activity = getActivity();
if (activity != null && (supportFragmentManager = activity.getSupportFragmentManager()) != null) {
C14957gcv.c(supportFragmentManager, "");
ArrayList arrayList = parcelableArrayList;
InterfaceC9073dco interfaceC9073dco2 = this.c;
if (interfaceC9073dco2 == null) {
C14957gcv.a("");
interfaceC9073dco = null;
} else {
interfaceC9073dco = interfaceC9073dco2;
}
C0367Fb c0367Fb3 = this.h;
if (c0367Fb3 == null) {
C14957gcv.a("");
c0367Fb = null;
} else {
c0367Fb = c0367Fb3;
}
c12061erB = new C12061erB(supportFragmentManager, arrayList, interfaceC9073dco, c0367Fb, this.i);
}
c1048UmV2.a.setAdapter(c12061erB);
c1048UmV2.a.addOnPageChangeListener(this.j);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d(int i, int i2) {
final C1048UmV c1048UmV = this.f;
C14957gcv.e(c1048UmV);
if (c1048UmV.c.getChildCount() > 0) {
View childAt = c1048UmV.c.getChildAt(i);
C14957gcv.d(childAt, "");
final Button button = (Button) childAt;
button.setSelected(true);
c1048UmV.b.post(new Runnable(button, c1048UmV) { // from class: o.eJn
private C1048UmV a;
private Button e;
@Override // java.lang.Runnable
public final void run() {
DeejungPlansFragment.aqR_(this.e, this.a);
}
{
this.e = button;
this.a = c1048UmV;
}
});
}
if (-1 != i2) {
InterfaceC10041dvK interfaceC10041dvK = this.g;
if (interfaceC10041dvK == null) {
C14957gcv.a("");
interfaceC10041dvK = null;
}
interfaceC10041dvK.a(i2);
}
}
/* JADX INFO: Access modifiers changed from: private */
public final void d() {
C1048UmV c1048UmV = this.f;
C14957gcv.e(c1048UmV);
int childCount = c1048UmV.c.getChildCount();
for (int i = 0; i < childCount; i++) {
View childAt = c1048UmV.c.getChildAt(i);
C14957gcv.d(childAt, "");
((Button) childAt).setSelected(false);
}
}
/* loaded from: classes5.dex */
public static final class RVV implements ViewPager.ojQ {
private DeejungPlansFragment 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) {
}
RVV(DeejungPlansFragment deejungPlansFragment) {
this.e = deejungPlansFragment;
}
@Override // androidx.viewpager.widget.ViewPager.ojQ
public final void onPageSelected(int i) {
this.e.d();
this.e.d(i, 0);
}
}
/* JADX WARN: Multi-variable type inference failed */
@Override // com.scb.phone.view.fragment.cardmanagement.Hilt_DeejungPlansFragment, com.scb.phone.view.fragment.Hilt_BaseFragment, androidx.fragment.app.Fragment
public final void onAttach(Context context) {
C14957gcv.e(context, "");
super.onAttach(context);
if (context instanceof InterfaceC10041dvK) {
this.g = (InterfaceC10041dvK) context;
}
}
@Override // com.scb.phone.view.fragment.BaseFragment, androidx.fragment.app.Fragment
public final void onDestroyView() {
this.f = null;
super.onDestroyView();
}
public static /* synthetic */ void aqR_(Button button, C1048UmV c1048UmV) {
C14957gcv.e(button, "");
C14957gcv.e(c1048UmV, "");
int left = button.getLeft();
int width = c1048UmV.b.getWidth();
int width2 = button.getWidth();
Integer num = SDK.d;
C14957gcv.c(num, "");
c1048UmV.b.smoothScrollTo(left - ((width - width2) / num.intValue()), 0);
}
public static /* synthetic */ void aqS_(DeejungPlansFragment deejungPlansFragment, Button button, C1048UmV c1048UmV, View view) {
C14957gcv.e(deejungPlansFragment, "");
C14957gcv.e(button, "");
C14957gcv.e(c1048UmV, "");
C14957gcv.e(view, "");
deejungPlansFragment.d();
button.setSelected(true);
FragmentWrapContentViewPager fragmentWrapContentViewPager = c1048UmV.a;
Object tag = view.getTag();
C14957gcv.d(tag, "");
fragmentWrapContentViewPager.setCurrentItem(((Integer) tag).intValue());
}
@Override // androidx.fragment.app.Fragment
public final View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) {
C14957gcv.e(layoutInflater, "");
View inflate = layoutInflater.inflate(R.layout.2131559550, viewGroup, false);
int i = R.id.divider4;
View e = qeC.e(inflate, R.id.divider4);
if (e != null) {
i = R.id.layout_months;
LinearLayout linearLayout = (LinearLayout) qeC.e(inflate, R.id.layout_months);
if (linearLayout != null) {
i = R.id.plans_months_horizontal_scroll;
HorizontalScrollView horizontalScrollView = (HorizontalScrollView) qeC.e(inflate, R.id.plans_months_horizontal_scroll);
if (horizontalScrollView != null) {
i = R.id.plans_selected_view_pager;
FragmentWrapContentViewPager fragmentWrapContentViewPager = (FragmentWrapContentViewPager) qeC.e(inflate, R.id.plans_selected_view_pager);
if (fragmentWrapContentViewPager != null) {
i = R.id.txv_lbl_number_of_months;
TextView textView = (TextView) qeC.e(inflate, R.id.txv_lbl_number_of_months);
if (textView != null) {
C1048UmV c1048UmV = new C1048UmV((LinearLayout) inflate, e, linearLayout, horizontalScrollView, fragmentWrapContentViewPager, textView);
this.f = c1048UmV;
C14957gcv.e(c1048UmV);
LinearLayout linearLayout2 = c1048UmV.d;
C14957gcv.c(linearLayout2, "");
return linearLayout2;
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
}