package com.facetec.sdk; import android.app.Activity; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.Looper; import android.view.ViewPropertyAnimator; import androidx.vectordrawable.graphics.drawable.Animatable2Compat; import androidx.vectordrawable.graphics.drawable.AnimatedVectorDrawableCompat; import com.facetec.sdk.FaceTecCancelButtonCustomization; import com.facetec.sdk.aq; import com.facetec.sdk.bu; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import java.util.Objects; import o.nMh; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public final class bu { protected AnimatedVectorDrawableCompat a; protected final co b; private boolean j; private final Handler d = new Handler(Looper.getMainLooper()); private boolean e = false; private boolean c = false; /* JADX INFO: Access modifiers changed from: package-private */ public bu(co coVar, boolean z) { this.b = coVar; this.j = z; } private void e(final boolean z) { b(); this.b.c(new Runnable(this, z) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda2 public final bu f$0; public final boolean f$1; @Override // java.lang.Runnable public final void run() { this.f$0.g(this.f$1); } { this.f$0 = this; this.f$1 = z; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void g(boolean z) { int aY; int aZ; Drawable drawable; if (this.j) { aY = db.aX(); aZ = db.ba(); } else { aY = db.aY(); aZ = db.aZ(); } Activity activity = this.b.getActivity(); if (z && aZ != 0) { this.a = av.e(activity, aZ); } else if (!z && aY != 0) { this.a = av.e(activity, aY); } if (this.a != null) { this.b.e.setImageDrawable(this.a); this.a.a(new AnonymousClass1(this)); AnimatedVectorDrawableCompat animatedVectorDrawableCompat = this.a; if (animatedVectorDrawableCompat != null) { animatedVectorDrawableCompat.start(); return; } return; } this.b.e.getLayoutParams().width = (int) (this.b.e.getLayoutParams().height * 0.875f); this.b.e.requestLayout(); if (z) { int be = db.be(); if (be == 0) { be = R.drawable.facetec_internal_nfc; } drawable = nMh.getDrawable(activity, be); } else { int bf = db.bf(); if (bf == 0) { bf = R.drawable.facetec_internal_nfc; } drawable = nMh.getDrawable(activity, bf); } if (drawable != null) { this.b.e.setImageDrawable(drawable); } } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.facetec.sdk.bu$1, reason: invalid class name */ /* loaded from: classes.dex */ public final class AnonymousClass1 extends Animatable2Compat.AnimationCallback { private bu d; AnonymousClass1(bu buVar) { this.d = buVar; } @Override // androidx.vectordrawable.graphics.drawable.Animatable2Compat.AnimationCallback public final void onAnimationEnd(Drawable drawable) { this.d.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$1$$ExternalSyntheticLambda0 public final bu.AnonymousClass1 f$0; @Override // java.lang.Runnable public final void run() { this.f$0.e(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void e() { if (this.d.a != null) { this.d.a.start(); } } } private void b() { AnimatedVectorDrawableCompat animatedVectorDrawableCompat = this.a; if (animatedVectorDrawableCompat != null) { animatedVectorDrawableCompat.stop(); this.a.c(); this.a = null; } } /* JADX INFO: Access modifiers changed from: package-private */ public final void d(final boolean z) { if (this.b.getActivity() == null) { return; } this.b.c(new Runnable(this, z) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda4 public final bu f$0; public final boolean f$1; @Override // java.lang.Runnable public final void run() { this.f$0.f(this.f$1); } { this.f$0 = this; this.f$1 = z; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void f(boolean z) { f(); if (z) { ViewPropertyAnimator listener = this.b.b.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null); co coVar = this.b; Objects.requireNonNull(coVar); listener.withEndAction(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda10 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.w(); } { this.f$0 = this; } })).start(); return; } this.b.d(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda11 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.r(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void w() { d(db.e(bw.STARTING, this.j)); this.b.b.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void r() { FaceTecSessionActivity faceTecSessionActivity = (FaceTecSessionActivity) this.b.getActivity(); if (faceTecSessionActivity == null) { return; } if (FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM && FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.DISABLED) { this.b.j.setVisibility(0); } else if (FaceTecSDK.c.k.b == FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM) { faceTecSessionActivity.f6412o.setVisibility(0); faceTecSessionActivity.f6412o.setAlpha(BitmapDescriptorFactory.HUE_RED); } if (dl.e(this.b.getActivity()) && !dl.a(faceTecSessionActivity)) { a(true); faceTecSessionActivity.F(); d(db.e(bw.DISABLED, this.j)); } else { d(db.e(bw.STARTING, this.j)); } this.b.d.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); this.b.e().animate().alpha(1.0f).setDuration(800L).setListener(null).start(); b(true); this.b.a(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda6 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.x(); } { this.f$0 = this; } }, 100L); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void x() { e(false); } /* JADX INFO: Access modifiers changed from: package-private */ public final void c() { this.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda13 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.s(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void s() { f(); this.b.e.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null).start(); ViewPropertyAnimator listener = this.b.b.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null); co coVar = this.b; Objects.requireNonNull(coVar); listener.withEndAction(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda16 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.q(); } { this.f$0 = this; } })).start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void q() { d(db.e(bw.WEAK_CONNECTION, this.j)); this.b.e.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); this.b.b.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); b(true); this.b.a(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda9 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.p(); } { this.f$0 = this; } }, 100L); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void p() { e(false); } /* JADX INFO: Access modifiers changed from: package-private */ public final void d() { this.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda5 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.n(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void n() { a(true); b(false); this.b.e.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null).start(); ViewPropertyAnimator listener = this.b.b.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null); co coVar = this.b; Objects.requireNonNull(coVar); listener.withEndAction(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda17 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.k(); } { this.f$0 = this; } })).start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void k() { d(db.e(bw.SCANNING, this.j)); this.b.e.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); this.b.b.animate().alpha(1.0f).setDuration(800L).setListener(null).start(); this.b.a(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda0 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.t(); } { this.f$0 = this; } }, 100L); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void t() { e(true); } /* JADX INFO: Access modifiers changed from: package-private */ public final void e() { this.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda14 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.o(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void o() { a(true); b(false); ViewPropertyAnimator listener = this.b.d.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null); co coVar = this.b; Objects.requireNonNull(coVar); listener.withEndAction(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda15 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.l(); } { this.f$0 = this; } })).start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void l() { b(); this.b.e().setVisibility(8); this.b.a.setVisibility(0); } private void b(boolean z) { float f = z ? 1.0f : BitmapDescriptorFactory.HUE_RED; FaceTecSessionActivity faceTecSessionActivity = (FaceTecSessionActivity) this.b.getActivity(); if (FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM) { this.b.j.animate().alpha(f).setDuration(800L).setListener(null).start(); this.b.j.setEnabled(z); } else { faceTecSessionActivity.f6412o.animate().alpha(f).setDuration(800L).setListener(null).start(); faceTecSessionActivity.f6412o.setEnabled(z); } } private void d(final String str) { if (this.b.getActivity() == null) { return; } this.b.c(new Runnable(this, str) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda8 public final bu f$0; public final String f$1; @Override // java.lang.Runnable public final void run() { this.f$0.e(this.f$1); } { this.f$0 = this; this.f$1 = str; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void e(String str) { this.b.b.setText(str); } private void a(boolean z) { this.e = z; if (z) { a(); c(true); this.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda12 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.m(); } { this.f$0 = this; } }); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void m() { this.b.i.animate().alpha(BitmapDescriptorFactory.HUE_RED).setDuration(800L).setListener(null).start(); } private void c(boolean z) { this.c = z; if (z) { a(); this.b.c(new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda1 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.j(); } { this.f$0 = this; } }); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void j() { this.b.i.c(false, this.b.i.getAlpha() > BitmapDescriptorFactory.HUE_RED); } private void a() { Handler handler = this.d; if (handler != null) { handler.removeCallbacksAndMessages(null); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void h() { if (this.c || this.b.i.getAlpha() != 1.0f || this.b.i.isEnabled()) { return; } this.b.i.c(true, this.b.i.getAlpha() > BitmapDescriptorFactory.HUE_RED); } private void f() { int i = this.b.i.getAlpha() == 1.0f ? 0 : 6000; a(); a(false); c(false); Handler handler = this.d; co coVar = this.b; Objects.requireNonNull(coVar); handler.postDelayed(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda7 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.g(); } { this.f$0 = this; } }), i); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void g() { if (this.e) { return; } ViewPropertyAnimator listener = this.b.i.animate().alpha(1.0f).setDuration(this.b.i.getAlpha() == 1.0f ? 0 : 800).setListener(null); co coVar = this.b; Objects.requireNonNull(coVar); listener.withEndAction(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda3 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.i(); } { this.f$0 = this; } })); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void i() { if (this.c) { return; } int i = (this.b.i.getAlpha() == 1.0f && this.b.i.isEnabled()) ? 0 : 4000; c(false); Handler handler = this.d; co coVar = this.b; Objects.requireNonNull(coVar); handler.postDelayed(new aq.e(coVar, new Runnable(this) { // from class: com.facetec.sdk.bu$$ExternalSyntheticLambda18 public final bu f$0; @Override // java.lang.Runnable public final void run() { this.f$0.h(); } { this.f$0 = this; } }), i); } }