package o; import android.graphics.Typeface; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.LinearLayout; import android.widget.RadioGroup; import android.widget.TextView; import androidx.appcompat.widget.AppCompatRadioButton; import androidx.recyclerview.widget.RecyclerView; import com.scb.phone.view.adapter.singleform.viewholder.SingleFormQuestionnaireHeaderViewHolder; import com.scb.phone.view.adapter.singleform.viewholder.SingleFormQuestionnaireItemViewHolder; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import o.OZ; /* renamed from: o.eyH, reason: case insensitive filesystem */ /* loaded from: classes5.dex */ public final class C12438eyH extends RecyclerView.Sts implements InterfaceC12435eyE { private int a; private int b; private final C0819Pd c; private final InterfaceC12867fJk e; public C12438eyH(C0819Pd c0819Pd, InterfaceC12867fJk interfaceC12867fJk) { C14957gcv.e(c0819Pd, ""); C14957gcv.e(interfaceC12867fJk, ""); this.c = c0819Pd; this.e = interfaceC12867fJk; } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final RecyclerView.zJl onCreateViewHolder(ViewGroup viewGroup, int i) { C14957gcv.e(viewGroup, ""); LayoutInflater from = LayoutInflater.from(viewGroup.getContext()); if (i == 0) { View inflate = from.inflate(com.scb.phone.R.layout.2131560143, viewGroup, false); C14957gcv.c(inflate, ""); return new SingleFormQuestionnaireHeaderViewHolder(inflate, this.a); } View inflate2 = from.inflate(com.scb.phone.R.layout.2131559313, viewGroup, false); C14957gcv.c(inflate2, ""); return new SingleFormQuestionnaireItemViewHolder(inflate2); } /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r1v2, types: [android.widget.TextView] */ /* JADX WARN: Type inference failed for: r1v3, types: [android.widget.TextView] */ /* JADX WARN: Type inference failed for: r1v4, types: [android.widget.TextView] */ @Override // androidx.recyclerview.widget.RecyclerView.Sts public final void onBindViewHolder(RecyclerView.zJl zjl, int i) { C14957gcv.e(zjl, ""); final int i2 = 0; RadioGroup radioGroup = null; if (getItemViewType(i) == 4) { final OZ oz = this.c.c.get(this.b); SingleFormQuestionnaireItemViewHolder singleFormQuestionnaireItemViewHolder = (SingleFormQuestionnaireItemViewHolder) zjl; final C12438eyH c12438eyH = this; C14957gcv.e(oz, ""); C14957gcv.e(c12438eyH, ""); Typeface createFromAsset = Typeface.createFromAsset(singleFormQuestionnaireItemViewHolder.itemView.getContext().getAssets(), "fonts/PSL001Pro.ttf"); TextView textView = singleFormQuestionnaireItemViewHolder.tvQuestionNumber; if (textView == null) { C14957gcv.a(""); textView = null; } gcH gch = gcH.d; String string = singleFormQuestionnaireItemViewHolder.itemView.getContext().getString(com.scb.phone.R.string.full_stop); C14957gcv.c((Object) string, ""); String format = String.format(string, Arrays.copyOf(new Object[]{Integer.valueOf(oz.c)}, 1)); C14957gcv.c((Object) format, ""); textView.setText(format); TextView textView2 = singleFormQuestionnaireItemViewHolder.tvQuestionTitle; if (textView2 == null) { C14957gcv.a(""); textView2 = null; } textView2.setText(oz.b); if (oz.d == OZ.RVV.RADIO) { RadioGroup radioGroup2 = singleFormQuestionnaireItemViewHolder.rgAnswers; if (radioGroup2 == null) { C14957gcv.a(""); radioGroup2 = null; } radioGroup2.removeAllViews(); int i3 = -1; for (Object obj : oz.e) { if (i2 >= 0) { OW ow = (OW) obj; AppCompatRadioButton appCompatRadioButton = new AppCompatRadioButton(singleFormQuestionnaireItemViewHolder.itemView.getContext(), null, com.scb.phone.R.attr.questionnaireRadioButtonStyle); appCompatRadioButton.setId(i2); appCompatRadioButton.setText(ow.a); appCompatRadioButton.setTypeface(createFromAsset); if (ow.b) { i3 = appCompatRadioButton.getId(); } RadioGroup radioGroup3 = singleFormQuestionnaireItemViewHolder.rgAnswers; if (radioGroup3 == null) { C14957gcv.a(""); radioGroup3 = null; } radioGroup3.addView(appCompatRadioButton); i2++; } else { throw new ArithmeticException("Index overflow has happened."); } } if (i3 != -1) { RadioGroup radioGroup4 = singleFormQuestionnaireItemViewHolder.rgAnswers; if (radioGroup4 == null) { C14957gcv.a(""); radioGroup4 = null; } radioGroup4.check(i3); } RadioGroup radioGroup5 = singleFormQuestionnaireItemViewHolder.rgAnswers; if (radioGroup5 != null) { radioGroup = radioGroup5; } else { C14957gcv.a(""); } radioGroup.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener(c12438eyH, oz) { // from class: o.eyR private OZ c; private InterfaceC12435eyE d; @Override // android.widget.RadioGroup.OnCheckedChangeListener public final void onCheckedChanged(RadioGroup radioGroup6, int i4) { SingleFormQuestionnaireItemViewHolder.c(this.d, this.c, i4); } { this.d = c12438eyH; this.c = oz; } }); } else { LinearLayout linearLayout = singleFormQuestionnaireItemViewHolder.llCbAnswers; if (linearLayout == null) { C14957gcv.a(""); linearLayout = null; } linearLayout.removeAllViews(); for (Object obj2 : oz.e) { if (i2 >= 0) { OW ow2 = (OW) obj2; CheckBox checkBox = new CheckBox(singleFormQuestionnaireItemViewHolder.itemView.getContext()); checkBox.setId(i2); checkBox.setText(ow2.a); checkBox.setTypeface(createFromAsset); checkBox.setPadding(singleFormQuestionnaireItemViewHolder.itemView.getResources().getDimensionPixelOffset(com.scb.phone.R.dimen.f17292131165495), checkBox.getPaddingTop(), checkBox.getPaddingRight(), checkBox.getPaddingBottom()); checkBox.setChecked(ow2.b); checkBox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(c12438eyH, oz, i2) { // from class: o.eyQ private InterfaceC12435eyE a; private OZ b; private int d; @Override // android.widget.CompoundButton.OnCheckedChangeListener public final void onCheckedChanged(CompoundButton compoundButton, boolean z) { SingleFormQuestionnaireItemViewHolder.d(this.a, this.b, this.d, z); } { this.a = c12438eyH; this.b = oz; this.d = i2; } }); LinearLayout linearLayout2 = singleFormQuestionnaireItemViewHolder.llCbAnswers; if (linearLayout2 == null) { C14957gcv.a(""); linearLayout2 = null; } linearLayout2.addView(checkBox); i2++; } else { throw new ArithmeticException("Index overflow has happened."); } } } this.b++; return; } SingleFormQuestionnaireHeaderViewHolder singleFormQuestionnaireHeaderViewHolder = (SingleFormQuestionnaireHeaderViewHolder) zjl; int i4 = singleFormQuestionnaireHeaderViewHolder.e; if (i4 == 1) { TextView textView3 = singleFormQuestionnaireHeaderViewHolder.tvTitle; if (textView3 == null) { C14957gcv.a(""); textView3 = null; } textView3.setText(com.scb.phone.R.string.auto_single_form_suitability_assessment_questionnaire_section_2_3); textView3.setVisibility(0); TextView textView4 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle1; if (textView4 == null) { C14957gcv.a(""); textView4 = null; } textView4.setText(com.scb.phone.R.string.auto_single_form_suitability_assessment_questionnaire_section_2_3_sub_title); textView4.setVisibility(0); ?? r1 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle2; if (r1 != 0) { radioGroup = r1; } else { C14957gcv.a(""); } radioGroup.setVisibility(8); return; } if (i4 == 2) { TextView textView5 = singleFormQuestionnaireHeaderViewHolder.tvTitle; if (textView5 == null) { C14957gcv.a(""); textView5 = null; } textView5.setText(com.scb.phone.R.string.auto_single_form_suitability_assessment_questionnaire_section_2); textView5.setVisibility(0); TextView textView6 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle1; if (textView6 == null) { C14957gcv.a(""); textView6 = null; } textView6.setVisibility(8); ?? r12 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle2; if (r12 != 0) { radioGroup = r12; } else { C14957gcv.a(""); } radioGroup.setVisibility(8); return; } if (i4 == 3) { TextView textView7 = singleFormQuestionnaireHeaderViewHolder.tvTitle; if (textView7 == null) { C14957gcv.a(""); textView7 = null; } textView7.setText(com.scb.phone.R.string.auto_single_form_suitability_assessment_questionnaire_section_3); textView7.setVisibility(0); TextView textView8 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle1; if (textView8 == null) { C14957gcv.a(""); textView8 = null; } textView8.setVisibility(8); ?? r13 = singleFormQuestionnaireHeaderViewHolder.tvSubtitle2; if (r13 != 0) { radioGroup = r13; } else { C14957gcv.a(""); } radioGroup.setVisibility(8); } } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final int getItemViewType(int i) { List list = this.c.c; ArrayList arrayList = new ArrayList(); for (Object obj : list) { if (((OZ) obj).a == 1) { arrayList.add(obj); } } ArrayList arrayList2 = arrayList; List list2 = this.c.c; ArrayList arrayList3 = new ArrayList(); for (Object obj2 : list2) { if (((OZ) obj2).a == 2) { arrayList3.add(obj2); } } ArrayList arrayList4 = arrayList3; if (i == arrayList2.size()) { this.a = 1; } else if (i == arrayList2.size() + 1) { this.a = 2; } else { if (i != arrayList2.size() + arrayList4.size() + 2) { return 4; } this.a = 3; } return 0; } /* renamed from: o.eyH$Sts */ /* loaded from: classes5.dex */ public static final class Sts { private Sts() { } public /* synthetic */ Sts(byte b) { this(); } } @Override // androidx.recyclerview.widget.RecyclerView.Sts public final int getItemCount() { return this.c.c.size() + 3; } @Override // o.InterfaceC12435eyE public final void b(int i, int i2, boolean z) { int i3 = 0; for (Object obj : this.c.c.get(i).e) { if (i3 < 0) { throw new ArithmeticException("Index overflow has happened."); } OW ow = (OW) obj; if (i3 == i2) { ow.b = z; } i3++; } this.e.b(this.c); } @Override // o.InterfaceC12435eyE public final void d(int i, int i2) { int i3 = 0; for (Object obj : this.c.c.get(i).e) { if (i3 < 0) { throw new ArithmeticException("Index overflow has happened."); } ((OW) obj).b = i3 == i2; i3++; } this.e.b(this.c); } static { new Sts((byte) 0); } }