what-the-bank/sources/com/facetec/sdk/bj.java

310 lines
10 KiB
Java

package com.facetec.sdk;
import android.animation.Animator;
import android.animation.ValueAnimator;
import android.content.Context;
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.view.View;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.Random;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class bj extends View {
float a;
c b;
Paint c;
int d;
int e;
private final Context f;
private boolean g;
private RectF h;
float i;
private boolean j;
private float l;
private Paint m;
/* renamed from: o, reason: collision with root package name */
private float f6414o;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public enum c {
DEFAULT,
SMALL_FOR_OVERZOOMED
}
public bj(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.b = c.DEFAULT;
this.j = false;
this.g = false;
this.f = context;
post(new Runnable(this) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda5
public final bj f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.e();
}
{
this.f$0 = this;
}
});
}
@Override // android.view.View
protected final void onDraw(Canvas canvas) {
RectF rectF;
Paint paint;
canvas.drawColor(db.b(db.a(this.f), 255));
if (!this.j || (rectF = this.h) == null || (paint = this.m) == null || this.c == null) {
return;
}
float f = this.d;
canvas.drawRoundRect(rectF, f, f, paint);
RectF rectF2 = this.h;
float f2 = this.d;
canvas.drawRoundRect(rectF2, f2, f2, this.c);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final RectF b() {
if (this.h == null) {
a(false);
}
return this.h;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void c() {
this.j = true;
postInvalidate();
}
@Override // android.view.View
protected final void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
a(true);
c();
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: d, reason: merged with bridge method [inline-methods] */
public final void e() {
this.d = Math.round(av.b(db.F()) * db.d());
this.e = Math.round(av.b(db.s()) * db.d());
d(db.a());
setLayerType(1, null);
Paint paint = new Paint(1);
this.m = paint;
paint.setStyle(Paint.Style.FILL);
this.m.setAlpha(0);
this.m.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
setLayerType(2, null);
Paint paint2 = new Paint(1);
this.c = paint2;
paint2.setStyle(Paint.Style.STROKE);
this.c.setStrokeWidth(Math.round(this.e));
this.c.setColor(db.d(this.f));
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void a(boolean z) {
if (!this.g || z) {
this.g = true;
int width = getWidth();
int height = getHeight();
float f = width;
float a = (f - (db.a() * 2.0f)) * a();
float f2 = height;
float f3 = (f2 - (0.632f * a)) / 2.0f;
float f4 = (f - a) / 2.0f;
d(f4);
RectF rectF = new RectF();
this.h = rectF;
rectF.set(f4, f3, f - f4, f2 - f3);
ah.h = this.h.centerX();
ah.i = this.h.centerY();
}
}
private void d(float f) {
this.a = f;
this.f6414o = f / 1.5f;
this.l = getWidth() / 2.0f;
this.i = this.a;
}
private RectF b(float f) {
float width = getWidth();
float height = getHeight();
float f2 = (height - ((width - (f * 2.0f)) * 0.632f)) / 2.0f;
return new RectF(f, f2, width - f, height - f2);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void b(final Runnable runnable) {
final Runnable runnable2 = new Runnable(this, runnable) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda2
public final bj f$0;
public final Runnable f$1;
@Override // java.lang.Runnable
public final void run() {
this.f$0.c(this.f$1);
}
{
this.f$0 = this;
this.f$1 = runnable;
}
};
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.i, this.f6414o);
ofFloat.setDuration(200L);
ofFloat.setInterpolator(new DecelerateInterpolator());
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda3
public final bj f$0;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
this.f$0.b(valueAnimator);
}
{
this.f$0 = this;
}
});
ofFloat.addListener(new e(runnable2) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda4
public final Runnable f$0;
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
bj.c(this.f$0, animator);
}
{
this.f$0 = runnable2;
}
});
ofFloat.start();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.i = floatValue;
this.h = b(floatValue);
c();
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void c(Runnable runnable, Animator animator) {
if (runnable != null) {
runnable.run();
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c(ValueAnimator valueAnimator) {
float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue();
this.i = floatValue;
this.h = b(floatValue);
this.d = Math.min(Math.round(((getWidth() - (this.i * 2.0f)) * 0.632f) / 2.0f), this.d);
c();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void e(final Runnable runnable, Animator animator) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.e, BitmapDescriptorFactory.HUE_RED);
ofFloat.setDuration(100L);
ofFloat.setInterpolator(new AccelerateInterpolator());
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda0
public final bj f$0;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
this.f$0.a(valueAnimator);
}
{
this.f$0 = this;
}
});
ofFloat.addListener(new e(runnable) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda1
public final Runnable f$0;
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator2) {
bj.a(this.f$0, animator2);
}
{
this.f$0 = runnable;
}
});
ofFloat.start();
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ValueAnimator valueAnimator) {
this.c.setStrokeWidth(((Float) valueAnimator.getAnimatedValue()).floatValue());
c();
}
/* JADX INFO: Access modifiers changed from: private */
public static /* synthetic */ void a(Runnable runnable, Animator animator) {
if (runnable != null) {
runnable.run();
}
}
private float a() {
if (this.b != c.SMALL_FOR_OVERZOOMED) {
return 1.0f;
}
return 1.0f / (((new Random().nextInt(Math.round(0.050000004f) + 1) / 100.0f) + 0.1f) + 1.0f);
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void c(final Runnable runnable) {
ValueAnimator ofFloat = ValueAnimator.ofFloat(this.i, this.l);
ofFloat.setDuration(400L);
ofFloat.setInterpolator(new AccelerateInterpolator());
ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda6
public final bj f$0;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
this.f$0.c(valueAnimator);
}
{
this.f$0 = this;
}
});
ofFloat.addListener(new e(this, runnable) { // from class: com.facetec.sdk.bj$$ExternalSyntheticLambda7
public final bj f$0;
public final Runnable f$1;
@Override // android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
this.f$0.e(this.f$1, animator);
}
{
this.f$0 = this;
this.f$1 = runnable;
}
});
ofFloat.start();
}
}