106 lines
3.7 KiB
Java
106 lines
3.7 KiB
Java
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.Matrix;
|
|
import android.graphics.Paint;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.PorterDuffXfermode;
|
|
import android.util.AttributeSet;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.WindowManager;
|
|
import android.widget.LinearLayout;
|
|
import com.scb.phone.R;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public class OverlayWithCircleFocus extends LinearLayout {
|
|
private int a;
|
|
private int b;
|
|
private boolean c;
|
|
private int d;
|
|
private HBt e;
|
|
|
|
/* loaded from: classes5.dex */
|
|
public interface HBt {
|
|
void b(int i, int i2);
|
|
}
|
|
|
|
public OverlayWithCircleFocus(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.c = true;
|
|
}
|
|
|
|
public OverlayWithCircleFocus(Context context) {
|
|
super(context);
|
|
this.c = true;
|
|
}
|
|
|
|
public OverlayWithCircleFocus(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.c = true;
|
|
}
|
|
|
|
@Override // android.widget.LinearLayout, android.view.View
|
|
public void onDraw(Canvas canvas) {
|
|
super.onDraw(canvas);
|
|
WindowManager windowManager = (WindowManager) getContext().getSystemService("window");
|
|
DisplayMetrics displayMetrics = new DisplayMetrics();
|
|
windowManager.getDefaultDisplay().getMetrics(displayMetrics);
|
|
float f = displayMetrics.density;
|
|
int width = getWidth();
|
|
if (this.d == 0) {
|
|
this.d = ((int) (width - ((24.0f * f) * 2.0f))) / 2;
|
|
}
|
|
this.b = width / 2;
|
|
int height = ((int) ((getHeight() / getWidth()) * 50.0f * f)) + this.d;
|
|
this.a = height;
|
|
if (height > (getHeight() * 0.1f) + this.d) {
|
|
this.a = ((int) (getHeight() * 0.1f)) + this.d;
|
|
}
|
|
HBt hBt = this.e;
|
|
if (hBt != null) {
|
|
hBt.b(this.a, this.d);
|
|
}
|
|
Bitmap decodeResource = BitmapFactory.decodeResource(getResources(), R.drawable.frame_liveness);
|
|
int i = this.d << 1;
|
|
Bitmap createScaledBitmap = Bitmap.createScaledBitmap(decodeResource, i, i, true);
|
|
float f2 = this.b;
|
|
float f3 = this.a;
|
|
float f4 = this.d;
|
|
Paint paint = new Paint(1);
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
|
paint.setColor(-65536);
|
|
canvas.drawCircle(this.b, this.a, this.d, paint);
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
|
|
paint.setColor(-1);
|
|
float f5 = f2 - f4;
|
|
float f6 = f3 - f4;
|
|
canvas.drawBitmap(createScaledBitmap, f5, f6, paint);
|
|
if (this.c) {
|
|
Bitmap decodeResource2 = BitmapFactory.decodeResource(getResources(), R.drawable.line_focus);
|
|
Bitmap createScaledBitmap2 = Bitmap.createScaledBitmap(decodeResource2, decodeResource2.getWidth(), this.d << 1, true);
|
|
paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.OVERLAY));
|
|
paint.setColor(-1);
|
|
canvas.drawBitmap(createScaledBitmap2, f2 - createScaledBitmap2.getWidth(), f6, paint);
|
|
Matrix matrix = new Matrix();
|
|
matrix.setRotate(90.0f);
|
|
canvas.drawBitmap(Bitmap.createBitmap(createScaledBitmap2, 0, 0, createScaledBitmap2.getWidth(), createScaledBitmap2.getHeight(), matrix, true), f5, f3 - r2.getHeight(), paint);
|
|
}
|
|
}
|
|
|
|
public void setLineFocus(boolean z) {
|
|
this.c = z;
|
|
invalidate();
|
|
}
|
|
|
|
public void setOnStateChangeListener(HBt hBt) {
|
|
this.e = hBt;
|
|
}
|
|
|
|
public void setCircleRadius(int i) {
|
|
this.d = i;
|
|
}
|
|
}
|