package com.google.android.material.textfield; import android.content.res.ColorStateList; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.text.TextUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.EditText; import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; import androidx.appcompat.widget.AppCompatTextView; import androidx.core.view.ViewCompat; import com.google.android.material.internal.CheckableImageButton; import o.C0683McA; import o.C14739fyr; import o.C15977kAW; import o.C17052tZT; import o.CYM; import o.Lot; import o.URz; /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes2.dex */ public class StartCompoundLayout extends LinearLayout { final TextView a; CharSequence b; boolean c; ImageView.ScaleType d; View.OnLongClickListener e; final CheckableImageButton f; final TextInputLayout g; private int h; ColorStateList i; PorterDuff.Mode j; /* JADX INFO: Access modifiers changed from: package-private */ public StartCompoundLayout(TextInputLayout textInputLayout, C0683McA c0683McA) { super(textInputLayout.getContext()); this.g = textInputLayout; setVisibility(8); setOrientation(0); setLayoutParams(new FrameLayout.LayoutParams(-2, -1, 8388611)); CheckableImageButton checkableImageButton = (CheckableImageButton) LayoutInflater.from(getContext()).inflate(C17052tZT.tOB.design_text_input_start_icon, (ViewGroup) this, false); this.f = checkableImageButton; AppCompatTextView appCompatTextView = new AppCompatTextView(getContext()); this.a = appCompatTextView; if (getContext().getResources().getConfiguration().fontScale >= 1.3f) { CYM.rz_((ViewGroup.MarginLayoutParams) checkableImageButton.getLayoutParams(), 0); } View.OnLongClickListener onLongClickListener = this.e; checkableImageButton.setOnClickListener(null); C15977kAW.Mr_(checkableImageButton, onLongClickListener); this.e = null; checkableImageButton.setOnLongClickListener(null); C15977kAW.Mr_(checkableImageButton, null); if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_startIconTint)) { this.i = C14739fyr.Kv_(getContext(), c0683McA, C17052tZT.jNh.TextInputLayout_startIconTint); } if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_startIconTintMode)) { this.j = Lot.Kf_(c0683McA.d.getInt(C17052tZT.jNh.TextInputLayout_startIconTintMode, -1), null); } if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_startIconDrawable)) { MA_(c0683McA.jL_(C17052tZT.jNh.TextInputLayout_startIconDrawable)); if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_startIconContentDescription)) { CharSequence text = c0683McA.d.getText(C17052tZT.jNh.TextInputLayout_startIconContentDescription); if (checkableImageButton.getContentDescription() != text) { checkableImageButton.setContentDescription(text); } } checkableImageButton.setCheckable(c0683McA.d.getBoolean(C17052tZT.jNh.TextInputLayout_startIconCheckable, true)); } d(c0683McA.d.getDimensionPixelSize(C17052tZT.jNh.TextInputLayout_startIconMinSize, getResources().getDimensionPixelSize(C17052tZT.HBt.mtrl_min_touch_target_size))); if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_startIconScaleType)) { ImageView.ScaleType Mp_ = C15977kAW.Mp_(c0683McA.d.getInt(C17052tZT.jNh.TextInputLayout_startIconScaleType, -1)); this.d = Mp_; checkableImageButton.setScaleType(Mp_); } appCompatTextView.setVisibility(8); appCompatTextView.setId(C17052tZT.ZqN.textinput_prefix_text); appCompatTextView.setLayoutParams(new LinearLayout.LayoutParams(-2, -2)); ViewCompat.c(appCompatTextView, 1); URz.we_(appCompatTextView, c0683McA.d.getResourceId(C17052tZT.jNh.TextInputLayout_prefixTextAppearance, 0)); if (c0683McA.d.hasValue(C17052tZT.jNh.TextInputLayout_prefixTextColor)) { appCompatTextView.setTextColor(c0683McA.jK_(C17052tZT.jNh.TextInputLayout_prefixTextColor)); } CharSequence text2 = c0683McA.d.getText(C17052tZT.jNh.TextInputLayout_prefixText); this.b = TextUtils.isEmpty(text2) ? null : text2; appCompatTextView.setText(text2); d(); addView(checkableImageButton); addView(appCompatTextView); } @Override // android.widget.LinearLayout, android.view.View protected void onMeasure(int i, int i2) { super.onMeasure(i, i2); a(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void MA_(Drawable drawable) { this.f.setImageDrawable(drawable); if (drawable != null) { C15977kAW.Mo_(this.g, this.f, this.i, this.j); c(true); C15977kAW.Mq_(this.g, this.f, this.i); return; } c(false); CheckableImageButton checkableImageButton = this.f; View.OnLongClickListener onLongClickListener = this.e; checkableImageButton.setOnClickListener(null); C15977kAW.Mr_(checkableImageButton, onLongClickListener); this.e = null; CheckableImageButton checkableImageButton2 = this.f; checkableImageButton2.setOnLongClickListener(null); C15977kAW.Mr_(checkableImageButton2, null); if (this.f.getContentDescription() != null) { this.f.setContentDescription(null); } } /* JADX INFO: Access modifiers changed from: package-private */ public final void c(boolean z) { if ((this.f.getVisibility() == 0) != z) { this.f.setVisibility(z ? 0 : 8); a(); d(); } } private void a() { EditText editText = this.g.f; if (editText == null) { return; } ViewCompat.a(this.a, this.f.getVisibility() == 0 ? 0 : ViewCompat.q(editText), editText.getCompoundPaddingTop(), getContext().getResources().getDimensionPixelSize(C17052tZT.HBt.material_input_text_to_prefix_suffix_padding), editText.getCompoundPaddingBottom()); } /* JADX INFO: Access modifiers changed from: package-private */ public final void d() { int i = (this.b == null || this.c) ? 8 : 0; setVisibility((this.f.getVisibility() == 0 || i == 0) ? 0 : 8); this.a.setVisibility(i); this.g.d(); } /* JADX INFO: Access modifiers changed from: package-private */ public final void d(int i) { if (i < 0) { throw new IllegalArgumentException("startIconSize cannot be less than 0"); } if (i != this.h) { this.h = i; CheckableImageButton checkableImageButton = this.f; checkableImageButton.setMinimumWidth(i); checkableImageButton.setMinimumHeight(i); } } }