package com.facetec.sdk; import android.animation.Animator; import android.animation.ArgbEvaluator; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Typeface; import android.graphics.drawable.Drawable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import androidx.appcompat.widget.AppCompatButton; import com.facetec.sdk.FaceTecSDK; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import o.nMh; import org.bouncycastle.asn1.x509.DisplayText; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public class a extends AppCompatButton { private int a; private Typeface b; private int c; private Drawable d; boolean e; private int f; private int g; private int h; private int i; private int j; private ValueAnimator k; private boolean l; private FaceTecSDK.e m; private boolean n; /* renamed from: o, reason: collision with root package name */ private EnumC0004a f6402o; private ValueAnimator q; private ValueAnimator t; /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.facetec.sdk.a$a, reason: collision with other inner class name */ /* loaded from: classes.dex */ public enum EnumC0004a { Guidance, IDScan, OCRConfirmation } public a(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.f = DisplayText.DISPLAY_TEXT_MAXIMUM_SIZE; this.e = false; this.l = false; this.n = false; this.f6402o = EnumC0004a.Guidance; this.m = FaceTecSDK.e.NORMAL; this.k = new ValueAnimator(); this.t = new ValueAnimator(); this.q = new ValueAnimator(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void c(final Runnable runnable) { setOnClickListener(new View.OnClickListener(this, runnable) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda4 public final a f$0; public final Runnable f$1; @Override // android.view.View.OnClickListener public final void onClick(View view) { this.f$0.a(this.f$1, view); } { this.f$0 = this; this.f$1 = runnable; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void a(Runnable runnable, View view) { a(false, true); if (runnable != null) { runnable.run(); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void e() { if (this.n) { return; } av.c(this); this.n = true; Context context = getContext(); this.d = nMh.getDrawable(context, R.drawable.facetec_button_background); int i = AnonymousClass3.b[this.f6402o.ordinal()]; if (i == 1) { this.a = db.d(context, isEnabled() ? db.T() : db.V()); this.c = db.d(context, isEnabled() ? db.O() : db.X()); this.h = db.d(context, db.U()); this.j = db.k(); this.g = db.z(); this.i = 20; this.b = FaceTecSDK.c.f.buttonFont; } else if (i == 2) { this.a = db.d(context, isEnabled() ? db.Z() : db.ad()); this.c = db.d(context, isEnabled() ? db.Y() : db.aa()); this.h = db.d(context, db.ah()); this.j = db.m(); this.g = db.C(); this.i = 20; this.b = FaceTecSDK.c.h.buttonFont; } else if (i == 3) { this.a = db.d(context, isEnabled() ? db.ai() : db.al()); this.c = db.d(context, isEnabled() ? db.ag() : db.ae()); this.h = db.d(context, db.am()); this.j = db.n(); this.g = db.H(); this.i = 20; this.b = FaceTecSDK.c.i.buttonFont; } setTextSize(2, this.i * db.e() * db.d()); setTypeface(this.b); setMaxLines(1); d(false); setOnTouchListener(new View.OnTouchListener(this) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda5 public final a f$0; @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { boolean b; b = this.f$0.b(view, motionEvent); return b; } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.facetec.sdk.a$3, reason: invalid class name */ /* loaded from: classes.dex */ public static final /* synthetic */ class AnonymousClass3 { static final int[] b; static { int[] iArr = new int[EnumC0004a.values().length]; b = iArr; try { iArr[EnumC0004a.Guidance.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { b[EnumC0004a.IDScan.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { b[EnumC0004a.OCRConfirmation.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ boolean b(View view, MotionEvent motionEvent) { if (!isEnabled()) { return true; } if (motionEvent.getAction() == 0) { a(true, false); } else if (motionEvent.getAction() == 3 || motionEvent.getX() < BitmapDescriptorFactory.HUE_RED || motionEvent.getX() > getWidth() || motionEvent.getY() < BitmapDescriptorFactory.HUE_RED || motionEvent.getY() > getHeight()) { a(false, true); } else if (motionEvent.getAction() == 1) { performClick(); } return true; } /* JADX INFO: Access modifiers changed from: package-private */ public final void b() { this.f6402o = EnumC0004a.IDScan; this.n = false; e(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void c() { this.f6402o = EnumC0004a.OCRConfirmation; this.n = false; e(); } private void d(boolean z) { int d; int d2; if (this.e) { d(); } this.e = true; final Context context = getContext(); final float d3 = db.d(); int i = 0; int i2 = z ? this.f : 0; int i3 = this.a; int i4 = this.h; int i5 = this.c; int i6 = AnonymousClass3.b[this.f6402o.ordinal()]; if (i6 == 1) { d = db.d(context, db.U()); if (!isEnabled()) { i = db.d(context, db.V()); d2 = db.d(context, db.X()); } else if (this.l) { i = db.d(context, db.W()); d2 = db.d(context, db.R()); } else { i = db.d(context, db.T()); d2 = db.d(context, db.O()); } } else if (i6 == 2) { d = db.d(context, db.ah()); if (!isEnabled()) { i = db.d(context, db.ad()); d2 = db.d(context, db.aa()); } else if (this.l) { i = db.d(context, db.ab()); d2 = db.d(context, db.ac()); } else { i = db.d(context, db.Z()); d2 = db.d(context, db.Y()); } } else if (i6 != 3) { d = 0; d2 = 0; } else { d = db.d(context, db.am()); if (!isEnabled()) { i = db.d(context, db.al()); d2 = db.d(context, db.ae()); } else if (this.l) { i = db.d(context, db.ak()); d2 = db.d(context, db.af()); } else { i = db.d(context, db.ai()); d2 = db.d(context, db.ag()); } } ValueAnimator ofObject = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(i3), Integer.valueOf(i)); this.k = ofObject; long j = i2; ofObject.setDuration(j); this.k.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this, context) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda0 public final a f$0; public final Context f$1; @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { this.f$0.e(this.f$1, valueAnimator); } { this.f$0 = this; this.f$1 = context; } }); this.k.start(); ValueAnimator ofObject2 = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(i4), Integer.valueOf(d)); this.t = ofObject2; ofObject2.setDuration(j); this.t.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this, context, d3) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda1 public final a f$0; public final Context f$1; public final float f$2; @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { this.f$0.b(this.f$1, this.f$2, valueAnimator); } { this.f$0 = this; this.f$1 = context; this.f$2 = d3; } }); this.t.start(); ValueAnimator ofObject3 = ValueAnimator.ofObject(new ArgbEvaluator(), Integer.valueOf(i5), Integer.valueOf(d2)); this.q = ofObject3; ofObject3.setDuration(j); this.q.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda2 public final a f$0; @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { this.f$0.c(valueAnimator); } { this.f$0 = this; } }); this.q.addListener(new e(this) { // from class: com.facetec.sdk.a$$ExternalSyntheticLambda3 public final a f$0; @Override // android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { this.f$0.d(animator); } { this.f$0 = this; } }); this.q.start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void e(Context context, ValueAnimator valueAnimator) { this.a = ((Integer) valueAnimator.getAnimatedValue()).intValue(); db.c(this.d, ((Integer) valueAnimator.getAnimatedValue()).intValue()); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void b(Context context, float f, ValueAnimator valueAnimator) { this.h = ((Integer) valueAnimator.getAnimatedValue()).intValue(); db.b(this.d, ((Integer) valueAnimator.getAnimatedValue()).intValue(), Math.round(av.b(this.j) * f), av.b(this.g) * f); setBackground(this.d); postInvalidate(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void c(ValueAnimator valueAnimator) { this.c = ((Integer) valueAnimator.getAnimatedValue()).intValue(); setTextColor(((Integer) valueAnimator.getAnimatedValue()).intValue()); } @Override // android.widget.TextView, android.view.View public void setEnabled(boolean z) { super.setEnabled(z); d(false); } /* JADX INFO: Access modifiers changed from: package-private */ public final void c(boolean z, boolean z2) { if (isEnabled() == z) { if (this.e) { return; } d(false); } else { super.setEnabled(z); this.f = DisplayText.DISPLAY_TEXT_MAXIMUM_SIZE; d(z2); } } private void a(boolean z, boolean z2) { if (this.l == z || !isEnabled()) { return; } this.l = z; d(z2); } /* JADX INFO: Access modifiers changed from: package-private */ public final void a() { if (this.m == FaceTecSDK.d) { return; } this.m = FaceTecSDK.d; this.f = 1000; d(true); } private void d() { this.k.cancel(); this.t.cancel(); this.q.cancel(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void d(Animator animator) { this.e = false; } }