package androidx.appcompat.widget; import android.app.PendingIntent; import android.app.SearchableInfo; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.res.Configuration; import android.content.res.Resources; import android.database.Cursor; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.os.Parcel; import android.os.Parcelable; import android.text.Editable; import android.text.SpannableStringBuilder; import android.text.TextUtils; import android.text.TextWatcher; import android.text.style.ImageSpan; import android.util.AttributeSet; import android.util.Base64; import android.util.DisplayMetrics; import android.util.TypedValue; import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.MotionEvent; import android.view.TouchDelegate; import android.view.View; import android.view.ViewConfiguration; import android.view.ViewGroup; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.AutoCompleteTextView; import android.widget.ImageView; import android.widget.TextView; import androidx.core.view.ViewCompat; import com.airbnb.deeplinkdispatch.UrlTreeKt; import java.lang.reflect.Method; import java.nio.charset.StandardCharsets; import java.util.WeakHashMap; import o.BEC; import o.C0683McA; import o.C6286cOZ; import o.JPw; import o.SYO; import o.XgG; import o.ZRp; import o.mxt; /* loaded from: classes.dex */ public class SearchView extends LinearLayoutCompat implements JPw { private static byte ab = 0; private static int ag = 0; private static int ah = 1; static final LWm e; private final TextView.OnEditorActionListener A; private Sts B; private CharSequence C; private final AdapterView.OnItemClickListener D; private final AdapterView.OnItemSelectedListener E; private final WeakHashMap F; private View.OnClickListener G; private RVV H; private CharSequence I; private Runnable J; private boolean K; private final View L; private final Drawable M; private Rect N; private Rect O; private boolean P; private int[] Q; private int[] R; private final View S; private saX T; private View.OnKeyListener U; private TextWatcher V; private final Runnable W; boolean a; private boolean aa; private CharSequence ac; final View b; final ImageView c; final ImageView d; final View f; final ImageView g; View.OnFocusChangeListener h; final SearchAutoComplete i; IeS j; BEC k; public final int l; SearchableInfo m; public final int n; /* renamed from: o, reason: collision with root package name */ final Intent f6377o; private Bundle p; final ImageView q; private final ImageView r; final Intent s; private boolean t; private final CharSequence u; private int v; private int w; private boolean x; private boolean y; private final View.OnClickListener z; /* loaded from: classes.dex */ public interface IeS { boolean a(); boolean c(); } /* loaded from: classes.dex */ public interface RVV { boolean c(); } /* loaded from: classes.dex */ public interface Sts { boolean d(); } private static void ad(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] ^ ab); } objArr[0] = new String(bArr, StandardCharsets.UTF_8); } static { n(); e = Build.VERSION.SDK_INT < 29 ? new LWm() : null; } public SearchView(Context context) { this(context, null); } public SearchView(Context context, AttributeSet attributeSet) { this(context, attributeSet, SYO.IeS.searchViewStyle); } public SearchView(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.N = new Rect(); this.O = new Rect(); this.R = new int[2]; this.Q = new int[2]; this.W = new Runnable(this) { // from class: androidx.appcompat.widget.SearchView.1 final SearchView c; { this.c = this; } @Override // java.lang.Runnable public final void run() { this.c.o(); } }; this.J = new Runnable(this) { // from class: androidx.appcompat.widget.SearchView.2 final SearchView a; { this.a = this; } @Override // java.lang.Runnable public final void run() { if (this.a.k instanceof ZRp) { this.a.k.wQ_(null); } } }; this.F = new WeakHashMap<>(); View.OnClickListener onClickListener = new View.OnClickListener(this) { // from class: androidx.appcompat.widget.SearchView.8 final SearchView b; { this.b = this; } @Override // android.view.View.OnClickListener public final void onClick(View view) { if (view == this.b.g) { this.b.j(); return; } if (view == this.b.d) { this.b.g(); return; } if (view == this.b.c) { this.b.k(); return; } if (view == this.b.q) { SearchView searchView = this.b; SearchableInfo searchableInfo = searchView.m; if (searchableInfo != null) { try { if (!searchableInfo.getVoiceSearchLaunchWebSearch()) { if (searchableInfo.getVoiceSearchLaunchRecognizer()) { searchView.getContext().startActivity(searchView.jg_(searchView.f6377o, searchableInfo)); return; } return; } else { Intent intent = new Intent(searchView.s); ComponentName searchActivity = searchableInfo.getSearchActivity(); intent.putExtra("calling_package", searchActivity == null ? null : searchActivity.flattenToShortString()); searchView.getContext().startActivity(intent); return; } } catch (ActivityNotFoundException unused) { return; } } return; } if (view == this.b.i) { this.b.i(); } } }; this.z = onClickListener; this.U = new View.OnKeyListener(this) { // from class: androidx.appcompat.widget.SearchView.10 final SearchView e; { this.e = this; } @Override // android.view.View.OnKeyListener public final boolean onKey(View view, int i2, KeyEvent keyEvent) { if (this.e.m == null) { return false; } if (this.e.i.isPopupShowing() && this.e.i.getListSelection() != -1) { SearchView searchView = this.e; if (searchView.m != null && searchView.k != null && keyEvent.getAction() == 0 && keyEvent.hasNoModifiers()) { if (i2 == 66 || i2 == 84 || i2 == 61) { return searchView.b(searchView.i.getListSelection()); } if (i2 == 21 || i2 == 22) { searchView.i.setSelection(i2 == 21 ? 0 : searchView.i.length()); searchView.i.setListSelection(0); searchView.i.clearListSelection(); searchView.i.c(); return true; } if (i2 == 19) { searchView.i.getListSelection(); } } return false; } if (TextUtils.getTrimmedLength(this.e.i.getText()) == 0 || !keyEvent.hasNoModifiers() || keyEvent.getAction() != 1 || i2 != 66) { return false; } view.cancelLongPress(); SearchView searchView2 = this.e; searchView2.getContext().startActivity(searchView2.je_("android.intent.action.SEARCH", null, null, searchView2.i.getText().toString(), 0, null)); return true; } }; TextView.OnEditorActionListener onEditorActionListener = new TextView.OnEditorActionListener(this) { // from class: androidx.appcompat.widget.SearchView.9 final SearchView a; { this.a = this; } @Override // android.widget.TextView.OnEditorActionListener public final boolean onEditorAction(TextView textView, int i2, KeyEvent keyEvent) { this.a.k(); return true; } }; this.A = onEditorActionListener; AdapterView.OnItemClickListener onItemClickListener = new AdapterView.OnItemClickListener(this) { // from class: androidx.appcompat.widget.SearchView.6 final SearchView b; { this.b = this; } @Override // android.widget.AdapterView.OnItemClickListener public final void onItemClick(AdapterView adapterView, View view, int i2, long j) { this.b.b(i2); } }; this.D = onItemClickListener; AdapterView.OnItemSelectedListener onItemSelectedListener = new AdapterView.OnItemSelectedListener(this) { // from class: androidx.appcompat.widget.SearchView.7 final SearchView c; @Override // android.widget.AdapterView.OnItemSelectedListener public final void onNothingSelected(AdapterView adapterView) { } { this.c = this; } @Override // android.widget.AdapterView.OnItemSelectedListener public final void onItemSelected(AdapterView adapterView, View view, int i2, long j) { SearchView searchView = this.c; IeS ieS = searchView.j; if (ieS == null || !ieS.c()) { Editable text = searchView.i.getText(); Cursor cursor = searchView.k.d; if (cursor != null) { if (cursor.moveToPosition(i2)) { CharSequence wR_ = searchView.k.wR_(cursor); if (wR_ != null) { searchView.a(wR_); return; } else { searchView.a(text); return; } } searchView.a(text); } } } }; this.E = onItemSelectedListener; this.V = new TextWatcher(this) { // from class: androidx.appcompat.widget.SearchView.5 final SearchView a; @Override // android.text.TextWatcher public final void afterTextChanged(Editable editable) { } @Override // android.text.TextWatcher public final void beforeTextChanged(CharSequence charSequence, int i2, int i3, int i4) { } { this.a = this; } @Override // android.text.TextWatcher public final void onTextChanged(CharSequence charSequence, int i2, int i3, int i4) { this.a.e(charSequence); } }; C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(attributeSet, SYO.ZqN.SearchView, i, 0)); ViewCompat.sm_(this, context, SYO.ZqN.SearchView, attributeSet, c0683McA.d, i, 0); LayoutInflater.from(context).inflate(c0683McA.d.getResourceId(SYO.ZqN.SearchView_layout, SYO.ojQ.abc_search_view), (ViewGroup) this, true); SearchAutoComplete searchAutoComplete = (SearchAutoComplete) findViewById(SYO.saX.search_src_text); this.i = searchAutoComplete; searchAutoComplete.d = this; this.L = findViewById(SYO.saX.search_edit_frame); View findViewById = findViewById(SYO.saX.search_plate); this.f = findViewById; View findViewById2 = findViewById(SYO.saX.submit_area); this.S = findViewById2; ImageView imageView = (ImageView) findViewById(SYO.saX.search_button); this.g = imageView; ImageView imageView2 = (ImageView) findViewById(SYO.saX.search_go_btn); this.c = imageView2; ImageView imageView3 = (ImageView) findViewById(SYO.saX.search_close_btn); this.d = imageView3; ImageView imageView4 = (ImageView) findViewById(SYO.saX.search_voice_btn); this.q = imageView4; ImageView imageView5 = (ImageView) findViewById(SYO.saX.search_mag_icon); this.r = imageView5; ViewCompat.sn_(findViewById, c0683McA.jL_(SYO.ZqN.SearchView_queryBackground)); ViewCompat.sn_(findViewById2, c0683McA.jL_(SYO.ZqN.SearchView_submitBackground)); imageView.setImageDrawable(c0683McA.jL_(SYO.ZqN.SearchView_searchIcon)); imageView2.setImageDrawable(c0683McA.jL_(SYO.ZqN.SearchView_goIcon)); imageView3.setImageDrawable(c0683McA.jL_(SYO.ZqN.SearchView_closeIcon)); imageView4.setImageDrawable(c0683McA.jL_(SYO.ZqN.SearchView_voiceIcon)); imageView5.setImageDrawable(c0683McA.jL_(SYO.ZqN.SearchView_searchIcon)); this.M = c0683McA.jL_(SYO.ZqN.SearchView_searchHintIcon); C6286cOZ.e(imageView, getResources().getString(SYO.tOB.abc_searchview_description_search)); this.n = c0683McA.d.getResourceId(SYO.ZqN.SearchView_suggestionRowLayout, SYO.ojQ.abc_search_dropdown_item_icons_2line); this.l = c0683McA.d.getResourceId(SYO.ZqN.SearchView_commitIcon, 0); imageView.setOnClickListener(onClickListener); imageView3.setOnClickListener(onClickListener); imageView2.setOnClickListener(onClickListener); imageView4.setOnClickListener(onClickListener); searchAutoComplete.setOnClickListener(onClickListener); searchAutoComplete.addTextChangedListener(this.V); searchAutoComplete.setOnEditorActionListener(onEditorActionListener); searchAutoComplete.setOnItemClickListener(onItemClickListener); searchAutoComplete.setOnItemSelectedListener(onItemSelectedListener); searchAutoComplete.setOnKeyListener(this.U); searchAutoComplete.setOnFocusChangeListener(new View.OnFocusChangeListener(this) { // from class: androidx.appcompat.widget.SearchView.4 final SearchView b; { this.b = this; } @Override // android.view.View.OnFocusChangeListener public final void onFocusChange(View view, boolean z) { if (this.b.h != null) { this.b.h.onFocusChange(this.b, z); } } }); setIconifiedByDefault(c0683McA.d.getBoolean(SYO.ZqN.SearchView_iconifiedByDefault, true)); int dimensionPixelSize = c0683McA.d.getDimensionPixelSize(SYO.ZqN.SearchView_android_maxWidth, -1); if (dimensionPixelSize != -1) { setMaxWidth(dimensionPixelSize); } this.u = c0683McA.d.getText(SYO.ZqN.SearchView_defaultQueryHint); this.I = c0683McA.d.getText(SYO.ZqN.SearchView_queryHint); int i2 = c0683McA.d.getInt(SYO.ZqN.SearchView_android_imeOptions, -1); if (i2 != -1) { setImeOptions(i2); } int i3 = c0683McA.d.getInt(SYO.ZqN.SearchView_android_inputType, -1); if (i3 != -1) { setInputType(i3); } setFocusable(c0683McA.d.getBoolean(SYO.ZqN.SearchView_android_focusable, true)); c0683McA.d.recycle(); Intent intent = new Intent("android.speech.action.WEB_SEARCH"); this.s = intent; intent.addFlags(268435456); intent.putExtra("android.speech.extra.LANGUAGE_MODEL", "web_search"); Intent intent2 = new Intent("android.speech.action.RECOGNIZE_SPEECH"); this.f6377o = intent2; intent2.addFlags(268435456); View findViewById3 = findViewById(searchAutoComplete.getDropDownAnchor()); this.b = findViewById3; if (findViewById3 != null) { findViewById3.addOnLayoutChangeListener(new View.OnLayoutChangeListener(this) { // from class: androidx.appcompat.widget.SearchView.3 final SearchView d; { this.d = this; } @Override // android.view.View.OnLayoutChangeListener public final void onLayoutChange(View view, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11) { int i12; SearchView searchView = this.d; if (searchView.b.getWidth() > 1) { Resources resources = searchView.getContext().getResources(); int paddingLeft = searchView.f.getPaddingLeft(); Rect rect = new Rect(); boolean b = mxt.b(searchView); int dimensionPixelSize2 = searchView.a ? resources.getDimensionPixelSize(SYO.Sts.abc_dropdownitem_icon_width) + resources.getDimensionPixelSize(SYO.Sts.abc_dropdownitem_text_padding_left) : 0; searchView.i.getDropDownBackground().getPadding(rect); if (b) { i12 = -rect.left; } else { i12 = paddingLeft - (rect.left + dimensionPixelSize2); } searchView.i.setDropDownHorizontalOffset(i12); searchView.i.setDropDownWidth((((searchView.b.getWidth() + rect.left) + rect.right) + dimensionPixelSize2) - paddingLeft); } } }); } d(this.a); String q = q(); searchAutoComplete.setHint(b(q == null ? "" : q)); } /* JADX WARN: Code restructure failed: missing block: B:31:0x00b8, code lost: if (getContext().getPackageManager().resolveActivity(r0, 65536) != null) goto L38; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ public void setSearchableInfo(android.app.SearchableInfo r6) { /* r5 = this; r5.m = r6 r0 = 0 r1 = 1 if (r6 == 0) goto L88 androidx.appcompat.widget.SearchView$SearchAutoComplete r2 = r5.i int r6 = r6.getSuggestThreshold() r2.setThreshold(r6) androidx.appcompat.widget.SearchView$SearchAutoComplete r6 = r5.i android.app.SearchableInfo r2 = r5.m int r2 = r2.getImeOptions() r6.setImeOptions(r2) android.app.SearchableInfo r6 = r5.m int r6 = r6.getInputType() r2 = r6 & 15 if (r2 != r1) goto L33 r2 = -65537(0xfffffffffffeffff, float:NaN) r6 = r6 & r2 android.app.SearchableInfo r2 = r5.m java.lang.String r2 = r2.getSuggestAuthority() if (r2 == 0) goto L33 r2 = 589824(0x90000, float:8.2652E-40) r6 = r6 | r2 L33: androidx.appcompat.widget.SearchView$SearchAutoComplete r2 = r5.i r2.setInputType(r6) o.BEC r6 = r5.k if (r6 == 0) goto L3f r6.wQ_(r0) L3f: android.app.SearchableInfo r6 = r5.m java.lang.String r6 = r6.getSuggestAuthority() if (r6 == 0) goto L77 o.ZRp r6 = new o.ZRp android.content.Context r2 = r5.getContext() android.app.SearchableInfo r3 = r5.m java.util.WeakHashMap r4 = r5.F r6.(r2, r5, r3, r4) r5.k = r6 androidx.appcompat.widget.SearchView$SearchAutoComplete r2 = r5.i r2.setAdapter(r6) o.BEC r6 = r5.k o.ZRp r6 = (o.ZRp) r6 boolean r2 = r5.K if (r2 == 0) goto L65 r2 = 2 goto L66 L65: r2 = r1 L66: java.lang.Integer r3 = java.lang.Integer.valueOf(r2) java.lang.Object[] r6 = new java.lang.Object[]{r6, r3} r3 = 416540722(0x18d3e832, float:5.477668E-24) r4 = -416540722(0xffffffffe72c17ce, float:-8.1268615E23) o.ZRp.e(r6, r3, r4, r2) L77: java.lang.CharSequence r6 = r5.q() androidx.appcompat.widget.SearchView$SearchAutoComplete r2 = r5.i if (r6 != 0) goto L81 java.lang.String r6 = "" L81: java.lang.CharSequence r6 = r5.b(r6) r2.setHint(r6) L88: android.app.SearchableInfo r6 = r5.m r2 = 0 if (r6 == 0) goto Lbb boolean r6 = r6.getVoiceSearchEnabled() if (r6 == 0) goto Lbb android.app.SearchableInfo r6 = r5.m boolean r6 = r6.getVoiceSearchLaunchWebSearch() if (r6 == 0) goto L9e android.content.Intent r0 = r5.s goto La8 L9e: android.app.SearchableInfo r6 = r5.m boolean r6 = r6.getVoiceSearchLaunchRecognizer() if (r6 == 0) goto La8 android.content.Intent r0 = r5.f6377o La8: if (r0 == 0) goto Lbb android.content.Context r6 = r5.getContext() android.content.pm.PackageManager r6 = r6.getPackageManager() r3 = 65536(0x10000, float:9.1835E-41) android.content.pm.ResolveInfo r6 = r6.resolveActivity(r0, r3) if (r6 == 0) goto Lbb goto Lbc Lbb: r1 = r2 Lbc: r5.aa = r1 if (r1 == 0) goto Lc7 androidx.appcompat.widget.SearchView$SearchAutoComplete r6 = r5.i java.lang.String r0 = "nm" r6.setPrivateImeOptions(r0) Lc7: boolean r6 = r5.x r5.d(r6) return */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.SearchView.setSearchableInfo(android.app.SearchableInfo):void"); } public void setImeOptions(int i) { this.i.setImeOptions(i); } public void setInputType(int i) { this.i.setInputType(i); } @Override // android.view.ViewGroup, android.view.View public boolean requestFocus(int i, Rect rect) { if (this.t || !isFocusable()) { return false; } if (!this.x) { boolean requestFocus = this.i.requestFocus(i, rect); if (requestFocus) { d(false); } return requestFocus; } return super.requestFocus(i, rect); } @Override // android.view.ViewGroup, android.view.View public void clearFocus() { this.t = true; super.clearFocus(); this.i.clearFocus(); this.i.b(false); this.t = false; } public void setQuery(CharSequence charSequence, boolean z) { this.i.setText(charSequence); if (charSequence != null) { SearchAutoComplete searchAutoComplete = this.i; searchAutoComplete.setSelection(searchAutoComplete.length()); this.ac = charSequence; } if (!z || TextUtils.isEmpty(charSequence)) { return; } k(); } /* JADX WARN: Code restructure failed: missing block: B:10:0x0026, code lost: r1 = r1 + 93; androidx.appcompat.widget.SearchView.ah = r1 % 128; */ /* JADX WARN: Code restructure failed: missing block: B:11:0x002d, code lost: if ((r1 % 2) == 0) goto L20; */ /* JADX WARN: Code restructure failed: missing block: B:13:0x0033, code lost: if (r2.getHintId() == 0) goto L22; */ /* JADX WARN: Code restructure failed: missing block: B:14:0x0035, code lost: r0 = getContext(); r1 = r9.m.getHintId(); r2 = r0.getString(r1); */ /* JADX WARN: Code restructure failed: missing block: B:15:0x0049, code lost: if (r2.startsWith(",*,)") == false) goto L25; */ /* JADX WARN: Code restructure failed: missing block: B:16:0x004b, code lost: r4 = new java.lang.Object[1]; ad(r2.substring(4), r4); r2 = ((java.lang.String) r4[0]).intern(); r0 = r0.getText(r1); */ /* JADX WARN: Code restructure failed: missing block: B:17:0x0064, code lost: if ((r0 instanceof android.text.Spanned) == false) goto L26; */ /* JADX WARN: Code restructure failed: missing block: B:18:0x0066, code lost: r1 = new android.text.SpannableString(r2); android.text.TextUtils.copySpansFrom((android.text.SpannedString) r0, 0, r2.length(), java.lang.Object.class, r1, 0); */ /* JADX WARN: Code restructure failed: missing block: B:19:?, code lost: return r1; */ /* JADX WARN: Code restructure failed: missing block: B:20:?, code lost: return r2; */ /* JADX WARN: Code restructure failed: missing block: B:21:?, code lost: return r2; */ /* JADX WARN: Code restructure failed: missing block: B:22:0x007f, code lost: r2.getHintId(); r0 = null; r0.hashCode(); */ /* JADX WARN: Code restructure failed: missing block: B:23:0x0086, code lost: throw null; */ /* JADX WARN: Code restructure failed: missing block: B:25:0x0024, code lost: if (r2 != null) goto L11; */ /* JADX WARN: Code restructure failed: missing block: B:6:0x001f, code lost: if (r2 != null) goto L11; */ /* Code decompiled incorrectly, please refer to instructions dump. To view partially-correct add '--show-bad-code' argument */ private java.lang.CharSequence q() { /* r9 = this; r0 = 2 int r1 = r0 % r0 int r1 = androidx.appcompat.widget.SearchView.ag int r2 = r1 + 121 int r3 = r2 % 128 androidx.appcompat.widget.SearchView.ah = r3 int r2 = r2 % r0 java.lang.CharSequence r2 = r9.I if (r2 != 0) goto L89 int r2 = r1 + 101 int r3 = r2 % 128 androidx.appcompat.widget.SearchView.ah = r3 int r2 = r2 % r0 r3 = 0 if (r2 != 0) goto L22 android.app.SearchableInfo r2 = r9.m r4 = 81 int r4 = r4 / r3 if (r2 == 0) goto L87 goto L26 L22: android.app.SearchableInfo r2 = r9.m if (r2 == 0) goto L87 L26: int r1 = r1 + 93 int r4 = r1 % 128 androidx.appcompat.widget.SearchView.ah = r4 int r1 = r1 % r0 if (r1 == 0) goto L7f int r0 = r2.getHintId() if (r0 == 0) goto L87 android.content.Context r0 = r9.getContext() android.app.SearchableInfo r1 = r9.m int r1 = r1.getHintId() java.lang.String r2 = r0.getString(r1) java.lang.String r4 = ",*,)" boolean r4 = r2.startsWith(r4) if (r4 == 0) goto L89 r4 = 4 java.lang.String r2 = r2.substring(r4) r4 = 1 java.lang.Object[] r4 = new java.lang.Object[r4] ad(r2, r4) r2 = r4[r3] java.lang.String r2 = (java.lang.String) r2 java.lang.String r2 = r2.intern() java.lang.CharSequence r0 = r0.getText(r1) boolean r1 = r0 instanceof android.text.Spanned if (r1 == 0) goto L89 android.text.SpannableString r1 = new android.text.SpannableString r1.(r2) r3 = r0 android.text.SpannedString r3 = (android.text.SpannedString) r3 r4 = 0 int r5 = r2.length() java.lang.Class r6 = java.lang.Object.class r0 = r1 android.text.SpannableString r0 = (android.text.SpannableString) r0 r8 = 0 r7 = r1 android.text.TextUtils.copySpansFrom(r3, r4, r5, r6, r7, r8) r2 = r1 goto L89 L7f: r2.getHintId() r0 = 0 r0.hashCode() throw r0 L87: java.lang.CharSequence r2 = r9.u L89: return r2 */ throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.SearchView.q():java.lang.CharSequence"); } public void setIconifiedByDefault(boolean z) { if (this.a == z) { return; } this.a = z; d(z); CharSequence q = q(); SearchAutoComplete searchAutoComplete = this.i; if (q == null) { q = ""; } searchAutoComplete.setHint(b(q)); } public void setIconified(boolean z) { if (z) { g(); } else { j(); } } public void setQueryRefinementEnabled(boolean z) { this.K = z; BEC bec = this.k; if (bec instanceof ZRp) { ZRp zRp = (ZRp) bec; int i = z ? 2 : 1; ZRp.e(new Object[]{zRp, Integer.valueOf(i)}, 416540722, -416540722, i); } } public void setSuggestionsAdapter(BEC bec) { this.k = bec; this.i.setAdapter(bec); } public void setMaxWidth(int i) { this.v = i; requestLayout(); } /* JADX INFO: Access modifiers changed from: protected */ @Override // androidx.appcompat.widget.LinearLayoutCompat, 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); if (z) { SearchAutoComplete searchAutoComplete = this.i; Rect rect = this.N; searchAutoComplete.getLocationInWindow(this.R); getLocationInWindow(this.Q); int[] iArr = this.R; int i5 = iArr[1]; int[] iArr2 = this.Q; int i6 = i5 - iArr2[1]; int i7 = iArr[0] - iArr2[0]; rect.set(i7, i6, searchAutoComplete.getWidth() + i7, searchAutoComplete.getHeight() + i6); this.O.set(this.N.left, 0, this.N.right, i4 - i2); saX sax = this.T; if (sax == null) { saX sax2 = new saX(this.O, this.N, this.i); this.T = sax2; setTouchDelegate(sax2); return; } sax.jj_(this.O, this.N); } } private void d(boolean z) { this.x = z; int i = z ? 0 : 8; boolean isEmpty = TextUtils.isEmpty(this.i.getText()); this.g.setVisibility(i); e(!isEmpty); this.L.setVisibility(z ? 8 : 0); this.r.setVisibility((this.r.getDrawable() == null || this.a) ? 8 : 0); m(); b(isEmpty); p(); } private void e(boolean z) { boolean z2 = this.P; this.c.setVisibility((!z2 || !(z2 || this.aa) || this.x || !hasFocus() || (!z && this.aa)) ? 8 : 0); } private void p() { this.S.setVisibility(((this.P || this.aa) && !this.x && (this.c.getVisibility() == 0 || this.q.getVisibility() == 0)) ? 0 : 8); } private void m() { boolean z = true; boolean z2 = !TextUtils.isEmpty(this.i.getText()); if (!z2 && (!this.a || this.y)) { z = false; } this.d.setVisibility(z ? 0 : 8); Drawable drawable = this.d.getDrawable(); if (drawable != null) { drawable.setState(z2 ? ENABLED_STATE_SET : EMPTY_STATE_SET); } } final void o() { int[] iArr = this.i.hasFocus() ? FOCUSED_STATE_SET : EMPTY_STATE_SET; Drawable background = this.f.getBackground(); if (background != null) { background.setState(iArr); } Drawable background2 = this.S.getBackground(); if (background2 != null) { background2.setState(iArr); } invalidate(); } @Override // android.view.ViewGroup, android.view.View protected void onDetachedFromWindow() { removeCallbacks(this.W); post(this.J); super.onDetachedFromWindow(); } private CharSequence b(CharSequence charSequence) { if (!this.a || this.M == null) { return charSequence; } int textSize = (int) (this.i.getTextSize() * 1.25d); this.M.setBounds(0, 0, textSize, textSize); SpannableStringBuilder spannableStringBuilder = new SpannableStringBuilder(" "); spannableStringBuilder.setSpan(new ImageSpan(this.M), 1, 2, 33); spannableStringBuilder.append(charSequence); return spannableStringBuilder; } final void e(CharSequence charSequence) { Editable text = this.i.getText(); this.ac = text; boolean isEmpty = TextUtils.isEmpty(text); e(!isEmpty); b(isEmpty); m(); p(); if (this.H != null) { TextUtils.equals(charSequence, this.C); } this.C = charSequence.toString(); } final void k() { Editable text = this.i.getText(); if (text == null || TextUtils.getTrimmedLength(text) <= 0) { return; } RVV rvv = this.H; if (rvv == null || !rvv.c()) { if (this.m != null) { getContext().startActivity(je_("android.intent.action.SEARCH", null, null, text.toString(), 0, null)); } this.i.b(false); this.i.dismissDropDown(); } } final void g() { if (!TextUtils.isEmpty(this.i.getText())) { this.i.setText(""); this.i.requestFocus(); this.i.b(true); } else if (this.a) { Sts sts = this.B; if (sts == null || !sts.d()) { clearFocus(); d(true); } } } final void j() { d(false); this.i.requestFocus(); this.i.b(true); View.OnClickListener onClickListener = this.G; if (onClickListener != null) { onClickListener.onClick(this); } } @Override // android.view.View public void onWindowFocusChanged(boolean z) { super.onWindowFocusChanged(z); post(this.W); } @Override // o.JPw public final void b() { setQuery("", false); clearFocus(); d(true); this.i.setImeOptions(this.w); this.y = false; } @Override // o.JPw public final void c() { if (this.y) { return; } this.y = true; int imeOptions = this.i.getImeOptions(); this.w = imeOptions; this.i.setImeOptions(imeOptions | 33554432); this.i.setText(""); setIconified(false); } /* loaded from: classes.dex */ static class tOB extends XgG { public static final Parcelable.Creator CREATOR = new Parcelable.ClassLoaderCreator() { // from class: androidx.appcompat.widget.SearchView.tOB.4 @Override // android.os.Parcelable.Creator public final /* synthetic */ Object createFromParcel(Parcel parcel) { return new tOB(parcel, null); } @Override // android.os.Parcelable.ClassLoaderCreator public final /* synthetic */ tOB createFromParcel(Parcel parcel, ClassLoader classLoader) { return new tOB(parcel, classLoader); } @Override // android.os.Parcelable.Creator public final /* bridge */ /* synthetic */ Object[] newArray(int i) { return new tOB[i]; } }; boolean e; tOB(Parcelable parcelable) { super(parcelable); } public tOB(Parcel parcel, ClassLoader classLoader) { super(parcel, classLoader); this.e = ((Boolean) parcel.readValue(null)).booleanValue(); } @Override // o.XgG, android.os.Parcelable public final void writeToParcel(Parcel parcel, int i) { super.writeToParcel(parcel, i); parcel.writeValue(Boolean.valueOf(this.e)); } public final String toString() { StringBuilder sb = new StringBuilder("SearchView.SavedState{"); sb.append(Integer.toHexString(System.identityHashCode(this))); sb.append(" isIconified="); sb.append(this.e); sb.append(UrlTreeKt.componentParamSuffix); return sb.toString(); } } @Override // android.view.View protected Parcelable onSaveInstanceState() { tOB tob = new tOB(super.onSaveInstanceState()); tob.e = this.x; return tob; } @Override // android.view.View protected void onRestoreInstanceState(Parcelable parcelable) { if (!(parcelable instanceof tOB)) { super.onRestoreInstanceState(parcelable); return; } tOB tob = (tOB) parcelable; super.onRestoreInstanceState(tob.b); d(tob.e); requestLayout(); } final boolean b(int i) { IeS ieS = this.j; if (ieS != null && ieS.a()) { return false; } d(i); this.i.b(false); this.i.dismissDropDown(); return true; } public final void a(CharSequence charSequence) { this.i.setText(charSequence); this.i.setSelection(TextUtils.isEmpty(charSequence) ? 0 : charSequence.length()); } final Intent je_(String str, Uri uri, String str2, String str3, int i, String str4) { Intent intent = new Intent(str); intent.addFlags(268435456); if (uri != null) { intent.setData(uri); } intent.putExtra("user_query", this.ac); if (str3 != null) { intent.putExtra("query", str3); } if (str2 != null) { intent.putExtra("intent_extra_data_key", str2); } Bundle bundle = this.p; if (bundle != null) { intent.putExtra("app_data", bundle); } intent.setComponent(this.m.getSearchActivity()); return intent; } final Intent jg_(Intent intent, SearchableInfo searchableInfo) { String str; String str2; String str3; int i = 2 % 2; ComponentName searchActivity = searchableInfo.getSearchActivity(); Intent intent2 = new Intent("android.intent.action.SEARCH"); intent2.setComponent(searchActivity); PendingIntent activity = PendingIntent.getActivity(getContext(), 0, intent2, 1107296256); Bundle bundle = new Bundle(); Bundle bundle2 = this.p; if (bundle2 != null) { bundle.putParcelable("app_data", bundle2); } Intent intent3 = new Intent(intent); Resources resources = getResources(); if (searchableInfo.getVoiceLanguageModeId() != 0) { str = resources.getString(searchableInfo.getVoiceLanguageModeId()); if (str.startsWith(",*,)")) { Object[] objArr = new Object[1]; ad(str.substring(4), objArr); str = ((String) objArr[0]).intern(); } } else { str = "free_form"; } String str4 = null; if (searchableInfo.getVoicePromptTextId() != 0) { str2 = resources.getString(searchableInfo.getVoicePromptTextId()); if (str2.startsWith(",*,)")) { Object[] objArr2 = new Object[1]; ad(str2.substring(4), objArr2); str2 = ((String) objArr2[0]).intern(); } } else { str2 = null; } if (searchableInfo.getVoiceLanguageId() != 0) { str3 = resources.getString(searchableInfo.getVoiceLanguageId()); if (str3.startsWith(",*,)")) { int i2 = ah + 117; ag = i2 % 128; int i3 = i2 % 2; Object[] objArr3 = new Object[1]; ad(str3.substring(4), objArr3); str3 = ((String) objArr3[0]).intern(); int i4 = ah + 113; ag = i4 % 128; int i5 = i4 % 2; } } else { str3 = null; } int voiceMaxResults = searchableInfo.getVoiceMaxResults() != 0 ? searchableInfo.getVoiceMaxResults() : 1; intent3.putExtra("android.speech.extra.LANGUAGE_MODEL", str); intent3.putExtra("android.speech.extra.PROMPT", str2); intent3.putExtra("android.speech.extra.LANGUAGE", str3); intent3.putExtra("android.speech.extra.MAX_RESULTS", voiceMaxResults); if (searchActivity == null) { int i6 = ag + 119; ah = i6 % 128; if (i6 % 2 == 0) { throw null; } } else { str4 = searchActivity.flattenToShortString(); int i7 = ag + 63; ah = i7 % 128; int i8 = i7 % 2; } intent3.putExtra("calling_package", str4); intent3.putExtra("android.speech.extra.RESULTS_PENDINGINTENT", activity); intent3.putExtra("android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE", bundle); return intent3; } private Intent jf_(Cursor cursor) { String jn_; try { try { String jn_2 = ZRp.jn_(cursor, "suggest_intent_action"); if (jn_2 == null) { jn_2 = this.m.getSuggestIntentAction(); } if (jn_2 == null) { jn_2 = "android.intent.action.SEARCH"; } String str = jn_2; String jn_3 = ZRp.jn_(cursor, "suggest_intent_data"); if (jn_3 == null) { jn_3 = this.m.getSuggestIntentData(); } if (jn_3 != null && (jn_ = ZRp.jn_(cursor, "suggest_intent_data_id")) != null) { StringBuilder sb = new StringBuilder(); sb.append(jn_3); sb.append("/"); sb.append(Uri.encode(jn_)); jn_3 = sb.toString(); } return je_(str, jn_3 == null ? null : Uri.parse(jn_3), ZRp.jn_(cursor, "suggest_intent_extra_data"), ZRp.jn_(cursor, "suggest_intent_query"), 0, null); } catch (RuntimeException unused) { cursor.getPosition(); return null; } } catch (RuntimeException unused2) { return null; } } final void i() { if (Build.VERSION.SDK_INT >= 29) { HBt.jh_(this.i); return; } LWm lWm = e; SearchAutoComplete searchAutoComplete = this.i; if (Build.VERSION.SDK_INT < 29) { Method method = lWm.c; if (method != null) { try { method.invoke(searchAutoComplete, new Object[0]); } catch (Exception unused) { } } SearchAutoComplete searchAutoComplete2 = this.i; if (Build.VERSION.SDK_INT < 29) { Method method2 = lWm.a; if (method2 != null) { try { method2.invoke(searchAutoComplete2, new Object[0]); return; } catch (Exception unused2) { return; } } return; } throw new UnsupportedClassVersionError("This function can only be used for API Level < 29."); } throw new UnsupportedClassVersionError("This function can only be used for API Level < 29."); } static boolean d(Context context) { return context.getResources().getConfiguration().orientation == 2; } /* loaded from: classes.dex */ static class saX extends TouchDelegate { private final View a; private final Rect b; private final int c; private boolean d; private final Rect e; private final Rect g; public saX(Rect rect, Rect rect2, View view) { super(rect, view); this.c = ViewConfiguration.get(view.getContext()).getScaledTouchSlop(); this.g = new Rect(); this.e = new Rect(); this.b = new Rect(); jj_(rect, rect2); this.a = view; } public final void jj_(Rect rect, Rect rect2) { this.g.set(rect); this.e.set(rect); Rect rect3 = this.e; int i = -this.c; rect3.inset(i, i); this.b.set(rect2); } @Override // android.view.TouchDelegate public final boolean onTouchEvent(MotionEvent motionEvent) { boolean z; boolean z2; int x = (int) motionEvent.getX(); int y = (int) motionEvent.getY(); int action = motionEvent.getAction(); boolean z3 = true; if (action != 0) { if (action == 1 || action == 2) { z2 = this.d; if (z2 && !this.e.contains(x, y)) { z3 = z2; z = false; } } else { if (action == 3) { z2 = this.d; this.d = false; } z = true; z3 = false; } z3 = z2; z = true; } else { if (this.g.contains(x, y)) { this.d = true; z = true; } z = true; z3 = false; } if (!z3) { return false; } if (z && !this.b.contains(x, y)) { motionEvent.setLocation(this.a.getWidth() / 2, this.a.getHeight() / 2); } else { motionEvent.setLocation(x - this.b.left, y - this.b.top); } return this.a.dispatchTouchEvent(motionEvent); } } /* loaded from: classes.dex */ public static class SearchAutoComplete extends AppCompatAutoCompleteTextView { private int a; final Runnable b; SearchView d; boolean e; @Override // android.widget.AutoCompleteTextView public void performCompletion() { } @Override // android.widget.AutoCompleteTextView protected void replaceText(CharSequence charSequence) { } public SearchAutoComplete(Context context) { this(context, null); } public SearchAutoComplete(Context context, AttributeSet attributeSet) { this(context, attributeSet, SYO.IeS.autoCompleteTextViewStyle); } public SearchAutoComplete(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); this.b = new Runnable(this) { // from class: androidx.appcompat.widget.SearchView.SearchAutoComplete.1 final SearchAutoComplete a; { this.a = this; } @Override // java.lang.Runnable public final void run() { SearchAutoComplete searchAutoComplete = this.a; if (searchAutoComplete.e) { ((InputMethodManager) searchAutoComplete.getContext().getSystemService("input_method")).showSoftInput(searchAutoComplete, 0); searchAutoComplete.e = false; } } }; this.a = getThreshold(); } @Override // android.view.View protected void onFinishInflate() { super.onFinishInflate(); DisplayMetrics displayMetrics = getResources().getDisplayMetrics(); Configuration configuration = getResources().getConfiguration(); int i = configuration.screenWidthDp; int i2 = configuration.screenHeightDp; setMinWidth((int) TypedValue.applyDimension(1, (i < 960 || i2 < 720 || configuration.orientation != 2) ? (i >= 600 || (i >= 640 && i2 >= 480)) ? 192 : 160 : 256, displayMetrics)); } @Override // android.widget.AutoCompleteTextView public void setThreshold(int i) { super.setThreshold(i); this.a = i; } @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View public void onWindowFocusChanged(boolean z) { super.onWindowFocusChanged(z); if (z && this.d.hasFocus() && getVisibility() == 0) { this.e = true; if (SearchView.d(getContext())) { c(); } } } @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View protected void onFocusChanged(boolean z, int i, Rect rect) { super.onFocusChanged(z, i, rect); this.d.l(); } @Override // android.widget.AutoCompleteTextView public boolean enoughToFilter() { return this.a <= 0 || super.enoughToFilter(); } @Override // android.widget.AutoCompleteTextView, android.widget.TextView, android.view.View public boolean onKeyPreIme(int i, KeyEvent keyEvent) { if (i == 4) { if (keyEvent.getAction() == 0 && keyEvent.getRepeatCount() == 0) { KeyEvent.DispatcherState keyDispatcherState = getKeyDispatcherState(); if (keyDispatcherState != null) { keyDispatcherState.startTracking(keyEvent, this); } return true; } if (keyEvent.getAction() == 1) { KeyEvent.DispatcherState keyDispatcherState2 = getKeyDispatcherState(); if (keyDispatcherState2 != null) { keyDispatcherState2.handleUpEvent(keyEvent); } if (keyEvent.isTracking() && !keyEvent.isCanceled()) { this.d.clearFocus(); b(false); return true; } } } return super.onKeyPreIme(i, keyEvent); } @Override // androidx.appcompat.widget.AppCompatAutoCompleteTextView, android.widget.TextView, android.view.View public InputConnection onCreateInputConnection(EditorInfo editorInfo) { InputConnection onCreateInputConnection = super.onCreateInputConnection(editorInfo); if (this.e) { removeCallbacks(this.b); post(this.b); } return onCreateInputConnection; } final void b(boolean z) { InputMethodManager inputMethodManager = (InputMethodManager) getContext().getSystemService("input_method"); if (!z) { this.e = false; removeCallbacks(this.b); inputMethodManager.hideSoftInputFromWindow(getWindowToken(), 0); } else { if (!inputMethodManager.isActive(this)) { this.e = true; return; } this.e = false; removeCallbacks(this.b); inputMethodManager.showSoftInput(this, 0); } } final void c() { if (Build.VERSION.SDK_INT >= 29) { HBt.c(this, 1); if (enoughToFilter()) { showDropDown(); return; } return; } SearchView.e.ji_(this); } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class LWm { Method a; Method c; private Method e; LWm() { this.c = null; this.a = null; this.e = null; if (Build.VERSION.SDK_INT < 29) { try { Method declaredMethod = AutoCompleteTextView.class.getDeclaredMethod("doBeforeTextChanged", new Class[0]); this.c = declaredMethod; declaredMethod.setAccessible(true); } catch (NoSuchMethodException unused) { } try { Method declaredMethod2 = AutoCompleteTextView.class.getDeclaredMethod("doAfterTextChanged", new Class[0]); this.a = declaredMethod2; declaredMethod2.setAccessible(true); } catch (NoSuchMethodException unused2) { } try { Method method = AutoCompleteTextView.class.getMethod("ensureImeVisible", Boolean.TYPE); this.e = method; method.setAccessible(true); return; } catch (NoSuchMethodException unused3) { return; } } throw new UnsupportedClassVersionError("This function can only be used for API Level < 29."); } final void ji_(AutoCompleteTextView autoCompleteTextView) { if (Build.VERSION.SDK_INT >= 29) { throw new UnsupportedClassVersionError("This function can only be used for API Level < 29."); } Method method = this.e; if (method != null) { try { method.invoke(autoCompleteTextView, Boolean.TRUE); } catch (Exception unused) { } } } } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class HBt { static void c(SearchAutoComplete searchAutoComplete, int i) { searchAutoComplete.setInputMethodMode(i); } static void jh_(AutoCompleteTextView autoCompleteTextView) { autoCompleteTextView.refreshAutoCompleteResults(); } } private boolean d(int i) { Cursor cursor = this.k.d; if (cursor == null || !cursor.moveToPosition(i)) { return false; } Intent jf_ = jf_(cursor); if (jf_ == null) { return true; } try { getContext().startActivity(jf_); return true; } catch (RuntimeException unused) { return true; } } private void b(boolean z) { int i = 8; if (this.aa && !this.x && z) { this.c.setVisibility(8); i = 0; } this.q.setVisibility(i); } /* JADX INFO: Access modifiers changed from: protected */ @Override // androidx.appcompat.widget.LinearLayoutCompat, android.view.View public void onMeasure(int i, int i2) { int i3; if (this.x) { super.onMeasure(i, i2); return; } int mode = View.MeasureSpec.getMode(i); int size = View.MeasureSpec.getSize(i); if (mode == Integer.MIN_VALUE) { int i4 = this.v; size = i4 > 0 ? Math.min(i4, size) : Math.min(getContext().getResources().getDimensionPixelSize(SYO.Sts.abc_search_view_preferred_width), size); } else if (mode == 0) { size = this.v; if (size <= 0) { size = getContext().getResources().getDimensionPixelSize(SYO.Sts.abc_search_view_preferred_width); } } else if (mode == 1073741824 && (i3 = this.v) > 0) { size = Math.min(i3, size); } int mode2 = View.MeasureSpec.getMode(i2); int size2 = View.MeasureSpec.getSize(i2); if (mode2 == Integer.MIN_VALUE) { size2 = Math.min(getContext().getResources().getDimensionPixelSize(SYO.Sts.abc_search_view_preferred_height), size2); } else if (mode2 == 0) { size2 = getContext().getResources().getDimensionPixelSize(SYO.Sts.abc_search_view_preferred_height); } super.onMeasure(View.MeasureSpec.makeMeasureSpec(size, 1073741824), View.MeasureSpec.makeMeasureSpec(size2, 1073741824)); } final void l() { d(this.x); post(this.W); if (this.i.hasFocus()) { i(); } } public void setQueryHint(CharSequence charSequence) { this.I = charSequence; CharSequence q = q(); SearchAutoComplete searchAutoComplete = this.i; if (q == null) { q = ""; } searchAutoComplete.setHint(b(q)); } public void setSubmitButtonEnabled(boolean z) { this.P = z; d(this.x); } static void n() { ab = (byte) 6; } public void setOnSuggestionListener(IeS ieS) { this.j = ieS; } public void setOnSearchClickListener(View.OnClickListener onClickListener) { this.G = onClickListener; } public void setOnQueryTextListener(RVV rvv) { this.H = rvv; } public void setOnQueryTextFocusChangeListener(View.OnFocusChangeListener onFocusChangeListener) { this.h = onFocusChangeListener; } public void setOnCloseListener(Sts sts) { this.B = sts; } public void setAppSearchData(Bundle bundle) { this.p = bundle; } }