what-the-bank/sources/com/scb/phone/view/custom/item/ItemIconCustom.java

190 lines
6.8 KiB
Java

package com.scb.phone.view.custom.item;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.text.SpannableString;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import com.scb.phone.components.ItemCustom;
import com.squareup.picasso.Picasso;
import java.io.IOException;
import o.C12911fKw;
import o.C12914fKz;
import o.C13020fOa;
import o.InterfaceC13027fOh;
import o.QK;
import o.fKG;
import o.fLG;
import o.guQ;
import o.nMh;
/* loaded from: classes5.dex */
public class ItemIconCustom extends ItemCustom<QK> {
private C12911fKw a;
@BindView
TextView labelLeft;
@BindView
TextView labelRight;
@BindView
TextView labelRightExtra;
@BindView
TextView labelRightExtraWithPSL;
@BindView
public ConstraintLayout layoutCustomItemIcon;
public ItemIconCustom(Context context) {
super(context);
}
public ItemIconCustom(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
public ItemIconCustom(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
}
@Override // com.scb.phone.components.ItemCustom
public final void a(Context context) {
LayoutInflater.from(context).inflate(R.layout.2131558968, (ViewGroup) this, true);
ButterKnife.c(this);
}
@Override // com.scb.phone.components.ItemCustom
public void setUpWithDisplay(QK qk) {
this.a = new C12911fKw();
this.labelLeft.setText(qk.h);
if (qk.b != null) {
if (qk.a) {
this.labelRightExtraWithPSL.setText(qk.b);
this.labelRightExtraWithPSL.setVisibility(0);
} else {
this.labelRightExtra.setText(qk.b);
this.labelRightExtra.setVisibility(0);
}
}
int i = qk.c > 0 ? qk.c : R.drawable.bankicon_place_holder;
String str = qk.f;
String str2 = qk.e;
if (str2 == null || str2.isEmpty()) {
this.labelRight.setText(str);
} else {
SpannableString spannableString = new SpannableString(" ".concat(String.valueOf(str)));
this.labelRight.setText(spannableString);
C13020fOa d = Picasso.d().e(str2).b(i).e(i).d();
d.a.c(new fLG(getContext().getResources().getDimensionPixelSize(R.dimen.f15962131165362), nMh.getColor(getContext(), R.color.f3412131099849), getContext().getResources().getDimensionPixelSize(R.dimen.f27782131166544)));
C12911fKw.IeS<fKG> ieS = new C12911fKw.IeS<fKG>(this) { // from class: com.scb.phone.view.custom.item.ItemIconCustom.5
private ItemIconCustom a;
{
this.a = this;
}
@Override // o.C12911fKw.IeS
public final /* synthetic */ fKG azT_(Drawable drawable) {
int dimensionPixelSize = this.a.getContext().getResources().getDimensionPixelSize(R.dimen.f15972131165363);
drawable.setBounds(0, 0, dimensionPixelSize, dimensionPixelSize);
return new fKG(drawable);
}
@Override // o.C12911fKw.IeS
public final /* synthetic */ fKG azS_(Bitmap bitmap) {
return new fKG(this.a.getContext(), bitmap);
}
};
C12911fKw.Sts<fKG> sts = new C12911fKw.Sts<fKG>(this, spannableString, i) { // from class: com.scb.phone.view.custom.item.ItemIconCustom.2
private ItemIconCustom a;
private int b;
private SpannableString d;
{
this.a = this;
this.d = spannableString;
this.b = i;
}
@Override // o.C12911fKw.Sts
public final /* synthetic */ void a(fKG fkg) {
this.d.setSpan(fkg, 0, 1, 17);
this.a.labelRight.setText(this.d);
}
@Override // o.C12911fKw.Sts
public final void b() {
this.d.setSpan(new fKG(this.a.getContext(), this.a.apN_(this.b)), 0, 1, 17);
this.a.labelRight.setText(this.d);
}
};
C12911fKw c12911fKw = this.a;
if (((Boolean) C12914fKz.e(new Object[0], -1840827221, 1840827223, (int) System.currentTimeMillis())).booleanValue()) {
d.d(new InterfaceC13027fOh(c12911fKw, sts, ieS) { // from class: o.fKw.4
private IeS b;
private C12911fKw c;
private Sts e;
public AnonymousClass4(C12911fKw c12911fKw2, Sts sts2, IeS ieS2) {
this.c = c12911fKw2;
this.e = sts2;
this.b = ieS2;
}
@Override // o.InterfaceC13027fOh
public final void aBB_(Bitmap bitmap) {
this.e.a(this.b.azS_(bitmap));
}
@Override // o.InterfaceC13027fOh
public final void aBA_(Drawable drawable) {
this.e.a(this.b.azT_(drawable));
}
@Override // o.InterfaceC13027fOh
public final void aBC_(Drawable drawable) {
this.e.a(this.b.azT_(drawable));
}
});
} else {
try {
sts2.a(ieS2.azS_(d.aBt_()));
} catch (IOException e) {
sts2.b();
guQ.e(e);
}
}
}
boolean z = qk.m;
boolean z2 = qk.f8324o;
int dimension = (int) getResources().getDimension(R.dimen.f20262131165792);
int dimension2 = (int) getResources().getDimension(R.dimen.f16672131165433);
int i2 = z ? dimension : dimension2;
if (z2) {
dimension2 = dimension;
}
this.layoutCustomItemIcon.setPadding(dimension, i2, dimension, dimension2);
}
/* JADX INFO: Access modifiers changed from: private */
public Bitmap apN_(int i) {
Bitmap decodeResource = BitmapFactory.decodeResource(getContext().getResources(), i);
int dimensionPixelSize = getResources().getDimensionPixelSize(R.dimen.f15972131165363);
try {
return Bitmap.createScaledBitmap(decodeResource, dimensionPixelSize, dimensionPixelSize, true);
} catch (Exception unused) {
return decodeResource;
}
}
}