package o; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.TimeInterpolator; import android.animation.ValueAnimator; import android.graphics.drawable.Drawable; import android.view.MotionEvent; import android.view.View; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.widget.AutoCompleteTextView; import android.widget.EditText; import android.widget.Spinner; import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.material.textfield.EndCompoundLayout; import o.C17052tZT; import o.QAo; /* loaded from: classes2.dex */ public final class pAW extends SQv { private static final boolean l = true; long a; ValueAnimator b; boolean c; AutoCompleteTextView d; boolean e; ValueAnimator f; boolean h; private final int m; private final TimeInterpolator n; /* renamed from: o, reason: collision with root package name */ private AccessibilityManager f9236o; private final int p; private final QAo.LWm q; private final View.OnFocusChangeListener r; private final View.OnClickListener s; /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean b(int i) { return i != 0; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean k() { return true; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean n() { return true; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean o() { return true; } public pAW(EndCompoundLayout endCompoundLayout) { super(endCompoundLayout); this.s = new View.OnClickListener(this) { // from class: o.Roy private pAW e; @Override // android.view.View.OnClickListener public final void onClick(View view) { this.e.d(); } { this.e = this; } }; this.r = new View.OnFocusChangeListener(this) { // from class: o.AGH private pAW b; @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { pAW paw = this.b; paw.c = z; paw.i.a(false); if (z) { return; } if (paw.h) { paw.h = false; paw.b.cancel(); paw.f.start(); } paw.e = false; } { this.b = this; } }; this.q = new QAo.LWm(this) { // from class: o.CFd private pAW c; @Override // o.QAo.LWm public final void b(boolean z) { pAW paw = this.c; AutoCompleteTextView autoCompleteTextView = paw.d; if (autoCompleteTextView == null || autoCompleteTextView.getInputType() != 0) { return; } ViewCompat.g(paw.g, z ? 2 : 1); } { this.c = this; } }; this.a = Long.MAX_VALUE; this.m = DAZ.a(endCompoundLayout.getContext(), C17052tZT.IeS.motionDurationShort3, 67); this.p = DAZ.a(endCompoundLayout.getContext(), C17052tZT.IeS.motionDurationShort3, 50); this.n = DAZ.Kh_(endCompoundLayout.getContext(), C17052tZT.IeS.motionEasingLinearInterpolator, C6217cMa.e); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final void g() { this.b = Mb_(this.m, BitmapDescriptorFactory.HUE_RED, 1.0f); ValueAnimator Mb_ = Mb_(this.p, 1.0f, BitmapDescriptorFactory.HUE_RED); this.f = Mb_; Mb_.addListener(new AnimatorListenerAdapter(this) { // from class: o.pAW.5 private pAW c; { this.c = this; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator) { this.c.i.a(false); this.c.b.start(); } }); this.f9236o = (AccessibilityManager) this.j.getSystemService("accessibility"); } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final void f() { AutoCompleteTextView autoCompleteTextView = this.d; if (autoCompleteTextView != null) { autoCompleteTextView.setOnTouchListener(null); if (l) { this.d.setOnDismissListener(null); } } } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final int c() { return l ? C17052tZT.LWm.mtrl_dropdown_arrow : C17052tZT.LWm.mtrl_ic_arrow_drop_down; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final int a() { return C17052tZT.ojQ.exposed_dropdown_menu_content_description; } @Override // o.SQv public final void e() { try { if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.f9236o, null)).booleanValue() && this.d.getInputType() != 0 && !this.g.hasFocus()) { this.d.dismissDropDown(); } this.d.post(new Runnable(this) { // from class: o.NRP private pAW b; @Override // java.lang.Runnable public final void run() { pAW paw = this.b; boolean isPopupShowing = paw.d.isPopupShowing(); if (paw.h != isPopupShowing) { paw.h = isPopupShowing; paw.b.cancel(); paw.f.start(); } paw.e = isPopupShowing; } { this.b = this; } }); } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } @Override // o.SQv public final void Mn_(AccessibilityEvent accessibilityEvent) { try { if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isEnabled", null).invoke(this.f9236o, null)).booleanValue() && this.d.getInputType() == 0) { boolean z = accessibilityEvent.getEventType() == 32768 && this.h && !this.d.isPopupShowing(); if (accessibilityEvent.getEventType() == 1 || z) { d(); this.e = true; this.a = System.currentTimeMillis(); } } } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } private ValueAnimator Mb_(int i, float... fArr) { ValueAnimator ofFloat = ValueAnimator.ofFloat(fArr); ofFloat.setInterpolator(this.n); ofFloat.setDuration(i); ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this) { // from class: o.olJ private pAW e; @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { pAW paw = this.e; paw.g.setAlpha(((Float) valueAnimator.getAnimatedValue()).floatValue()); } { this.e = this; } }); return ofFloat; } /* JADX INFO: Access modifiers changed from: package-private */ public final void d() { if (this.d == null) { return; } long currentTimeMillis = System.currentTimeMillis() - this.a; if (currentTimeMillis < 0 || currentTimeMillis > 300) { this.e = false; } if (this.e) { this.e = false; return; } if (l) { boolean z = this.h; boolean z2 = !z; if (z != z2) { this.h = z2; this.b.cancel(); this.f.start(); } } else { this.h = !this.h; p(); } if (this.h) { this.d.requestFocus(); this.d.showDropDown(); } else { this.d.dismissDropDown(); } } @Override // o.SQv public final void Mz_(EditText editText) { if (!(editText instanceof AutoCompleteTextView)) { throw new RuntimeException("EditText needs to be an AutoCompleteTextView if an Exposed Dropdown Menu is being used."); } AutoCompleteTextView autoCompleteTextView = (AutoCompleteTextView) editText; this.d = autoCompleteTextView; autoCompleteTextView.setOnTouchListener(new View.OnTouchListener(this) { // from class: o.gWH private pAW b; @Override // android.view.View.OnTouchListener public final boolean onTouch(View view, MotionEvent motionEvent) { pAW paw = this.b; if (motionEvent.getAction() == 1) { long currentTimeMillis = System.currentTimeMillis() - paw.a; if (currentTimeMillis < 0 || currentTimeMillis > 300) { paw.e = false; } paw.d(); paw.e = true; paw.a = System.currentTimeMillis(); } return false; } { this.b = this; } }); if (l) { this.d.setOnDismissListener(new AutoCompleteTextView.OnDismissListener(this) { // from class: o.vfU private pAW a; @Override // android.widget.AutoCompleteTextView.OnDismissListener public final void onDismiss() { pAW paw = this.a; paw.e = true; paw.a = System.currentTimeMillis(); if (paw.h) { paw.h = false; paw.b.cancel(); paw.f.start(); } } { this.a = this; } }); } this.d.setThreshold(0); this.k.setErrorIconDrawable((Drawable) null); if (editText.getInputType() == 0) { try { if (((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.f9236o, null)).booleanValue()) { ViewCompat.g(this.g, 2); } } catch (Throwable th) { Throwable cause = th.getCause(); if (cause == null) { throw th; } throw cause; } } this.k.setEndIconVisible(true); } @Override // o.SQv public final void a(AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { if (this.d.getInputType() == 0) { accessibilityNodeInfoCompat.e((CharSequence) Spinner.class.getName()); } if (accessibilityNodeInfoCompat.x()) { accessibilityNodeInfoCompat.a((CharSequence) null); } } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean m() { return this.h; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final boolean l() { return this.c; } @Override // o.SQv public final QAo.LWm h() { return this.q; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final View.OnClickListener My_() { return this.s; } /* JADX INFO: Access modifiers changed from: package-private */ @Override // o.SQv public final View.OnFocusChangeListener Mj_() { return this.r; } }