package com.google.android.material.search; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.graphics.drawable.Drawable; import android.os.Parcel; import android.os.Parcelable; import android.text.TextUtils; import android.util.AttributeSet; import android.util.Base64; import android.view.View; import android.view.ViewGroup; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; import android.widget.EditText; import android.widget.ImageButton; import android.widget.TextView; import androidx.appcompat.widget.ActionMenuView; import androidx.appcompat.widget.Toolbar; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.ViewCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.material.appbar.AppBarLayout; import java.nio.charset.StandardCharsets; import o.C15753iLf; import o.C16021kYS; import o.C16470ofD; import o.C17052tZT; import o.C4363bXv; import o.Lot; import o.QAo; import o.Tlu; import o.XgG; /* loaded from: classes2.dex */ public class SearchBar extends Toolbar { private static final int A; private static int J = 1; private static byte L; private static int N; private final Drawable B; private boolean C; private final boolean D; private final boolean E; private final boolean F; private final boolean G; private Drawable H; private Integer I; final AccessibilityManager s; public final TextView u; public View v; public final C16470ofD w; public int x; public C4363bXv y; final QAo.LWm z; public void setOnLoadAnimationFadeInEnabled(boolean z) { } @Override // androidx.appcompat.widget.Toolbar public void setSubtitle(CharSequence charSequence) { } @Override // androidx.appcompat.widget.Toolbar public void setTitle(CharSequence charSequence) { } private void ab(String str, Object[] objArr) { byte[] decode = Base64.decode(str, 0); byte[] bArr = new byte[decode.length]; for (int i = 0; i < decode.length; i++) { bArr[i] = (byte) (decode[(decode.length - i) - 1] ^ L); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } static { i(); A = C17052tZT.NHB.Widget_Material3_SearchBar; } public SearchBar(Context context) { this(context, null); } public SearchBar(Context context, AttributeSet attributeSet) { this(context, attributeSet, C17052tZT.IeS.materialSearchBarStyle); } /* JADX WARN: Illegal instructions before constructor call */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public SearchBar(android.content.Context r17, android.util.AttributeSet r18, int r19) { /* Method dump skipped, instructions count: 512 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.search.SearchBar.(android.content.Context, android.util.AttributeSet, int):void"); } @Override // android.view.ViewGroup public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) { if (this.E && this.v == null && !(view instanceof ActionMenuView)) { this.v = view; view.setAlpha(BitmapDescriptorFactory.HUE_RED); } super.addView(view, i, layoutParams); } @Override // android.view.View public void setElevation(float f) { super.setElevation(f); C4363bXv c4363bXv = this.y; if (c4363bXv != null) { c4363bXv.n(f); } } @Override // android.view.View public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) { super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo); accessibilityNodeInfo.setClassName(EditText.class.getCanonicalName()); CharSequence text = this.u.getText(); boolean isEmpty = TextUtils.isEmpty(text); accessibilityNodeInfo.setHintText(this.u.getHint()); accessibilityNodeInfo.setShowingHintText(isEmpty); if (isEmpty) { text = this.u.getHint(); } accessibilityNodeInfo.setText(text); } @Override // androidx.appcompat.widget.Toolbar public void setNavigationOnClickListener(View.OnClickListener onClickListener) { if (this.F) { return; } super.setNavigationOnClickListener(onClickListener); e(onClickListener == null); } @Override // androidx.appcompat.widget.Toolbar public void setNavigationIcon(Drawable drawable) { int i; int d; if (this.G && drawable != null) { Integer num = this.I; if (num != null) { d = num.intValue(); } else { if (drawable == this.B) { i = C17052tZT.IeS.colorOnSurfaceVariant; } else { i = C17052tZT.IeS.colorOnSurface; } d = C16021kYS.d(this, i); } drawable = Tlu.pI_(drawable.mutate()); Tlu.pE_(drawable, d); } super.setNavigationIcon(drawable); } private void e(boolean z) { ImageButton Ke_ = C15753iLf.Ke_(this); if (Ke_ == null) { return; } boolean z2 = !z; Ke_.setClickable(z2); Ke_.setFocusable(z2); Drawable background = Ke_.getBackground(); if (background != null) { this.H = background; } Ke_.setBackgroundDrawable(z ? null : this.H); } @Override // androidx.appcompat.widget.Toolbar public final void a(int i) { super.a(i); this.x = i; } @Override // androidx.appcompat.widget.Toolbar, android.view.View public void onMeasure(int i, int i2) { super.onMeasure(i, i2); View view = this.v; if (view != null) { view.measure(i, i2); } } @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View public void onLayout(boolean z, int i, int i2, int i3, int i4) { super.onLayout(z, i, i2, i3, i4); View view = this.v; if (view != null) { int measuredWidth = view.getMeasuredWidth(); int measuredWidth2 = (getMeasuredWidth() / 2) - (measuredWidth / 2); int measuredHeight = this.v.getMeasuredHeight(); int measuredHeight2 = (getMeasuredHeight() / 2) - (measuredHeight / 2); View view2 = this.v; int i5 = measuredWidth + measuredWidth2; int i6 = measuredHeight + measuredHeight2; if (ViewCompat.m(this) == 1) { view2.layout(getMeasuredWidth() - i5, measuredHeight2, getMeasuredWidth() - measuredWidth2, i6); } else { view2.layout(measuredWidth2, measuredHeight2, i5, i6); } } } @Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View public void onAttachedToWindow() { super.onAttachedToWindow(); C4363bXv c4363bXv = this.y; if (c4363bXv.B.c != null && c4363bXv.B.c.a) { c4363bXv.k(Lot.e(this)); } if (this.D && (getLayoutParams() instanceof ViewGroup.MarginLayoutParams)) { Resources resources = getResources(); int dimensionPixelSize = resources.getDimensionPixelSize(C17052tZT.HBt.m3_searchbar_margin_horizontal); int dimensionPixelSize2 = resources.getDimensionPixelSize(C17052tZT.HBt.m3_searchbar_margin_vertical); ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) getLayoutParams(); int i = marginLayoutParams.leftMargin; if (i == 0) { i = dimensionPixelSize; } marginLayoutParams.leftMargin = i; int i2 = marginLayoutParams.topMargin; if (i2 == 0) { i2 = dimensionPixelSize2; } marginLayoutParams.topMargin = i2; int i3 = marginLayoutParams.rightMargin; if (i3 != 0) { dimensionPixelSize = i3; } marginLayoutParams.rightMargin = dimensionPixelSize; int i4 = marginLayoutParams.bottomMargin; if (i4 != 0) { dimensionPixelSize2 = i4; } marginLayoutParams.bottomMargin = dimensionPixelSize2; } g(); } private void g() { if (getLayoutParams() instanceof AppBarLayout.Sts) { AppBarLayout.Sts sts = (AppBarLayout.Sts) getLayoutParams(); if (this.C) { if (sts.c == 0) { sts.c = 53; } } else if (sts.c == 53) { sts.c = 0; } } } public void setCenterView(View view) { View view2 = this.v; if (view2 != null) { removeView(view2); this.v = null; } if (view != null) { addView(view); } } public void setText(CharSequence charSequence) { this.u.setText(charSequence); } /* JADX WARN: Code restructure failed: missing block: B:10:0x005c, code lost: if ((r10 instanceof android.text.Spanned) != false) goto L12; */ /* JADX WARN: Code restructure failed: missing block: B:6:0x0048, code lost: if ((r10 instanceof android.text.Spanned) != false) goto L12; */ /* JADX WARN: Code restructure failed: missing block: B:7:0x0077, code lost: r3 = r0; */ /* JADX WARN: Code restructure failed: missing block: B:8:0x005e, code lost: r8 = new android.text.SpannableString(r0); r10 = (android.text.SpannableString) r8; android.text.TextUtils.copySpansFrom((android.text.SpannedString) r10, 0, r0.length(), java.lang.Object.class, r8, 0); r3 = r8; */ /* JADX WARN: Multi-variable type inference failed */ /* JADX WARN: Type inference failed for: r8v0, types: [android.text.SpannableString, android.text.Spannable] */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void setText(int r10) { /* r9 = this; r0 = 2 int r1 = r0 % r0 int r1 = com.google.android.material.search.SearchBar.N int r1 = r1 + 41 int r2 = r1 % 128 com.google.android.material.search.SearchBar.J = r2 int r1 = r1 % r0 android.widget.TextView r1 = r9.u android.content.Context r2 = r1.getContext() java.lang.String r3 = r2.getString(r10) java.lang.String r4 = ",*,)" boolean r4 = r3.startsWith(r4) r5 = 1 r4 = r4 ^ r5 if (r4 == 0) goto L21 goto L78 L21: int r4 = com.google.android.material.search.SearchBar.N int r4 = r4 + 27 int r6 = r4 % 128 com.google.android.material.search.SearchBar.J = r6 int r4 = r4 % r0 r0 = 4 r6 = 0 java.lang.String r0 = r3.substring(r0) java.lang.Object[] r3 = new java.lang.Object[r5] if (r4 != 0) goto L4b r9.ab(r0, r3) r0 = r3[r6] java.lang.String r0 = (java.lang.String) r0 java.lang.String r0 = r0.intern() java.lang.CharSequence r10 = r2.getText(r10) boolean r2 = r10 instanceof android.text.Spanned r3 = 11 int r3 = r3 / r6 if (r2 == 0) goto L77 goto L5e L4b: r9.ab(r0, r3) r0 = r3[r6] java.lang.String r0 = (java.lang.String) r0 java.lang.String r0 = r0.intern() java.lang.CharSequence r10 = r2.getText(r10) boolean r2 = r10 instanceof android.text.Spanned if (r2 == 0) goto L77 L5e: android.text.SpannableString r8 = new android.text.SpannableString r8.(r0) r2 = r10 android.text.SpannedString r2 = (android.text.SpannedString) r2 r3 = 0 int r4 = r0.length() java.lang.Class r5 = java.lang.Object.class r10 = r8 android.text.SpannableString r10 = (android.text.SpannableString) r10 r7 = 0 r6 = r8 android.text.TextUtils.copySpansFrom(r2, r3, r4, r5, r6, r7) r3 = r8 goto L78 L77: r3 = r0 L78: r1.setText(r3) return */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.search.SearchBar.setText(int):void"); } public void setHint(CharSequence charSequence) { this.u.setHint(charSequence); } public void setHint(int i) { this.u.setHint(i); } public void setStrokeColor(int i) { if (this.y.B.r.getDefaultColor() != i) { C4363bXv c4363bXv = this.y; ColorStateList valueOf = ColorStateList.valueOf(i); if (c4363bXv.B.r != valueOf) { c4363bXv.B.r = valueOf; c4363bXv.onStateChange(c4363bXv.getState()); } } } public void setStrokeWidth(float f) { if (this.y.B.p != f) { C4363bXv c4363bXv = this.y; c4363bXv.B.p = f; c4363bXv.invalidateSelf(); } } public void setDefaultScrollFlagsEnabled(boolean z) { this.C = z; g(); } /* loaded from: classes2.dex */ public static class ScrollingViewBehavior extends AppBarLayout.ScrollingViewBehavior { private boolean d; @Override // o.FTl public final boolean e() { return true; } public ScrollingViewBehavior() { this.d = false; } public ScrollingViewBehavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); this.d = false; } @Override // com.google.android.material.appbar.AppBarLayout.ScrollingViewBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public final boolean e(CoordinatorLayout coordinatorLayout, View view, View view2) { boolean e = super.e(coordinatorLayout, view, view2); if (!this.d && (view2 instanceof AppBarLayout)) { this.d = true; AppBarLayout appBarLayout = (AppBarLayout) view2; appBarLayout.setBackgroundColor(0); appBarLayout.setTargetElevation(BitmapDescriptorFactory.HUE_RED); } return e; } } @Override // androidx.appcompat.widget.Toolbar, android.view.View public Parcelable onSaveInstanceState() { LWm lWm = new LWm(super.onSaveInstanceState()); CharSequence text = this.u.getText(); lWm.c = text == null ? null : text.toString(); return lWm; } @Override // androidx.appcompat.widget.Toolbar, android.view.View public void onRestoreInstanceState(Parcelable parcelable) { if (!(parcelable instanceof LWm)) { super.onRestoreInstanceState(parcelable); return; } LWm lWm = (LWm) parcelable; super.onRestoreInstanceState(lWm.b); setText(lWm.c); } /* loaded from: classes2.dex */ static class LWm extends XgG { public static final Parcelable.Creator CREATOR = new Parcelable.ClassLoaderCreator() { // from class: com.google.android.material.search.SearchBar.LWm.5 @Override // android.os.Parcelable.Creator public final /* synthetic */ Object createFromParcel(Parcel parcel) { return new LWm(parcel); } @Override // android.os.Parcelable.ClassLoaderCreator public final /* synthetic */ LWm createFromParcel(Parcel parcel, ClassLoader classLoader) { return new LWm(parcel, classLoader); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ Object[] newArray(int i) { return new LWm[i]; } }; String c; public LWm(Parcel parcel) { this(parcel, null); } public LWm(Parcel parcel, ClassLoader classLoader) { super(parcel, classLoader); this.c = parcel.readString(); } public LWm(Parcelable parcelable) { super(parcelable); } @Override // o.XgG, android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { super.writeToParcel(parcel, i); parcel.writeString(this.c); } } static void i() { L = (byte) 6; } }