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

151 lines
4.8 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Shader;
import android.graphics.drawable.BitmapDrawable;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import butterknife.BindView;
import butterknife.ButterKnife;
import com.scb.phone.R;
import java.io.File;
import java.util.Map;
import o.C12891fKc;
import o.C15715hv;
import o.InterfaceC9006dba;
import o.guQ;
/* loaded from: classes5.dex */
public class ThemeSlipLayout extends LinearLayout implements InterfaceC9006dba {
public int c;
@BindView
ImageView imageSlipBorderLeft;
@BindView
ImageView imageSlipBorderRight;
@BindView
ImageView imageSlipBottom;
@BindView
ImageView imageSlipBottomBorder;
@BindView
ImageView imageSlipHeader;
@BindView
FrameLayout slipContent;
public ThemeSlipLayout(Context context) {
super(context);
this.c = 0;
aor_(null);
}
public ThemeSlipLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.c = 0;
aor_(attributeSet);
}
public ThemeSlipLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.c = 0;
aor_(attributeSet);
}
private void aor_(AttributeSet attributeSet) {
Context context = getContext();
LayoutInflater.from(getContext()).inflate(R.layout.2131560075, (ViewGroup) this, true);
ButterKnife.c(this, this);
if (attributeSet != null) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C15715hv.jbe.ThemeSlipLayout, 0, 0);
try {
this.c = obtainStyledAttributes.getResourceId(0, 0);
b(context);
} finally {
obtainStyledAttributes.recycle();
}
}
}
private void b(Context context) {
ViewGroup viewGroup;
if (this.c <= 0 || (viewGroup = (ViewGroup) findViewById(R.id.slip_content)) == null) {
return;
}
inflate(context, this.c, viewGroup);
}
public void e(Map<String, String> map) {
if (map == null || map.isEmpty()) {
return;
}
ImageView imageView = this.imageSlipHeader;
String str = map.get("slip_header.png");
if (!TextUtils.isEmpty(str)) {
C12891fKc.azF_(new File(str), imageView);
}
ImageView imageView2 = this.imageSlipBorderLeft;
String str2 = map.get("slip_side.png");
if (!TextUtils.isEmpty(str2)) {
C12891fKc.azF_(new File(str2), imageView2);
}
ImageView imageView3 = this.imageSlipBorderRight;
String str3 = map.get("slip_side.png");
if (!TextUtils.isEmpty(str3)) {
C12891fKc.azF_(new File(str3), imageView3);
}
ImageView imageView4 = this.imageSlipBottom;
String str4 = map.get("slip_bottom.png");
if (!TextUtils.isEmpty(str4)) {
C12891fKc.azF_(new File(str4), imageView4);
}
ImageView imageView5 = this.imageSlipBottomBorder;
String str5 = map.get("slip_zigzag.png");
if (!TextUtils.isEmpty(str5)) {
C12891fKc.azF_(new File(str5), imageView5);
}
FrameLayout frameLayout = this.slipContent;
String str6 = map.get("slip_watermark.png");
if (TextUtils.isEmpty(str6)) {
return;
}
aos_(frameLayout, C12891fKc.ayW_(new File(str6)));
}
private void aot_(View view, Bitmap bitmap) {
BitmapDrawable bitmapDrawable = new BitmapDrawable(getResources(), bitmap);
Shader.TileMode tileMode = Shader.TileMode.REPEAT;
bitmapDrawable.setTileModeXY(tileMode, tileMode);
bitmapDrawable.setAlpha(204);
view.setBackground(bitmapDrawable);
}
/* JADX INFO: Access modifiers changed from: protected */
public final void d(View view) throws OutOfMemoryError {
aos_(view, BitmapFactory.decodeResource(getResources(), R.drawable.slip_watermark_regenslip));
}
private void aos_(View view, Bitmap bitmap) throws OutOfMemoryError {
if (bitmap != null) {
int dimensionPixelOffset = getContext().getResources().getDimensionPixelOffset(R.dimen.f27942131166560);
try {
aot_(view, Bitmap.createScaledBitmap(bitmap, dimensionPixelOffset, dimensionPixelOffset, false));
} catch (OutOfMemoryError e) {
guQ.e(e, "Tile Image got OOM", new Object[0]);
}
}
}
}