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

493 lines
18 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package com.facetec.sdk;
import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.os.Build;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.OvershootInterpolator;
import com.facetec.sdk.cr;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public class cr extends View {
private static final int q = (int) av.b(10);
protected RectF a;
RectF b;
protected Paint c;
private boolean d;
protected Paint e;
protected final float f;
protected RectF g;
protected final float h;
protected RectF i;
AnimatorSet j;
private AnimatorSet k;
AnimatorSet l;
AnimatorSet m;
private Paint n;
/* renamed from: o, reason: collision with root package name */
private d f6425o;
private Animator p;
private final Handler r;
private boolean s;
public cr(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.p = null;
this.s = false;
this.r = new Handler();
this.f = av.b(db.y()) * db.d();
this.h = av.b(db.w()) * db.d();
post(new Runnable(this) { // from class: com.facetec.sdk.cr$$ExternalSyntheticLambda2
public final cr f$0;
@Override // java.lang.Runnable
public final void run() {
this.f$0.b();
}
{
this.f$0 = this;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void b() {
e(false);
e();
float width = this.b.width() / this.a.width();
float height = this.b.height() / this.a.height();
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_X, 1.0f, width);
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_Y, 1.0f, height);
AnimatorSet animatorSet = new AnimatorSet();
this.j = animatorSet;
animatorSet.setInterpolator(new OvershootInterpolator(0.8f));
this.j.setDuration(1600L);
this.j.playTogether(ofFloat, ofFloat2);
AnimatorSet animatorSet2 = new AnimatorSet();
this.k = animatorSet2;
animatorSet2.setDuration(0L);
this.k.playTogether(ofFloat, ofFloat2);
ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_X, 1.0f, width);
ObjectAnimator ofFloat4 = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_Y, 1.0f, height);
AnimatorSet animatorSet3 = new AnimatorSet();
this.m = animatorSet3;
animatorSet3.setInterpolator(new OvershootInterpolator(1.5f));
this.m.setDuration(1200L);
this.m.playTogether(ofFloat3, ofFloat4);
ObjectAnimator ofFloat5 = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_X, width, 1.0f);
ObjectAnimator ofFloat6 = ObjectAnimator.ofFloat(this, (Property<cr, Float>) View.SCALE_Y, height, 1.0f);
AnimatorSet animatorSet4 = new AnimatorSet();
this.l = animatorSet4;
animatorSet4.setDuration(700L);
this.l.playTogether(ofFloat5, ofFloat6);
}
public final void c() {
d dVar = this.f6425o;
if (dVar != null) {
dVar.d();
}
}
public final void j() {
d();
invalidate();
}
public void setTransparentBackground() {
if (this.n == null) {
e();
d();
}
this.n.setColor(0);
invalidate();
}
public void setOvalStrokeWidth(int i) {
if (this.e == null) {
e();
d();
}
this.e.setStrokeWidth(i);
invalidate();
}
public final RectF i() {
e(false);
return this.a;
}
public final int h() {
return (int) this.a.bottom;
}
public final void f() {
setOvalHasExpanded(false);
c(this.l);
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void c(final AnimatorSet animatorSet) {
this.p = animatorSet;
this.r.post(new Runnable(this, animatorSet) { // from class: com.facetec.sdk.cr$$ExternalSyntheticLambda1
public final cr f$0;
public final AnimatorSet f$1;
@Override // java.lang.Runnable
public final void run() {
this.f$0.a(this.f$1);
}
{
this.f$0 = this;
this.f$1 = animatorSet;
}
});
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(AnimatorSet animatorSet) {
if (animatorSet != null) {
animatorSet.start();
} else {
t.a(getContext(), com.facetec.sdk.d.NON_FATAL_ERROR, "animatorSet is null unexpectedly.");
}
}
/* JADX WARN: Removed duplicated region for block: B:14:0x0040 */
/* JADX WARN: Removed duplicated region for block: B:17:? A[RETURN, SYNTHETIC] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public final void e(final java.lang.Runnable r10, boolean r11) {
/*
r9 = this;
r9.j()
if (r11 == 0) goto La
com.facetec.sdk.FaceTecCustomization r11 = com.facetec.sdk.FaceTecSDK.c
com.facetec.sdk.FaceTecExitAnimationStyle r11 = r11.t
goto Le
La:
com.facetec.sdk.FaceTecCustomization r11 = com.facetec.sdk.FaceTecSDK.c
com.facetec.sdk.FaceTecExitAnimationStyle r11 = r11.q
Le:
int[] r0 = com.facetec.sdk.cr.AnonymousClass5.c
int r1 = r11.ordinal()
r0 = r0[r1]
r1 = 800(0x320, float:1.121E-42)
r2 = 2
if (r0 == r2) goto L39
r3 = 3
if (r0 == r3) goto L32
r3 = 4
if (r0 == r3) goto L22
goto L39
L22:
android.content.Context r0 = r9.getContext()
int r0 = com.facetec.sdk.db.l(r0)
android.graphics.Paint r1 = r9.e
r1.setColor(r0)
r0 = 1000(0x3e8, float:1.401E-42)
r1 = r0
L32:
r0 = 1074161254(0x40066666, float:2.1)
r3 = 1072064102(0x3fe66666, float:1.8)
goto L3c
L39:
r0 = 1065353216(0x3f800000, float:1.0)
r3 = r0
L3c:
com.facetec.sdk.FaceTecExitAnimationStyle r4 = com.facetec.sdk.FaceTecExitAnimationStyle.NONE
if (r11 == r4) goto L8f
android.util.Property r11 = android.view.View.SCALE_X
float r4 = r9.getScaleX()
float[] r5 = new float[r2]
r6 = 0
r5[r6] = r4
r4 = 1
r5[r4] = r3
android.animation.ObjectAnimator r11 = android.animation.ObjectAnimator.ofFloat(r9, r11, r5)
android.util.Property r3 = android.view.View.SCALE_Y
float r5 = r9.getScaleY()
float[] r7 = new float[r2]
r7[r6] = r5
r7[r4] = r0
android.animation.ObjectAnimator r0 = android.animation.ObjectAnimator.ofFloat(r9, r3, r7)
android.animation.AnimatorSet r3 = new android.animation.AnimatorSet
r3.<init>()
long r7 = (long) r1
r3.setDuration(r7)
android.view.animation.DecelerateInterpolator r1 = new android.view.animation.DecelerateInterpolator
r1.<init>()
r3.setInterpolator(r1)
android.animation.Animator[] r1 = new android.animation.Animator[r2]
r1[r6] = r11
r1[r4] = r0
r3.playTogether(r1)
com.facetec.sdk.cr$$ExternalSyntheticLambda0 r11 = new com.facetec.sdk.cr$$ExternalSyntheticLambda0
r11.<init>(r9, r10)
r3.addListener(r11)
com.facetec.sdk.cr$2 r10 = new com.facetec.sdk.cr$2
r10.<init>(r9)
r3.addListener(r10)
r9.c(r3)
L8f:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.facetec.sdk.cr.e(java.lang.Runnable, boolean):void");
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.facetec.sdk.cr$5, reason: invalid class name */
/* loaded from: classes.dex */
public static final /* synthetic */ class AnonymousClass5 {
static final int[] c;
static {
int[] iArr = new int[FaceTecExitAnimationStyle.values().length];
c = iArr;
try {
iArr[FaceTecExitAnimationStyle.NONE.ordinal()] = 1;
} catch (NoSuchFieldError unused) {
}
try {
c[FaceTecExitAnimationStyle.RIPPLE_IN.ordinal()] = 2;
} catch (NoSuchFieldError unused2) {
}
try {
c[FaceTecExitAnimationStyle.RIPPLE_OUT.ordinal()] = 3;
} catch (NoSuchFieldError unused3) {
}
try {
c[FaceTecExitAnimationStyle.CIRCLE_FADE.ordinal()] = 4;
} catch (NoSuchFieldError unused4) {
}
}
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void e(Runnable runnable, Animator animator) {
setVisibility(4);
if (runnable != null) {
runnable.run();
}
}
@Override // android.view.View
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
if (this.a != null) {
canvas.drawRect(-400.0f, -400.0f, getWidth() + 800, getHeight() + 800, this.n);
canvas.drawOval(this.a, this.c);
canvas.drawOval(this.i, this.e);
}
d dVar = this.f6425o;
if (dVar == null || dVar.c == null) {
return;
}
float f = -(dVar.b - dVar.j);
canvas.drawArc(dVar.d, dVar.b, f, false, dVar.e);
canvas.drawArc(dVar.d, (dVar.b + 180.0f) % 360.0f, f, false, dVar.a);
}
private void e() {
setLayerType(1, null);
Paint paint = new Paint(1);
this.c = paint;
paint.setStyle(Paint.Style.FILL);
this.c.setAlpha(0);
this.c.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
setLayerType(2, null);
Paint paint2 = new Paint(1);
this.e = paint2;
paint2.setStyle(Paint.Style.STROKE);
this.e.setStrokeWidth(this.f);
String[] strArr = {"Nokia 2.2", "Nokia_2_2", "G5", "G5_Plus", "LM-X320", "LM-X420", "LM-X520", "LM-X525", "JAT-L29", "Infinix X650B", "moto e(6) plus"};
for (int i = 0; i < 11; i++) {
if (Build.MODEL.equals(strArr[i])) {
this.e.setAntiAlias(false);
}
}
Paint paint3 = new Paint(1);
this.n = paint3;
paint3.setStyle(Paint.Style.FILL);
d();
}
/* JADX INFO: Access modifiers changed from: package-private */
public final void e(boolean z) {
synchronized (this) {
if (!this.s || z) {
this.s = true;
int width = getWidth();
int height = db.d() < 1.0f ? Resources.getSystem().getDisplayMetrics().heightPixels : getHeight();
float f = width;
float f2 = 0.65f * f;
float f3 = (f - f2) / 2.0f;
float height2 = (getHeight() - (f2 * 1.48f)) / 2.0f;
RectF rectF = new RectF();
this.a = rectF;
rectF.set(f3, height2, f - f3, getHeight() - height2);
RectF rectF2 = new RectF();
this.i = rectF2;
rectF2.set(this.a.left + (this.f / 2.0f), this.a.top + (this.f / 2.0f), this.a.right - (this.f / 2.0f), this.a.bottom - (this.f / 2.0f));
RectF rectF3 = new RectF();
this.g = rectF3;
rectF3.set(this.a.left + this.f, this.a.top + this.f, this.a.right - this.f, this.a.bottom - this.f);
float f4 = 0.98f * f;
float f5 = (f - f4) / 2.0f;
float f6 = f4 * 1.7f;
float f7 = height - (q << 1);
if (f7 <= f6) {
f6 = f7;
}
float height3 = (getHeight() - f6) / 2.0f;
RectF rectF4 = new RectF();
this.b = rectF4;
rectF4.set(f5, height3, f - f5, getHeight() - height3);
this.f6425o = new d(this, getContext());
}
}
}
private void d() {
if (this.n != null) {
Context context = getContext();
this.e.setColor(db.n(context));
this.n.setColor(db.l(context));
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public final class d {
final Paint a;
final Paint e;
private final int f;
private final TimeInterpolator g;
private final int i;
private cr l;
AnimatorSet c = null;
RectF d = null;
float b = BitmapDescriptorFactory.HUE_RED;
float j = BitmapDescriptorFactory.HUE_RED;
private final ValueAnimator.AnimatorUpdateListener h = new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.facetec.sdk.cr$d$$ExternalSyntheticLambda0
public final cr.d f$0;
@Override // android.animation.ValueAnimator.AnimatorUpdateListener
public final void onAnimationUpdate(ValueAnimator valueAnimator) {
this.f$0.a(valueAnimator);
}
{
this.f$0 = this;
}
};
d(cr crVar, Context context) {
this.l = crVar;
int d = db.d(context, FaceTecSDK.c.n.progressColor1);
int d2 = db.d(context, FaceTecSDK.c.n.progressColor2);
this.a = b(d);
this.e = b(d2);
this.i = db.c(context, FaceTecSDK.c.n.progressColor1);
this.f = db.c(context, FaceTecSDK.c.n.progressColor2);
this.g = new AccelerateDecelerateInterpolator();
}
private boolean c() {
AnimatorSet animatorSet = this.c;
return animatorSet != null && animatorSet.isStarted();
}
final void d() {
if (c()) {
return;
}
if (this.d == null) {
float b = FaceTecSDK.c.n.progressRadialOffset == 0 ? this.l.h + this.l.f : av.b((int) (FaceTecSDK.c.n.progressRadialOffset * db.d()));
this.d = new RectF(this.l.i.left + b, this.l.i.top + b, this.l.i.right - b, this.l.i.bottom - b);
}
ObjectAnimator c = c(this.a, this.i);
ObjectAnimator c2 = c(this.e, this.f);
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this, "startStrokePosition", BitmapDescriptorFactory.HUE_RED, 360.0f);
boolean g = this.l.g();
ofFloat.addUpdateListener(this.h);
ofFloat.setInterpolator(this.g);
ofFloat.setDuration(g ? 1000L : 800L);
this.j = BitmapDescriptorFactory.HUE_RED;
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this, "endStrokePosition", BitmapDescriptorFactory.HUE_RED, 360.0f);
ofFloat2.setDuration(g ? 1000L : 800L);
ofFloat2.addUpdateListener(this.h);
ofFloat2.setInterpolator(this.g);
ofFloat2.setStartDelay(g ? 200L : 100L);
AnimatorSet animatorSet = new AnimatorSet();
this.c = animatorSet;
animatorSet.playTogether(ofFloat, ofFloat2, c, c2);
this.c.start();
}
private ObjectAnimator c(Paint paint, int i) {
paint.setAlpha(Math.max(0, i - 50));
double d = i;
ObjectAnimator ofInt = ObjectAnimator.ofInt(paint, "alpha", (int) (0.8d * d), (int) (d * 0.24d));
ofInt.setDuration(500L);
ofInt.setInterpolator(new DecelerateInterpolator());
ofInt.setStartDelay(this.l.g() ? 600L : 400L);
return ofInt;
}
private Paint b(int i) {
Paint paint = new Paint(1);
paint.setStyle(Paint.Style.STROKE);
paint.setStrokeWidth(this.l.h);
paint.setStrokeJoin(Paint.Join.ROUND);
paint.setStrokeCap(Paint.Cap.ROUND);
paint.setColor(i);
return paint;
}
/* JADX INFO: Access modifiers changed from: private */
public /* synthetic */ void a(ValueAnimator valueAnimator) {
this.l.invalidate();
}
public final void setStartStrokePosition(float f) {
this.b = f;
}
public final void setEndStrokePosition(float f) {
this.j = f;
}
}
public void setOvalHasExpanded(boolean z) {
this.d = z;
}
/* JADX INFO: Access modifiers changed from: package-private */
public final boolean g() {
return this.d;
}
}