what-the-bank/sources/com/scb/phone/view/adapter/chubb/PaymentInfoAdapter.java

363 lines
14 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.adapter.chubb;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.Space;
import android.widget.TextView;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
import com.prolificinteractive.materialcalendarview.TitleChanger;
import com.scb.phone.R;
import com.scb.phone.view.adapter.chubb.PaymentInfoAdapter;
import com.squareup.picasso.Picasso;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import o.C6583cXR;
import o.FVz;
import o.XL;
import o.fHN;
import o.fSQ;
import o.gjJ;
import o.guQ;
import o.pyT;
/* loaded from: classes5.dex */
public final class PaymentInfoAdapter extends RecyclerView.Sts {
public boolean a;
private int b;
private fHN c;
public List<XL> d;
private Context e;
private boolean i;
/* loaded from: classes5.dex */
public class ViewTypeMiniQrHolder_ViewBinding implements Unbinder {
private ViewTypeMiniQrHolder b;
public ViewTypeMiniQrHolder_ViewBinding(ViewTypeMiniQrHolder viewTypeMiniQrHolder, View view) {
this.b = viewTypeMiniQrHolder;
viewTypeMiniQrHolder.tvTitle = (TextView) pyT.e(view, R.id.qr_code_description_text, "field 'tvTitle'", TextView.class);
viewTypeMiniQrHolder.imageQrCode = (ImageView) pyT.e(view, R.id.qr_code_image, "field 'imageQrCode'", ImageView.class);
viewTypeMiniQrHolder.tvHeader = (TextView) pyT.e(view, R.id.qr_reference_id_text, "field 'tvHeader'", TextView.class);
viewTypeMiniQrHolder.tvDescription = (TextView) pyT.e(view, R.id.qr_code_description, "field 'tvDescription'", TextView.class);
}
@Override // butterknife.Unbinder
public final void a() {
ViewTypeMiniQrHolder viewTypeMiniQrHolder = this.b;
if (viewTypeMiniQrHolder == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.b = null;
viewTypeMiniQrHolder.tvTitle = null;
viewTypeMiniQrHolder.imageQrCode = null;
viewTypeMiniQrHolder.tvHeader = null;
viewTypeMiniQrHolder.tvDescription = null;
}
}
/* loaded from: classes5.dex */
public class ViewTypeTextAndImageHolder_ViewBinding implements Unbinder {
private ViewTypeTextAndImageHolder e;
public ViewTypeTextAndImageHolder_ViewBinding(ViewTypeTextAndImageHolder viewTypeTextAndImageHolder, View view) {
this.e = viewTypeTextAndImageHolder;
viewTypeTextAndImageHolder.titleTextView = (TextView) pyT.e(view, R.id.title_text_view, "field 'titleTextView'", TextView.class);
viewTypeTextAndImageHolder.headerTextView = (TextView) pyT.e(view, R.id.header_text_view, "field 'headerTextView'", TextView.class);
viewTypeTextAndImageHolder.descriptionTextView = (TextView) pyT.e(view, R.id.description_text_view, "field 'descriptionTextView'", TextView.class);
viewTypeTextAndImageHolder.imageView = (ImageView) pyT.e(view, R.id.image_chubb, "field 'imageView'", ImageView.class);
viewTypeTextAndImageHolder.divider = pyT.a(view, R.id.divider, "field 'divider'");
}
@Override // butterknife.Unbinder
public final void a() {
ViewTypeTextAndImageHolder viewTypeTextAndImageHolder = this.e;
if (viewTypeTextAndImageHolder == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.e = null;
viewTypeTextAndImageHolder.titleTextView = null;
viewTypeTextAndImageHolder.headerTextView = null;
viewTypeTextAndImageHolder.descriptionTextView = null;
viewTypeTextAndImageHolder.imageView = null;
viewTypeTextAndImageHolder.divider = null;
}
}
/* loaded from: classes5.dex */
public class ViewTypeTextHolder_ViewBinding implements Unbinder {
private ViewTypeTextHolder e;
public ViewTypeTextHolder_ViewBinding(ViewTypeTextHolder viewTypeTextHolder, View view) {
this.e = viewTypeTextHolder;
viewTypeTextHolder.titleTextView = (TextView) pyT.e(view, R.id.title_text_view, "field 'titleTextView'", TextView.class);
viewTypeTextHolder.headerTextView = (TextView) pyT.e(view, R.id.header_text_view, "field 'headerTextView'", TextView.class);
viewTypeTextHolder.descriptionTextView = (TextView) pyT.e(view, R.id.description_text_view, "field 'descriptionTextView'", TextView.class);
viewTypeTextHolder.divider = pyT.a(view, R.id.divider, "field 'divider'");
viewTypeTextHolder.spaceTopItem = (Space) pyT.e(view, R.id.space_top_item, "field 'spaceTopItem'", Space.class);
}
@Override // butterknife.Unbinder
public final void a() {
ViewTypeTextHolder viewTypeTextHolder = this.e;
if (viewTypeTextHolder == null) {
throw new IllegalStateException("Bindings already cleared.");
}
this.e = null;
viewTypeTextHolder.titleTextView = null;
viewTypeTextHolder.headerTextView = null;
viewTypeTextHolder.descriptionTextView = null;
viewTypeTextHolder.divider = null;
viewTypeTextHolder.spaceTopItem = null;
}
}
public PaymentInfoAdapter(Context context) {
this.d = new ArrayList();
this.b = 0;
this.i = false;
this.e = context;
this.c = null;
}
public PaymentInfoAdapter(Context context, fHN fhn, boolean z) {
this.d = new ArrayList();
this.b = 0;
this.e = context;
this.c = fhn;
this.i = z;
}
@Override // androidx.recyclerview.widget.RecyclerView.Sts
public final RecyclerView.zJl onCreateViewHolder(ViewGroup viewGroup, int i) {
LayoutInflater from = LayoutInflater.from(viewGroup.getContext());
if (i == 3) {
return new ViewTypeMiniQrHolder(this, from.inflate(R.layout.2131559198, viewGroup, false));
}
if (i == 2) {
return new ViewTypeTextAndImageHolder(this, from.inflate(R.layout.2131559201, viewGroup, false));
}
return new ViewTypeTextHolder(this, from.inflate(R.layout.2131559199, viewGroup, false));
}
@Override // androidx.recyclerview.widget.RecyclerView.Sts
public final int getItemViewType(int i) {
String str;
if (!"TEXT_WITH_IMAGE".equalsIgnoreCase(this.d.get(i).f) || ((str = this.d.get(i).a) != null && str.equals(""))) {
return "MINI_QR".equalsIgnoreCase(this.d.get(i).f) ? 3 : 1;
}
return 2;
}
@Override // androidx.recyclerview.widget.RecyclerView.Sts
public final void onBindViewHolder(RecyclerView.zJl zjl, int i) {
if (getItemViewType(i) == 2) {
ViewTypeTextAndImageHolder viewTypeTextAndImageHolder = (ViewTypeTextAndImageHolder) zjl;
XL xl = this.d.get(i);
viewTypeTextAndImageHolder.titleTextView.setText(xl.g);
viewTypeTextAndImageHolder.headerTextView.setText(xl.d);
viewTypeTextAndImageHolder.descriptionTextView.setText(xl.b);
try {
if (viewTypeTextAndImageHolder.b.a) {
viewTypeTextAndImageHolder.imageView.setImageBitmap(Picasso.d().e(xl.a).b(R.color.f3092131099816).aBt_());
} else {
Picasso.d().e(xl.a).b(R.color.f3092131099816).aBu_(viewTypeTextAndImageHolder.imageView, null);
}
} catch (IOException e) {
guQ.e(e);
}
viewTypeTextAndImageHolder.divider.setVisibility(viewTypeTextAndImageHolder.getAdapterPosition() == viewTypeTextAndImageHolder.b.d.size() + (-1) ? 8 : 0);
e(viewTypeTextAndImageHolder.b);
return;
}
if (getItemViewType(i) == 3) {
final ViewTypeMiniQrHolder viewTypeMiniQrHolder = (ViewTypeMiniQrHolder) zjl;
XL xl2 = this.d.get(i);
viewTypeMiniQrHolder.tvTitle.setText(xl2.g);
viewTypeMiniQrHolder.c = String.format("%s.jpg", xl2.i);
File file = new File(new File(viewTypeMiniQrHolder.a.e.getCacheDir(), "pullslip"), viewTypeMiniQrHolder.c);
if (!file.exists()) {
C6583cXR.d(xl2.i, TitleChanger.DEFAULT_ANIMATION_DELAY, TitleChanger.DEFAULT_ANIMATION_DELAY, FVz.M).subscribe(new fSQ(viewTypeMiniQrHolder) { // from class: o.esk
private PaymentInfoAdapter.ViewTypeMiniQrHolder b;
@Override // o.fSQ
public final void c(Object obj) {
this.b.amZ_((Bitmap) obj);
}
{
this.b = viewTypeMiniQrHolder;
}
}, new fSQ(viewTypeMiniQrHolder) { // from class: o.esm
private PaymentInfoAdapter.ViewTypeMiniQrHolder d;
@Override // o.fSQ
public final void c(Object obj) {
PaymentInfoAdapter.ViewTypeMiniQrHolder viewTypeMiniQrHolder2 = this.d;
guQ.e((Throwable) obj);
viewTypeMiniQrHolder2.imageQrCode.setVisibility(8);
PaymentInfoAdapter.e(viewTypeMiniQrHolder2.a);
}
{
this.d = viewTypeMiniQrHolder;
}
});
} else {
viewTypeMiniQrHolder.amZ_(BitmapFactory.decodeFile(file.getAbsolutePath(), new BitmapFactory.Options()));
}
viewTypeMiniQrHolder.tvHeader.setText(xl2.d);
if (xl2.b != null && !xl2.b.isEmpty()) {
viewTypeMiniQrHolder.tvDescription.setText(xl2.b);
return;
} else {
viewTypeMiniQrHolder.tvDescription.setVisibility(8);
return;
}
}
ViewTypeTextHolder viewTypeTextHolder = (ViewTypeTextHolder) zjl;
XL xl3 = this.d.get(i);
String str = xl3.d;
String str2 = xl3.b;
viewTypeTextHolder.titleTextView.setText(xl3.g);
viewTypeTextHolder.headerTextView.setText(xl3.d);
viewTypeTextHolder.descriptionTextView.setText(xl3.b);
viewTypeTextHolder.titleTextView.setVisibility(gjJ.b((CharSequence) xl3.g) ? 8 : 0);
viewTypeTextHolder.headerTextView.setVisibility(gjJ.b((CharSequence) str) ? 8 : 0);
viewTypeTextHolder.descriptionTextView.setVisibility(gjJ.b((CharSequence) str2) ? 8 : 0);
if (viewTypeTextHolder.b.i) {
viewTypeTextHolder.divider.setVisibility(8);
if (viewTypeTextHolder.getAdapterPosition() > 0) {
viewTypeTextHolder.spaceTopItem.setVisibility(8);
}
} else {
viewTypeTextHolder.divider.setVisibility(viewTypeTextHolder.getAdapterPosition() == viewTypeTextHolder.b.d.size() + (-1) ? 8 : 0);
}
e(viewTypeTextHolder.b);
}
@Override // androidx.recyclerview.widget.RecyclerView.Sts
public final int getItemCount() {
List<XL> list = this.d;
if (list != null) {
return list.size();
}
return 0;
}
/* loaded from: classes5.dex */
public class ViewTypeMiniQrHolder extends RecyclerView.zJl {
public final PaymentInfoAdapter a;
String c;
@BindView
public ImageView imageQrCode;
@BindView
TextView tvDescription;
@BindView
TextView tvHeader;
@BindView
TextView tvTitle;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ViewTypeMiniQrHolder(PaymentInfoAdapter paymentInfoAdapter, View view) {
super(view);
this.a = paymentInfoAdapter;
ButterKnife.c(this, view);
}
public final void amZ_(Bitmap bitmap) {
File file = new File(this.a.e.getCacheDir(), "pullslip");
if (!file.exists()) {
guQ.c("%s created %s", file.getAbsolutePath(), Boolean.valueOf(file.mkdirs()));
}
try {
FileOutputStream fileOutputStream = new FileOutputStream(new File(file, this.c), false);
bitmap.compress(Bitmap.CompressFormat.JPEG, 70, fileOutputStream);
fileOutputStream.close();
} catch (IOException e) {
guQ.e(e);
}
this.imageQrCode.setImageBitmap(bitmap);
PaymentInfoAdapter.e(this.a);
}
}
/* loaded from: classes5.dex */
public class ViewTypeTextHolder extends RecyclerView.zJl {
final PaymentInfoAdapter b;
@BindView
TextView descriptionTextView;
@BindView
View divider;
@BindView
TextView headerTextView;
@BindView
Space spaceTopItem;
@BindView
TextView titleTextView;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ViewTypeTextHolder(PaymentInfoAdapter paymentInfoAdapter, View view) {
super(view);
this.b = paymentInfoAdapter;
ButterKnife.c(this, view);
}
}
/* loaded from: classes5.dex */
public class ViewTypeTextAndImageHolder extends RecyclerView.zJl {
final PaymentInfoAdapter b;
@BindView
TextView descriptionTextView;
@BindView
View divider;
@BindView
TextView headerTextView;
@BindView
ImageView imageView;
@BindView
TextView titleTextView;
/* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */
public ViewTypeTextAndImageHolder(PaymentInfoAdapter paymentInfoAdapter, View view) {
super(view);
this.b = paymentInfoAdapter;
ButterKnife.c(this, view);
}
}
public static /* synthetic */ void e(PaymentInfoAdapter paymentInfoAdapter) {
fHN fhn;
int i = paymentInfoAdapter.b + 1;
paymentInfoAdapter.b = i;
if (i != paymentInfoAdapter.getItemCount() || (fhn = paymentInfoAdapter.c) == null) {
return;
}
fhn.s();
}
}