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

72 lines
2.5 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.scb.phone.view.custom.ndid;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.widget.LinearLayout;
import com.scb.phone.R;
import o.nMh;
/* loaded from: classes5.dex */
public class OverlayNationalIdFocus extends LinearLayout {
private RVV e;
/* loaded from: classes5.dex */
public interface RVV {
void e(int i, int i2);
}
public OverlayNationalIdFocus(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
setAlpha(0.84f);
setBackgroundColor(nMh.getColor(getContext(), R.color.f2982131099805));
}
public OverlayNationalIdFocus(Context context) {
super(context);
setAlpha(0.84f);
setBackgroundColor(nMh.getColor(getContext(), R.color.f2982131099805));
}
public OverlayNationalIdFocus(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
setAlpha(0.84f);
setBackgroundColor(nMh.getColor(getContext(), R.color.f2982131099805));
}
@Override // android.widget.LinearLayout, android.view.View
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
Bitmap decodeResource = BitmapFactory.decodeResource(getResources(), R.drawable.overlay_national_id);
int width = (int) (decodeResource.getWidth() * 0.46f);
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(decodeResource, width, (int) (decodeResource.getHeight() * 0.46f), true);
if (!decodeResource.isRecycled()) {
decodeResource.recycle();
}
int width2 = (int) (((getWidth() - ((int) (getWidth() * 0.1f))) - width) / 2.0f);
int height = ((int) ((getHeight() - r2) / 2.0f)) + getPaddingTop();
Paint paint = new Paint(1);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
float f = width2;
float f2 = height;
canvas.drawRect(new RectF(f, f2, width2 + width, height + r2), paint);
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
paint.setColor(-1);
canvas.drawBitmap(createScaledBitmap, f, f2, paint);
RVV rvv = this.e;
if (rvv != null) {
rvv.e(width2, width);
}
}
public void setOnStateChangeListener(RVV rvv) {
this.e = rvv;
}
}