package com.google.android.material.textfield; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Canvas; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.Typeface; import android.graphics.drawable.ColorDrawable; import android.graphics.drawable.Drawable; import android.graphics.drawable.DrawableContainer; import android.graphics.drawable.GradientDrawable; import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; import android.text.method.PasswordTransformationMethod; import android.util.AttributeSet; import android.util.Log; import android.util.SparseArray; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.ViewStructure; import android.view.accessibility.AccessibilityEvent; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatDrawableManager; import androidx.appcompat.widget.AppCompatTextView; import androidx.appcompat.widget.TintTypedArray; import androidx.core.content.ContextCompat; import androidx.core.graphics.drawable.DrawableCompat; import androidx.core.view.AccessibilityDelegateCompat; import androidx.core.view.ViewCompat; import androidx.core.view.accessibility.AccessibilityNodeInfoCompat; import androidx.core.widget.TextViewCompat; import androidx.customview.view.AbsSavedState; import com.google.android.material.R$attr; import com.google.android.material.R$color; import com.google.android.material.R$dimen; import com.google.android.material.R$id; import com.google.android.material.R$layout; import com.google.android.material.R$string; import com.google.android.material.R$style; import com.google.android.material.R$styleable; import com.google.android.material.animation.AnimationUtils; import com.google.android.material.internal.CheckableImageButton; import com.google.android.material.internal.CollapsingTextHelper; import com.google.android.material.internal.DescendantOffsetUtils; import com.google.android.material.internal.DrawableUtils; import com.google.android.material.internal.ThemeEnforcement; import com.google.android.material.internal.ViewUtils; /* loaded from: classes.dex */ public class TextInputLayout extends LinearLayout { private int A; private int B; private Drawable C; private final Rect D; private final RectF E; private Typeface F; private boolean G; private Drawable H; private CharSequence I; private CheckableImageButton J; private boolean K; private Drawable L; private Drawable M; private ColorStateList N; private boolean O; private PorterDuff.Mode P; private boolean Q; private ColorStateList R; private ColorStateList S; private final int T; private final int U; private int V; private final int W; private final FrameLayout a; private boolean a0; EditText b; final CollapsingTextHelper b0; private CharSequence c; private boolean c0; private final IndicatorViewController d; private ValueAnimator d0; boolean e; private boolean e0; private int f; private boolean f0; private boolean g; private boolean g0; private TextView h; private final int i; private final int j; private boolean k; private CharSequence l; private boolean m; private GradientDrawable n; private final int o; private final int p; private int q; private final int r; private float s; private float t; private float u; private float v; private int x; private final int y; private final int z; public static class AccessibilityDelegate extends AccessibilityDelegateCompat { private final TextInputLayout c; public AccessibilityDelegate(TextInputLayout textInputLayout) { this.c = textInputLayout; } @Override // androidx.core.view.AccessibilityDelegateCompat public void a(View view, AccessibilityNodeInfoCompat accessibilityNodeInfoCompat) { super.a(view, accessibilityNodeInfoCompat); EditText editText = this.c.getEditText(); Editable text = editText != null ? editText.getText() : null; CharSequence hint = this.c.getHint(); CharSequence error = this.c.getError(); CharSequence counterOverflowDescription = this.c.getCounterOverflowDescription(); boolean z = !TextUtils.isEmpty(text); boolean z2 = !TextUtils.isEmpty(hint); boolean z3 = !TextUtils.isEmpty(error); boolean z4 = false; boolean z5 = z3 || !TextUtils.isEmpty(counterOverflowDescription); if (z) { accessibilityNodeInfoCompat.d(text); } else if (z2) { accessibilityNodeInfoCompat.d(hint); } if (z2) { accessibilityNodeInfoCompat.c(hint); if (!z && z2) { z4 = true; } accessibilityNodeInfoCompat.e(z4); } if (z5) { if (!z3) { error = counterOverflowDescription; } accessibilityNodeInfoCompat.b(error); accessibilityNodeInfoCompat.c(true); } } @Override // androidx.core.view.AccessibilityDelegateCompat public void c(View view, AccessibilityEvent accessibilityEvent) { super.c(view, accessibilityEvent); EditText editText = this.c.getEditText(); CharSequence text = editText != null ? editText.getText() : null; if (TextUtils.isEmpty(text)) { text = this.c.getHint(); } if (TextUtils.isEmpty(text)) { return; } accessibilityEvent.getText().add(text); } } static class SavedState extends AbsSavedState { public static final Parcelable.Creator CREATOR = new Parcelable.ClassLoaderCreator() { // from class: com.google.android.material.textfield.TextInputLayout.SavedState.1 @Override // android.os.Parcelable.Creator public SavedState[] newArray(int i) { return new SavedState[i]; } /* JADX WARN: Can't rename method to resolve collision */ @Override // android.os.Parcelable.ClassLoaderCreator public SavedState createFromParcel(Parcel parcel, ClassLoader classLoader) { return new SavedState(parcel, classLoader); } @Override // android.os.Parcelable.Creator public SavedState createFromParcel(Parcel parcel) { return new SavedState(parcel, null); } }; CharSequence error; boolean isPasswordToggledVisible; SavedState(Parcelable parcelable) { super(parcelable); } public String toString() { return "TextInputLayout.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " error=" + ((Object) this.error) + "}"; } @Override // androidx.customview.view.AbsSavedState, android.os.Parcelable public void writeToParcel(Parcel parcel, int i) { super.writeToParcel(parcel, i); TextUtils.writeToParcel(this.error, parcel, i); parcel.writeInt(this.isPasswordToggledVisible ? 1 : 0); } SavedState(Parcel parcel, ClassLoader classLoader) { super(parcel, classLoader); this.error = (CharSequence) TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(parcel); this.isPasswordToggledVisible = parcel.readInt() == 1; } } public TextInputLayout(Context context) { this(context, null); } private void e() { int i; Drawable drawable; if (this.n == null) { return; } q(); EditText editText = this.b; if (editText != null && this.q == 2) { if (editText.getBackground() != null) { this.C = this.b.getBackground(); } ViewCompat.a(this.b, (Drawable) null); } EditText editText2 = this.b; if (editText2 != null && this.q == 1 && (drawable = this.C) != null) { ViewCompat.a(editText2, drawable); } int i2 = this.x; if (i2 > -1 && (i = this.A) != 0) { this.n.setStroke(i2, i); } this.n.setCornerRadii(getCornerRadiiAsArray()); this.n.setColor(this.B); invalidate(); } private void f() { if (this.H != null) { if (this.O || this.Q) { this.H = DrawableCompat.h(this.H).mutate(); if (this.O) { DrawableCompat.a(this.H, this.N); } if (this.Q) { DrawableCompat.a(this.H, this.P); } CheckableImageButton checkableImageButton = this.J; if (checkableImageButton != null) { Drawable drawable = checkableImageButton.getDrawable(); Drawable drawable2 = this.H; if (drawable != drawable2) { this.J.setImageDrawable(drawable2); } } } } } private void g() { int i = this.q; if (i == 0) { this.n = null; return; } if (i == 2 && this.k && !(this.n instanceof CutoutDrawable)) { this.n = new CutoutDrawable(); } else { if (this.n instanceof GradientDrawable) { return; } this.n = new GradientDrawable(); } } private Drawable getBoxBackground() { int i = this.q; if (i == 1 || i == 2) { return this.n; } throw new IllegalStateException(); } private float[] getCornerRadiiAsArray() { if (ViewUtils.a(this)) { float f = this.t; float f2 = this.s; float f3 = this.v; float f4 = this.u; return new float[]{f, f, f2, f2, f3, f3, f4, f4}; } float f5 = this.s; float f6 = this.t; float f7 = this.u; float f8 = this.v; return new float[]{f5, f5, f6, f6, f7, f7, f8, f8}; } private int h() { EditText editText = this.b; if (editText == null) { return 0; } int i = this.q; if (i == 1) { return editText.getTop(); } if (i != 2) { return 0; } return editText.getTop() + j(); } private int i() { int i = this.q; return i != 1 ? i != 2 ? getPaddingTop() : getBoxBackground().getBounds().top - j() : getBoxBackground().getBounds().top + this.r; } private int j() { float d; if (!this.k) { return 0; } int i = this.q; if (i == 0 || i == 1) { d = this.b0.d(); } else { if (i != 2) { return 0; } d = this.b0.d() / 2.0f; } return (int) d; } private void k() { if (l()) { ((CutoutDrawable) this.n).b(); } } private boolean l() { return this.k && !TextUtils.isEmpty(this.l) && (this.n instanceof CutoutDrawable); } private void m() { Drawable background; int i = Build.VERSION.SDK_INT; if ((i != 21 && i != 22) || (background = this.b.getBackground()) == null || this.e0) { return; } Drawable newDrawable = background.getConstantState().newDrawable(); if (background instanceof DrawableContainer) { this.e0 = DrawableUtils.a((DrawableContainer) background, newDrawable.getConstantState()); } if (this.e0) { return; } ViewCompat.a(this.b, newDrawable); this.e0 = true; o(); } private boolean n() { EditText editText = this.b; return editText != null && (editText.getTransformationMethod() instanceof PasswordTransformationMethod); } private void o() { g(); if (this.q != 0) { t(); } v(); } private void p() { if (l()) { RectF rectF = this.E; this.b0.a(rectF); a(rectF); ((CutoutDrawable) this.n).a(rectF); } } private void q() { int i = this.q; if (i == 1) { this.x = 0; } else if (i == 2 && this.V == 0) { this.V = this.S.getColorForState(getDrawableState(), this.S.getDefaultColor()); } } private boolean r() { return this.G && (n() || this.K); } private void s() { Drawable background; EditText editText = this.b; if (editText == null || (background = editText.getBackground()) == null) { return; } if (androidx.appcompat.widget.DrawableUtils.a(background)) { background = background.mutate(); } DescendantOffsetUtils.a(this, this.b, new Rect()); Rect bounds = background.getBounds(); if (bounds.left != bounds.right) { Rect rect = new Rect(); background.getPadding(rect); background.setBounds(bounds.left - rect.left, bounds.top, bounds.right + (rect.right * 2), this.b.getBottom()); } } private void setEditText(EditText editText) { if (this.b != null) { throw new IllegalArgumentException("We already have an EditText, can only have one"); } if (!(editText instanceof TextInputEditText)) { Log.i("TextInputLayout", "EditText added is not a TextInputEditText. Please switch to using that class instead."); } this.b = editText; o(); setTextInputAccessibilityDelegate(new AccessibilityDelegate(this)); if (!n()) { this.b0.c(this.b.getTypeface()); } this.b0.a(this.b.getTextSize()); int gravity = this.b.getGravity(); this.b0.b((gravity & (-113)) | 48); this.b0.d(gravity); this.b.addTextChangedListener(new TextWatcher() { // from class: com.google.android.material.textfield.TextInputLayout.1 @Override // android.text.TextWatcher public void afterTextChanged(Editable editable) { TextInputLayout.this.b(!r0.g0); TextInputLayout textInputLayout = TextInputLayout.this; if (textInputLayout.e) { textInputLayout.a(editable.length()); } } @Override // android.text.TextWatcher public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { } @Override // android.text.TextWatcher public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { } }); if (this.R == null) { this.R = this.b.getHintTextColors(); } if (this.k) { if (TextUtils.isEmpty(this.l)) { this.c = this.b.getHint(); setHint(this.c); this.b.setHint((CharSequence) null); } this.m = true; } if (this.h != null) { a(this.b.getText().length()); } this.d.a(); u(); a(false, true); } private void setHintInternal(CharSequence charSequence) { if (TextUtils.equals(charSequence, this.l)) { return; } this.l = charSequence; this.b0.a(charSequence); if (this.a0) { return; } p(); } private void t() { LinearLayout.LayoutParams layoutParams = (LinearLayout.LayoutParams) this.a.getLayoutParams(); int j = j(); if (j != layoutParams.topMargin) { layoutParams.topMargin = j; this.a.requestLayout(); } } private void u() { if (this.b == null) { return; } if (!r()) { CheckableImageButton checkableImageButton = this.J; if (checkableImageButton != null && checkableImageButton.getVisibility() == 0) { this.J.setVisibility(8); } if (this.L != null) { Drawable[] a = TextViewCompat.a(this.b); if (a[2] == this.L) { TextViewCompat.a(this.b, a[0], a[1], this.M, a[3]); this.L = null; return; } return; } return; } if (this.J == null) { this.J = (CheckableImageButton) LayoutInflater.from(getContext()).inflate(R$layout.design_text_input_password_icon, (ViewGroup) this.a, false); this.J.setImageDrawable(this.H); this.J.setContentDescription(this.I); this.a.addView(this.J); this.J.setOnClickListener(new View.OnClickListener() { // from class: com.google.android.material.textfield.TextInputLayout.2 @Override // android.view.View.OnClickListener public void onClick(View view) { TextInputLayout.this.a(false); } }); } EditText editText = this.b; if (editText != null && ViewCompat.l(editText) <= 0) { this.b.setMinimumHeight(ViewCompat.l(this.J)); } this.J.setVisibility(0); this.J.setChecked(this.K); if (this.L == null) { this.L = new ColorDrawable(); } this.L.setBounds(0, 0, this.J.getMeasuredWidth(), 1); Drawable[] a2 = TextViewCompat.a(this.b); if (a2[2] != this.L) { this.M = a2[2]; } TextViewCompat.a(this.b, a2[0], a2[1], this.L, a2[3]); this.J.setPadding(this.b.getPaddingLeft(), this.b.getPaddingTop(), this.b.getPaddingRight(), this.b.getPaddingBottom()); } private void v() { if (this.q == 0 || this.n == null || this.b == null || getRight() == 0) { return; } int left = this.b.getLeft(); int h = h(); int right = this.b.getRight(); int bottom = this.b.getBottom() + this.o; if (this.q == 2) { int i = this.z; left += i / 2; h -= i / 2; right -= i / 2; bottom += i / 2; } this.n.setBounds(left, h, right, bottom); e(); s(); } @Override // android.view.ViewGroup public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { if (!(view instanceof EditText)) { super.addView(view, i, layoutParams); return; } FrameLayout.LayoutParams layoutParams2 = new FrameLayout.LayoutParams(layoutParams); layoutParams2.gravity = (layoutParams2.gravity & (-113)) | 16; this.a.addView(view, layoutParams2); this.a.setLayoutParams(layoutParams); t(); setEditText((EditText) view); } void b(boolean z) { a(z, false); } void c() { Drawable background; TextView textView; EditText editText = this.b; if (editText == null || (background = editText.getBackground()) == null) { return; } m(); if (androidx.appcompat.widget.DrawableUtils.a(background)) { background = background.mutate(); } if (this.d.c()) { background.setColorFilter(AppCompatDrawableManager.a(this.d.e(), PorterDuff.Mode.SRC_IN)); } else if (this.g && (textView = this.h) != null) { background.setColorFilter(AppCompatDrawableManager.a(textView.getCurrentTextColor(), PorterDuff.Mode.SRC_IN)); } else { DrawableCompat.b(background); this.b.refreshDrawableState(); } } void d() { TextView textView; if (this.n == null || this.q == 0) { return; } EditText editText = this.b; boolean z = editText != null && editText.hasFocus(); EditText editText2 = this.b; boolean z2 = editText2 != null && editText2.isHovered(); if (this.q == 2) { if (!isEnabled()) { this.A = this.W; } else if (this.d.c()) { this.A = this.d.e(); } else if (this.g && (textView = this.h) != null) { this.A = textView.getCurrentTextColor(); } else if (z) { this.A = this.V; } else if (z2) { this.A = this.U; } else { this.A = this.T; } if ((z2 || z) && isEnabled()) { this.x = this.z; } else { this.x = this.y; } e(); } } @Override // android.view.ViewGroup, android.view.View public void dispatchProvideAutofillStructure(ViewStructure viewStructure, int i) { EditText editText; if (this.c == null || (editText = this.b) == null) { super.dispatchProvideAutofillStructure(viewStructure, i); return; } boolean z = this.m; this.m = false; CharSequence hint = editText.getHint(); this.b.setHint(this.c); try { super.dispatchProvideAutofillStructure(viewStructure, i); } finally { this.b.setHint(hint); this.m = z; } } @Override // android.view.ViewGroup, android.view.View protected void dispatchRestoreInstanceState(SparseArray sparseArray) { this.g0 = true; super.dispatchRestoreInstanceState(sparseArray); this.g0 = false; } @Override // android.view.View public void draw(Canvas canvas) { GradientDrawable gradientDrawable = this.n; if (gradientDrawable != null) { gradientDrawable.draw(canvas); } super.draw(canvas); if (this.k) { this.b0.a(canvas); } } @Override // android.view.ViewGroup, android.view.View protected void drawableStateChanged() { if (this.f0) { return; } this.f0 = true; super.drawableStateChanged(); int[] drawableState = getDrawableState(); b(ViewCompat.x(this) && isEnabled()); c(); v(); d(); CollapsingTextHelper collapsingTextHelper = this.b0; if (collapsingTextHelper != null ? collapsingTextHelper.a(drawableState) | false : false) { invalidate(); } this.f0 = false; } public int getBoxBackgroundColor() { return this.B; } public float getBoxCornerRadiusBottomEnd() { return this.u; } public float getBoxCornerRadiusBottomStart() { return this.v; } public float getBoxCornerRadiusTopEnd() { return this.t; } public float getBoxCornerRadiusTopStart() { return this.s; } public int getBoxStrokeColor() { return this.V; } public int getCounterMaxLength() { return this.f; } CharSequence getCounterOverflowDescription() { TextView textView; if (this.e && this.g && (textView = this.h) != null) { return textView.getContentDescription(); } return null; } public ColorStateList getDefaultHintTextColor() { return this.R; } public EditText getEditText() { return this.b; } public CharSequence getError() { if (this.d.k()) { return this.d.d(); } return null; } public int getErrorCurrentTextColors() { return this.d.e(); } final int getErrorTextCurrentColor() { return this.d.e(); } public CharSequence getHelperText() { if (this.d.l()) { return this.d.g(); } return null; } public int getHelperTextCurrentTextColor() { return this.d.h(); } public CharSequence getHint() { if (this.k) { return this.l; } return null; } final float getHintCollapsedTextHeight() { return this.b0.d(); } final int getHintCurrentCollapsedTextColor() { return this.b0.f(); } public CharSequence getPasswordVisibilityToggleContentDescription() { return this.I; } public Drawable getPasswordVisibilityToggleDrawable() { return this.H; } public Typeface getTypeface() { return this.F; } @Override // android.widget.LinearLayout, android.view.ViewGroup, android.view.View protected void onLayout(boolean z, int i, int i2, int i3, int i4) { EditText editText; super.onLayout(z, i, i2, i3, i4); if (this.n != null) { v(); } if (!this.k || (editText = this.b) == null) { return; } Rect rect = this.D; DescendantOffsetUtils.a(this, editText, rect); int compoundPaddingLeft = rect.left + this.b.getCompoundPaddingLeft(); int compoundPaddingRight = rect.right - this.b.getCompoundPaddingRight(); int i5 = i(); this.b0.b(compoundPaddingLeft, rect.top + this.b.getCompoundPaddingTop(), compoundPaddingRight, rect.bottom - this.b.getCompoundPaddingBottom()); this.b0.a(compoundPaddingLeft, i5, compoundPaddingRight, (i4 - i2) - getPaddingBottom()); this.b0.m(); if (!l() || this.a0) { return; } p(); } @Override // android.widget.LinearLayout, android.view.View protected void onMeasure(int i, int i2) { u(); super.onMeasure(i, i2); } @Override // android.view.View protected void onRestoreInstanceState(Parcelable parcelable) { if (!(parcelable instanceof SavedState)) { super.onRestoreInstanceState(parcelable); return; } SavedState savedState = (SavedState) parcelable; super.onRestoreInstanceState(savedState.getSuperState()); setError(savedState.error); if (savedState.isPasswordToggledVisible) { a(true); } requestLayout(); } @Override // android.view.View public Parcelable onSaveInstanceState() { SavedState savedState = new SavedState(super.onSaveInstanceState()); if (this.d.c()) { savedState.error = getError(); } savedState.isPasswordToggledVisible = this.K; return savedState; } public void setBoxBackgroundColor(int i) { if (this.B != i) { this.B = i; e(); } } public void setBoxBackgroundColorResource(int i) { setBoxBackgroundColor(ContextCompat.a(getContext(), i)); } public void setBoxBackgroundMode(int i) { if (i == this.q) { return; } this.q = i; o(); } public void setBoxStrokeColor(int i) { if (this.V != i) { this.V = i; d(); } } public void setCounterEnabled(boolean z) { if (this.e != z) { if (z) { this.h = new AppCompatTextView(getContext()); this.h.setId(R$id.textinput_counter); Typeface typeface = this.F; if (typeface != null) { this.h.setTypeface(typeface); } this.h.setMaxLines(1); a(this.h, this.j); this.d.a(this.h, 2); EditText editText = this.b; if (editText == null) { a(0); } else { a(editText.getText().length()); } } else { this.d.b(this.h, 2); this.h = null; } this.e = z; } } public void setCounterMaxLength(int i) { if (this.f != i) { if (i > 0) { this.f = i; } else { this.f = -1; } if (this.e) { EditText editText = this.b; a(editText == null ? 0 : editText.getText().length()); } } } public void setDefaultHintTextColor(ColorStateList colorStateList) { this.R = colorStateList; this.S = colorStateList; if (this.b != null) { b(false); } } @Override // android.view.View public void setEnabled(boolean z) { a(this, z); super.setEnabled(z); } public void setError(CharSequence charSequence) { if (!this.d.k()) { if (TextUtils.isEmpty(charSequence)) { return; } else { setErrorEnabled(true); } } if (TextUtils.isEmpty(charSequence)) { this.d.i(); } else { this.d.a(charSequence); } } public void setErrorEnabled(boolean z) { this.d.a(z); } public void setErrorTextAppearance(int i) { this.d.b(i); } public void setErrorTextColor(ColorStateList colorStateList) { this.d.a(colorStateList); } public void setHelperText(CharSequence charSequence) { if (TextUtils.isEmpty(charSequence)) { if (a()) { setHelperTextEnabled(false); } } else { if (!a()) { setHelperTextEnabled(true); } this.d.b(charSequence); } } public void setHelperTextColor(ColorStateList colorStateList) { this.d.b(colorStateList); } public void setHelperTextEnabled(boolean z) { this.d.b(z); } public void setHelperTextTextAppearance(int i) { this.d.c(i); } public void setHint(CharSequence charSequence) { if (this.k) { setHintInternal(charSequence); sendAccessibilityEvent(2048); } } public void setHintAnimationEnabled(boolean z) { this.c0 = z; } public void setHintEnabled(boolean z) { if (z != this.k) { this.k = z; if (this.k) { CharSequence hint = this.b.getHint(); if (!TextUtils.isEmpty(hint)) { if (TextUtils.isEmpty(this.l)) { setHint(hint); } this.b.setHint((CharSequence) null); } this.m = true; } else { this.m = false; if (!TextUtils.isEmpty(this.l) && TextUtils.isEmpty(this.b.getHint())) { this.b.setHint(this.l); } setHintInternal(null); } if (this.b != null) { t(); } } } public void setHintTextAppearance(int i) { this.b0.a(i); this.S = this.b0.b(); if (this.b != null) { b(false); t(); } } public void setPasswordVisibilityToggleContentDescription(int i) { setPasswordVisibilityToggleContentDescription(i != 0 ? getResources().getText(i) : null); } public void setPasswordVisibilityToggleDrawable(int i) { setPasswordVisibilityToggleDrawable(i != 0 ? AppCompatResources.c(getContext(), i) : null); } public void setPasswordVisibilityToggleEnabled(boolean z) { EditText editText; if (this.G != z) { this.G = z; if (!z && this.K && (editText = this.b) != null) { editText.setTransformationMethod(PasswordTransformationMethod.getInstance()); } this.K = false; u(); } } public void setPasswordVisibilityToggleTintList(ColorStateList colorStateList) { this.N = colorStateList; this.O = true; f(); } public void setPasswordVisibilityToggleTintMode(PorterDuff.Mode mode) { this.P = mode; this.Q = true; f(); } public void setTextInputAccessibilityDelegate(AccessibilityDelegate accessibilityDelegate) { EditText editText = this.b; if (editText != null) { ViewCompat.a(editText, accessibilityDelegate); } } public void setTypeface(Typeface typeface) { if (typeface != this.F) { this.F = typeface; this.b0.c(typeface); this.d.a(typeface); TextView textView = this.h; if (textView != null) { textView.setTypeface(typeface); } } } public TextInputLayout(Context context, AttributeSet attributeSet) { this(context, attributeSet, R$attr.textInputStyle); } private void a(boolean z, boolean z2) { ColorStateList colorStateList; TextView textView; boolean isEnabled = isEnabled(); EditText editText = this.b; boolean z3 = (editText == null || TextUtils.isEmpty(editText.getText())) ? false : true; EditText editText2 = this.b; boolean z4 = editText2 != null && editText2.hasFocus(); boolean c = this.d.c(); ColorStateList colorStateList2 = this.R; if (colorStateList2 != null) { this.b0.a(colorStateList2); this.b0.b(this.R); } if (!isEnabled) { this.b0.a(ColorStateList.valueOf(this.W)); this.b0.b(ColorStateList.valueOf(this.W)); } else if (c) { this.b0.a(this.d.f()); } else if (this.g && (textView = this.h) != null) { this.b0.a(textView.getTextColors()); } else if (z4 && (colorStateList = this.S) != null) { this.b0.a(colorStateList); } if (z3 || (isEnabled() && (z4 || c))) { if (z2 || this.a0) { c(z); return; } return; } if (z2 || !this.a0) { d(z); } } boolean b() { return this.m; } public TextInputLayout(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.d = new IndicatorViewController(this); this.D = new Rect(); this.E = new RectF(); this.b0 = new CollapsingTextHelper(this); setOrientation(1); setWillNotDraw(false); setAddStatesFromChildren(true); this.a = new FrameLayout(context); this.a.setAddStatesFromChildren(true); addView(this.a); this.b0.b(AnimationUtils.a); this.b0.a(AnimationUtils.a); this.b0.b(8388659); TintTypedArray d = ThemeEnforcement.d(context, attributeSet, R$styleable.TextInputLayout, i, R$style.Widget_Design_TextInputLayout, new int[0]); this.k = d.a(R$styleable.TextInputLayout_hintEnabled, true); setHint(d.e(R$styleable.TextInputLayout_android_hint)); this.c0 = d.a(R$styleable.TextInputLayout_hintAnimationEnabled, true); this.o = context.getResources().getDimensionPixelOffset(R$dimen.mtrl_textinput_box_bottom_offset); this.p = context.getResources().getDimensionPixelOffset(R$dimen.mtrl_textinput_box_label_cutout_padding); this.r = d.b(R$styleable.TextInputLayout_boxCollapsedPaddingTop, 0); this.s = d.a(R$styleable.TextInputLayout_boxCornerRadiusTopStart, 0.0f); this.t = d.a(R$styleable.TextInputLayout_boxCornerRadiusTopEnd, 0.0f); this.u = d.a(R$styleable.TextInputLayout_boxCornerRadiusBottomEnd, 0.0f); this.v = d.a(R$styleable.TextInputLayout_boxCornerRadiusBottomStart, 0.0f); this.B = d.a(R$styleable.TextInputLayout_boxBackgroundColor, 0); this.V = d.a(R$styleable.TextInputLayout_boxStrokeColor, 0); this.y = context.getResources().getDimensionPixelSize(R$dimen.mtrl_textinput_box_stroke_width_default); this.z = context.getResources().getDimensionPixelSize(R$dimen.mtrl_textinput_box_stroke_width_focused); this.x = this.y; setBoxBackgroundMode(d.d(R$styleable.TextInputLayout_boxBackgroundMode, 0)); if (d.g(R$styleable.TextInputLayout_android_textColorHint)) { ColorStateList a = d.a(R$styleable.TextInputLayout_android_textColorHint); this.S = a; this.R = a; } this.T = ContextCompat.a(context, R$color.mtrl_textinput_default_box_stroke_color); this.W = ContextCompat.a(context, R$color.mtrl_textinput_disabled_color); this.U = ContextCompat.a(context, R$color.mtrl_textinput_hovered_box_stroke_color); if (d.g(R$styleable.TextInputLayout_hintTextAppearance, -1) != -1) { setHintTextAppearance(d.g(R$styleable.TextInputLayout_hintTextAppearance, 0)); } int g = d.g(R$styleable.TextInputLayout_errorTextAppearance, 0); boolean a2 = d.a(R$styleable.TextInputLayout_errorEnabled, false); int g2 = d.g(R$styleable.TextInputLayout_helperTextTextAppearance, 0); boolean a3 = d.a(R$styleable.TextInputLayout_helperTextEnabled, false); CharSequence e = d.e(R$styleable.TextInputLayout_helperText); boolean a4 = d.a(R$styleable.TextInputLayout_counterEnabled, false); setCounterMaxLength(d.d(R$styleable.TextInputLayout_counterMaxLength, -1)); this.j = d.g(R$styleable.TextInputLayout_counterTextAppearance, 0); this.i = d.g(R$styleable.TextInputLayout_counterOverflowTextAppearance, 0); this.G = d.a(R$styleable.TextInputLayout_passwordToggleEnabled, false); this.H = d.b(R$styleable.TextInputLayout_passwordToggleDrawable); this.I = d.e(R$styleable.TextInputLayout_passwordToggleContentDescription); if (d.g(R$styleable.TextInputLayout_passwordToggleTint)) { this.O = true; this.N = d.a(R$styleable.TextInputLayout_passwordToggleTint); } if (d.g(R$styleable.TextInputLayout_passwordToggleTintMode)) { this.Q = true; this.P = ViewUtils.a(d.d(R$styleable.TextInputLayout_passwordToggleTintMode, -1), null); } d.a(); setHelperTextEnabled(a3); setHelperText(e); setHelperTextTextAppearance(g2); setErrorEnabled(a2); setErrorTextAppearance(g); setCounterEnabled(a4); f(); ViewCompat.f((View) this, 2); } public void setPasswordVisibilityToggleContentDescription(CharSequence charSequence) { this.I = charSequence; CheckableImageButton checkableImageButton = this.J; if (checkableImageButton != null) { checkableImageButton.setContentDescription(charSequence); } } public void setPasswordVisibilityToggleDrawable(Drawable drawable) { this.H = drawable; CheckableImageButton checkableImageButton = this.J; if (checkableImageButton != null) { checkableImageButton.setImageDrawable(drawable); } } private void c(boolean z) { ValueAnimator valueAnimator = this.d0; if (valueAnimator != null && valueAnimator.isRunning()) { this.d0.cancel(); } if (z && this.c0) { a(1.0f); } else { this.b0.b(1.0f); } this.a0 = false; if (l()) { p(); } } private void d(boolean z) { ValueAnimator valueAnimator = this.d0; if (valueAnimator != null && valueAnimator.isRunning()) { this.d0.cancel(); } if (z && this.c0) { a(0.0f); } else { this.b0.b(0.0f); } if (l() && ((CutoutDrawable) this.n).a()) { k(); } this.a0 = true; } public boolean a() { return this.d.l(); } private static void a(ViewGroup viewGroup, boolean z) { int childCount = viewGroup.getChildCount(); for (int i = 0; i < childCount; i++) { View childAt = viewGroup.getChildAt(i); childAt.setEnabled(z); if (childAt instanceof ViewGroup) { a((ViewGroup) childAt, z); } } } void a(int i) { boolean z = this.g; if (this.f == -1) { this.h.setText(String.valueOf(i)); this.h.setContentDescription(null); this.g = false; } else { if (ViewCompat.b(this.h) == 1) { ViewCompat.e((View) this.h, 0); } this.g = i > this.f; boolean z2 = this.g; if (z != z2) { a(this.h, z2 ? this.i : this.j); if (this.g) { ViewCompat.e((View) this.h, 1); } } this.h.setText(getContext().getString(R$string.character_counter_pattern, Integer.valueOf(i), Integer.valueOf(this.f))); this.h.setContentDescription(getContext().getString(R$string.character_counter_content_description, Integer.valueOf(i), Integer.valueOf(this.f))); } if (this.b == null || z == this.g) { return; } b(false); d(); c(); } /* JADX WARN: Code restructure failed: missing block: B:7:0x0015, code lost: if (r3.getTextColors().getDefaultColor() == (-65281)) goto L11; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct code enable 'Show inconsistent code' option in preferences */ void a(android.widget.TextView r3, int r4) { /* r2 = this; r0 = 1 androidx.core.widget.TextViewCompat.d(r3, r4) // Catch: java.lang.Exception -> L1b int r4 = android.os.Build.VERSION.SDK_INT // Catch: java.lang.Exception -> L1b r1 = 23 if (r4 < r1) goto L18 android.content.res.ColorStateList r4 = r3.getTextColors() // Catch: java.lang.Exception -> L1b int r4 = r4.getDefaultColor() // Catch: java.lang.Exception -> L1b r1 = -65281(0xffffffffffff00ff, float:NaN) if (r4 != r1) goto L18 goto L1c L18: r4 = 0 r0 = 0 goto L1c L1b: L1c: if (r0 == 0) goto L30 int r4 = com.google.android.material.R$style.TextAppearance_AppCompat_Caption androidx.core.widget.TextViewCompat.d(r3, r4) android.content.Context r4 = r2.getContext() int r0 = com.google.android.material.R$color.design_error int r4 = androidx.core.content.ContextCompat.a(r4, r0) r3.setTextColor(r4) L30: return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.textfield.TextInputLayout.a(android.widget.TextView, int):void"); } public void a(boolean z) { if (this.G) { int selectionEnd = this.b.getSelectionEnd(); if (n()) { this.b.setTransformationMethod(null); this.K = true; } else { this.b.setTransformationMethod(PasswordTransformationMethod.getInstance()); this.K = false; } this.J.setChecked(this.K); if (z) { this.J.jumpDrawablesToCurrentState(); } this.b.setSelection(selectionEnd); } } private void a(RectF rectF) { float f = rectF.left; int i = this.p; rectF.left = f - i; rectF.top -= i; rectF.right += i; rectF.bottom += i; } void a(float f) { if (this.b0.i() == f) { return; } if (this.d0 == null) { this.d0 = new ValueAnimator(); this.d0.setInterpolator(AnimationUtils.b); this.d0.setDuration(167L); this.d0.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { // from class: com.google.android.material.textfield.TextInputLayout.3 @Override // android.animation.ValueAnimator.AnimatorUpdateListener public void onAnimationUpdate(ValueAnimator valueAnimator) { TextInputLayout.this.b0.b(((Float) valueAnimator.getAnimatedValue()).floatValue()); } }); } this.d0.setFloatValues(this.b0.i(), f); this.d0.start(); } }