package com.facetec.sdk; import android.animation.Animator; import android.animation.AnimatorSet; import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Resources; import android.os.Bundle; import android.os.Handler; import android.os.Looper; import android.util.Property; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewTreeObserver; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.RelativeLayout; import android.widget.TextView; import com.facetec.sdk.FaceTecCancelButtonCustomization; import com.facetec.sdk.FaceTecSDK; import com.facetec.sdk.aq; import com.facetec.sdk.be; import com.facetec.sdk.bg; import com.facetec.sdk.bs; import com.facetec.sdk.cd; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public abstract class bb extends aq { private Runnable A; private cd.c D; protected RelativeLayout a; protected az b; protected a c; protected ViewGroup d; protected ImageView e; protected Animator g; protected View h; private ImageView k; private TextView l; private TextView m; private TextView n; /* renamed from: o, reason: collision with root package name */ private ImageView f6410o; private TextView p; private View q; private TextView r; private TextView s; private ViewGroup t; private AnimatorSet u; private Animator v; private Handler x; private bs z; private boolean y = false; protected boolean i = false; protected boolean f = false; protected boolean j = false; private boolean w = false; private Handler B = new Handler(Looper.getMainLooper()); private aq.e C = null; private final bs.d E = new bs.d(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda5 public final bb f$0; @Override // com.facetec.sdk.bs.d public final void onDarkLightDetected() { this.f$0.B(); } { this.f$0 = this; } }; protected abstract void a(); protected abstract void b(); /* JADX INFO: Access modifiers changed from: protected */ public abstract void c(); protected abstract void d(); protected abstract void e(); protected abstract boolean f(); @Override // android.app.Fragment public void onDestroy() { super.onDestroy(); s(); } /* JADX INFO: Access modifiers changed from: package-private */ public final be j() { return (be) getActivity(); } /* JADX INFO: Access modifiers changed from: package-private */ public final bg h() { return (bg) getActivity(); } private cd l() { bg h = h(); if (h != null) { return h.b; } return null; } @Override // com.facetec.sdk.aq, android.app.Fragment public void onCreate(Bundle bundle) { super.onCreate(bundle); } @Override // android.app.Fragment public void onPause() { Runnable runnable; super.onPause(); this.q.removeCallbacks(null); AnimatorSet animatorSet = this.u; if (animatorSet != null) { animatorSet.cancel(); } Handler handler = this.x; if (handler == null || (runnable = this.A) == null) { return; } handler.removeCallbacks(runnable); } @Override // android.app.Fragment public Animator onCreateAnimator(int i, boolean z, int i2) { Animator animator; Animator animator2; return (!z || (animator2 = this.v) == null) ? (z || (animator = this.g) == null) ? super.onCreateAnimator(i, z, i2) : animator : animator2; } @Override // android.app.Fragment public View onCreateView(LayoutInflater layoutInflater, ViewGroup viewGroup, Bundle bundle) { View inflate = layoutInflater.inflate(R.layout.facetec_guidance_fragment, viewGroup, false); this.q = inflate; return inflate; } @Override // android.app.Fragment public void onViewCreated(View view, Bundle bundle) { super.onViewCreated(view, bundle); ay.a = false; this.h = view.findViewById(R.id.centerContentView); this.b = (az) view.findViewById(R.id.zoomDialogBackground); this.t = (ViewGroup) view.findViewById(R.id.bottomLayout); this.d = (ViewGroup) view.findViewById(R.id.zoomDialogForeground); this.e = (ImageView) view.findViewById(R.id.backButton); this.l = (TextView) view.findViewById(R.id.zoomDialogIconSubtext); this.f6410o = (ImageView) view.findViewById(R.id.iconImageView); this.n = (TextView) view.findViewById(R.id.zoomDialogHeader); this.m = (TextView) view.findViewById(R.id.messageView1); this.p = (TextView) view.findViewById(R.id.messageView2); this.r = (TextView) view.findViewById(R.id.zoomDialogText3); this.s = (TextView) view.findViewById(R.id.zoomDialogText4); this.c = (a) view.findViewById(R.id.zoomDialogActionButton); this.a = (RelativeLayout) view.findViewById(R.id.guidanceTransitionView); bg h = h(); if (l() != null && h != null && h.a() == be.a.GRANTED && !this.f) { c(h, this.j); } this.k = h.f6412o; this.e.setImportantForAccessibility(2); this.c.setImportantForAccessibility(2); o(); } /* JADX INFO: Access modifiers changed from: package-private */ public final ImageView g() { if (FaceTecSDK.c.k.b == FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM) { return this.k; } if (FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.DISABLED) { return this.e; } return null; } /* JADX INFO: Access modifiers changed from: package-private */ public final void b(boolean z) { if (this.k == null || FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM) { return; } this.k.setEnabled(z); } /* JADX INFO: Access modifiers changed from: package-private */ public final void b(final boolean z, int i, int i2) { final ImageView g = g(); if (g == null) { return; } float f = z ? 1.0f : BitmapDescriptorFactory.HUE_RED; if (i == 0 && i2 == 0) { g.setAlpha(f); g.setVisibility(z ? 0 : 8); } else { if (z) { g.setVisibility(0); } g.animate().alpha(f).setDuration(i).setStartDelay(i2).setListener(null).withEndAction(new aq.e(this, new Runnable(g, z) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda0 public final ImageView f$0; public final boolean f$1; @Override // java.lang.Runnable public final void run() { bb.e(this.f$0, this.f$1); } { this.f$0 = g; this.f$1 = z; } })).start(); } } /* JADX INFO: Access modifiers changed from: private */ public static /* synthetic */ void e(ImageView imageView, boolean z) { if (imageView == null || z) { return; } imageView.setVisibility(8); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void B() { bg h = h(); if (h != null) { h.d(true); } } private void b(ck ckVar) { if (f()) { if (dp.e()) { if (this.c.isEnabled()) { return; } this.c.c(true, true); return; } int i = AnonymousClass4.a[ckVar.ordinal()]; if (i == 1) { if (this.c.isEnabled()) { return; } this.c.c(true, true); } else if (i == 2 && this.c.isEnabled() && !this.i) { this.c.c(false, true); } } } private void k() { s(); cd l = l(); if (l != null) { l.c(this.D); this.D = null; } } /* JADX INFO: Access modifiers changed from: private */ public void d(cl clVar, ch chVar, cj cjVar, ck ckVar) { bg h; if (this.y || (h = h()) == null) { return; } if (clVar == cl.TIMEOUT_GO_TO_RETRY) { if (h.b != null) { cd cdVar = h.b; if (cd.l() && f()) { k(); q().run(); return; } } b(ckVar); k(); h.g(); return; } if (clVar == cl.DETECTING_LIGHT_MODE) { b(ckVar); int i = AnonymousClass4.b[chVar.ordinal()]; if (i == 2) { h.v(); } else if (i == 3) { h.d(false); } if (ckVar == ck.ENABLE) { boolean f = f(); boolean z = this.i; boolean isEnabled = this.c.isEnabled(); boolean z2 = this.C != null; if (f && z && isEnabled && !z2) { t(); aq.e q = q(); this.C = q; this.B.postDelayed(q, 2000L); return; } return; } t(); return; } k(); } private aq.e q() { return new aq.e(this, new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda9 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.z(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void z() { t(); if (h() == null || h().q) { return; } boolean f = f(); boolean z = this.i || dp.e(); boolean isEnabled = this.c.isEnabled(); if (f && z && isEnabled) { x(); } } private void t() { this.B.removeCallbacksAndMessages(null); this.C = null; } private void r() { this.x = new Handler(); Runnable runnable = new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda3 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.D(); } { this.f$0 = this; } }; this.A = runnable; this.x.post(runnable); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void D() { a aVar = this.c; if (aVar != null && !aVar.e && !this.y && this.c.isEnabled()) { this.c.c(true, false); } this.x.postDelayed(this.A, 5000L); } /* JADX INFO: Access modifiers changed from: protected */ public final void c(final Context context, final boolean z) { bg h = h(); if (h != null) { h.y = bg.a.PRE_SESSION_STARTED; } a(new Runnable(this, context, z) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda6 public final bb f$0; public final Context f$1; public final boolean f$2; @Override // java.lang.Runnable public final void run() { this.f$0.d(this.f$1, this.f$2); } { this.f$0 = this; this.f$1 = context; this.f$2 = z; } }, 20L); r(); if (FaceTecSDK.d == FaceTecSDK.e.NORMAL) { if (l() != null) { p(); } a(new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda7 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.w(); } { this.f$0 = this; } }, 185L); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void d(Context context, boolean z) { cd l = l(); if (l != null) { cd.c cVar = new cd.c(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda4 public final bb f$0; @Override // com.facetec.sdk.cd.c public final void onPreSessionProgress(cl clVar, ch chVar, cj cjVar, ck ckVar) { this.f$0.d(clVar, chVar, cjVar, ckVar); } { this.f$0 = this; } }; this.D = cVar; l.b(cVar); if (l.e(context, z) || h() == null) { return; } h().e(ak.y); } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void w() { cd l = l(); bs bsVar = this.z; if (bsVar == null || l == null) { return; } bsVar.b(this.E, l); } private void p() { if (h() == null) { return; } cy.b(new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda8 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.u(); } { this.f$0 = this; } }); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void u() { bg h = h(); this.z = h == null ? null : new bs(h); } private void s() { bs bsVar = this.z; if (bsVar != null) { bsVar.d(); this.z = null; } } /* JADX INFO: Access modifiers changed from: package-private */ public final void i() { if (FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.DISABLED) { ImageView imageView = this.e; if (imageView == null) { t.a(h(), d.NON_FATAL_ERROR, "backButton is null unexpectedly."); } else { imageView.setImageResource(db.aL()); } } this.c.a(); b(); } /* JADX INFO: Access modifiers changed from: package-private */ public void o() { this.e.setEnabled(false); b(false); if (FaceTecSDK.c.k.b != FaceTecCancelButtonCustomization.ButtonLocation.DISABLED) { this.e.setImageResource(db.aL()); } int i = AnonymousClass4.d[FaceTecSDK.c.k.b.ordinal()]; if (i == 2) { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.e.getLayoutParams(); layoutParams.removeRule(20); layoutParams.addRule(21); this.e.setLayoutParams(layoutParams); } else if (i == 3 || i == 4) { this.e.setVisibility(8); } final float e = db.e() * db.d(); db.c(this.a); this.l.setTypeface(bk.a); float f = 20.0f * e; this.l.setTextSize(2, f); db.b(this.l); this.l.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); this.n.setTypeface(bk.e); db.b(this.n); this.n.setTypeface(bk.e); this.n.setTextSize(2, 28.0f * e); this.n.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); this.m.setTypeface(bk.a); this.p.setTypeface(bk.a); this.r.setTypeface(bk.a); this.s.setTypeface(bk.a); this.m.setTextSize(2, f); this.p.setTextSize(2, f); this.r.setTextSize(2, f); this.s.setTextSize(2, f); this.m.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); this.p.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); this.r.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); this.s.setLineSpacing(BitmapDescriptorFactory.HUE_RED, 1.1f); db.b(this.m); db.b(this.p); db.b(this.r); db.b(this.s); this.c.setEnabled(false); this.c.e(); this.c.setAlpha(BitmapDescriptorFactory.HUE_RED); this.h.setAlpha(BitmapDescriptorFactory.HUE_RED); b(false, 0, 0); this.c.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(this, e) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda11 public final bb f$0; public final float f$1; @Override // android.view.ViewTreeObserver.OnGlobalLayoutListener public final void onGlobalLayout() { this.f$0.b(this.f$1); } { this.f$0 = this; this.f$1 = e; } }); av.c(getActivity()); this.e.setOnClickListener(new View.OnClickListener(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda12 public final bb f$0; @Override // android.view.View.OnClickListener public final void onClick(View view) { this.f$0.c(view); } { this.f$0 = this; } }); this.e.setOnTouchListener(new View.OnTouchListener(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda13 public final bb f$0; @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { boolean d; d = this.f$0.d(view, motionEvent); return d; } { this.f$0 = this; } }); this.c.c(new aq.e(this, new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda1 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.x(); } { this.f$0 = this; } })); this.q.post(new aq.e(this, new Runnable(this) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda2 public final bb f$0; @Override // java.lang.Runnable public final void run() { this.f$0.y(); } { this.f$0 = this; } })); } /* JADX INFO: Access modifiers changed from: package-private */ /* renamed from: com.facetec.sdk.bb$4, reason: invalid class name */ /* loaded from: classes.dex */ public static final /* synthetic */ class AnonymousClass4 { static final int[] a; static final int[] b; static final int[] d; static { int[] iArr = new int[FaceTecCancelButtonCustomization.ButtonLocation.values().length]; d = iArr; try { iArr[FaceTecCancelButtonCustomization.ButtonLocation.TOP_LEFT.ordinal()] = 1; } catch (NoSuchFieldError unused) { } try { d[FaceTecCancelButtonCustomization.ButtonLocation.TOP_RIGHT.ordinal()] = 2; } catch (NoSuchFieldError unused2) { } try { d[FaceTecCancelButtonCustomization.ButtonLocation.CUSTOM.ordinal()] = 3; } catch (NoSuchFieldError unused3) { } try { d[FaceTecCancelButtonCustomization.ButtonLocation.DISABLED.ordinal()] = 4; } catch (NoSuchFieldError unused4) { } int[] iArr2 = new int[ch.values().length]; b = iArr2; try { iArr2[ch.DEFAULT.ordinal()] = 1; } catch (NoSuchFieldError unused5) { } try { b[ch.DARK_AS_POSSIBLE.ordinal()] = 2; } catch (NoSuchFieldError unused6) { } try { b[ch.BRIGHT_AS_POSSIBLE.ordinal()] = 3; } catch (NoSuchFieldError unused7) { } int[] iArr3 = new int[ck.values().length]; a = iArr3; try { iArr3[ck.ENABLE.ordinal()] = 1; } catch (NoSuchFieldError unused8) { } try { a[ck.DISABLE.ordinal()] = 2; } catch (NoSuchFieldError unused9) { } } } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void b(float f) { if (this.w) { return; } this.w = true; int b = (int) (av.b(50) * f); int b2 = (int) (av.b(35) * f); int a = db.a(); float f2 = a / 2.0f; int round = Math.round(f2); int round2 = Math.round(f2); RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) this.t.getLayoutParams(); layoutParams.setMargins(0, 0, 0, a); this.t.setLayoutParams(layoutParams); this.c.setLayoutParams(new LinearLayout.LayoutParams((int) ((Resources.getSystem().getDisplayMetrics().widthPixels * db.d()) - (a << 1)), b)); this.c.requestLayout(); RelativeLayout.LayoutParams layoutParams2 = (RelativeLayout.LayoutParams) this.e.getLayoutParams(); layoutParams2.setMargins(round, round, 0, 0); layoutParams2.setMarginStart(round); layoutParams2.setMarginEnd(round); this.e.setLayoutParams(layoutParams2); this.e.setPadding(round2, round2, round2, round2); this.e.getLayoutParams().height = b2; this.e.getLayoutParams().width = b2; this.e.requestLayout(); this.h.animate().alpha(1.0f).setDuration(300L).setListener(null).start(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void c(View view) { this.e.setAlpha(1.0f); this.e.setEnabled(false); b(false); this.c.c(false, true); d(); } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ boolean d(View view, MotionEvent motionEvent) { if (motionEvent.getAction() == 0) { this.e.setAlpha(0.4f); } else if (motionEvent.getAction() == 3 || motionEvent.getX() < BitmapDescriptorFactory.HUE_RED || motionEvent.getX() > this.e.getWidth() + this.e.getLeft() + 10 || motionEvent.getY() < BitmapDescriptorFactory.HUE_RED || motionEvent.getY() > this.e.getHeight() + this.e.getTop() + 10) { this.e.setAlpha(1.0f); } else if (motionEvent.getAction() == 1) { this.e.performClick(); } return true; } /* JADX INFO: Access modifiers changed from: private */ public /* synthetic */ void y() { if (getActivity() != null) { b(true); this.e.setEnabled(true); this.c.setEnabled(true); a(); } } /* JADX INFO: Access modifiers changed from: private */ /* renamed from: v, reason: merged with bridge method [inline-methods] */ public void x() { this.y = true; this.e.setEnabled(false); b(false); this.c.c(false, true); this.g = ObjectAnimator.ofFloat((Object) null, "alpha", 1.0f, BitmapDescriptorFactory.HUE_RED).setDuration(1000L); n(); } /* JADX INFO: Access modifiers changed from: protected */ public final void c(final Runnable runnable, int i) { AnimatorSet animatorSet = new AnimatorSet(); this.u = animatorSet; animatorSet.playTogether(ObjectAnimator.ofFloat(this.d, (Property) View.ALPHA, 1.0f, BitmapDescriptorFactory.HUE_RED)); this.u.setDuration(i); this.u.addListener(new e(runnable) { // from class: com.facetec.sdk.bb$$ExternalSyntheticLambda10 public final Runnable f$0; @Override // android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { this.f$0.run(); } { this.f$0 = runnable; } }); this.u.start(); } /* JADX INFO: Access modifiers changed from: protected */ public void n() { e(); } /* JADX INFO: Access modifiers changed from: protected */ public final void m() { this.y = false; } }