what-the-bank/sources/com/google/android/material/search/SearchView.java

637 lines
23 KiB
Java

package com.google.android.material.search;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.text.Editable;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.SpannedString;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.util.Base64;
import android.view.Menu;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.EditText;
import android.widget.FrameLayout;
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.MaterialToolbar;
import com.google.android.material.internal.ClippableRoundedCornerLayout;
import com.google.android.material.internal.TouchObserverFrameLayout;
import com.google.android.material.search.SearchBar;
import com.google.android.material.search.SearchView;
import java.nio.charset.StandardCharsets;
import java.util.HashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import o.AgY;
import o.C15753iLf;
import o.C17052tZT;
import o.C3441axc;
import o.C4363bXv;
import o.Lot;
import o.Tlu;
import o.XgG;
import o.ZVM;
import o.weT;
import o.zJx;
/* loaded from: classes2.dex */
public class SearchView extends FrameLayout implements CoordinatorLayout.IeS {
private static int B = 0;
private static byte D = 0;
private static final int x;
private static int z = 1;
private final Set<Sts> A;
private final boolean C;
public final ImageButton a;
public boolean b;
public boolean c;
public boolean d;
public final TouchObserverFrameLayout e;
public final View f;
public RVV g;
public final EditText h;
public final Toolbar i;
public final FrameLayout j;
public final TextView k;
public final View l;
public final zJx m;
public SearchBar n;
/* renamed from: o, reason: collision with root package name */
public final ClippableRoundedCornerLayout f6479o;
public boolean p;
public final FrameLayout q;
public final MaterialToolbar r;
public int s;
public final View t;
private final weT u;
private View v;
public boolean w;
private Map<View, Integer> y;
/* loaded from: classes2.dex */
public enum RVV {
HIDING,
HIDDEN,
SHOWING,
SHOWN
}
/* loaded from: classes2.dex */
public interface Sts {
}
private void E(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] ^ D);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
static {
b();
x = C17052tZT.NHB.Widget_Material3_SearchView;
}
public SearchView(Context context) {
this(context, null);
}
public SearchView(Context context, AttributeSet attributeSet) {
this(context, attributeSet, C17052tZT.IeS.materialSearchViewStyle);
}
/* 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 SearchView(android.content.Context r18, android.util.AttributeSet r19, int r20) {
/*
Method dump skipped, instructions count: 476
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.search.SearchView.<init>(android.content.Context, android.util.AttributeSet, int):void");
}
@Override // android.view.ViewGroup
public void addView(View view, int i, ViewGroup.LayoutParams layoutParams) {
if (this.C) {
this.e.addView(view, i, layoutParams);
} else {
super.addView(view, i, layoutParams);
}
}
@Override // android.view.View
protected void onFinishInflate() {
Activity activity;
super.onFinishInflate();
Context context = getContext();
while (true) {
if (!(context instanceof ContextWrapper)) {
activity = null;
break;
} else {
if (context instanceof Activity) {
activity = (Activity) context;
break;
}
context = ((ContextWrapper) context).getBaseContext();
}
}
Window window = activity != null ? activity.getWindow() : null;
if (window != null) {
this.s = window.getAttributes().softInputMode;
}
}
@Override // android.view.View
public void setElevation(float f) {
super.setElevation(f);
d(f);
}
@Override // android.view.ViewGroup, android.view.View
protected void onAttachedToWindow() {
super.onAttachedToWindow();
Drawable background = getBackground();
if (background instanceof C4363bXv) {
C4363bXv c4363bXv = (C4363bXv) background;
if (c4363bXv.B.c == null || !c4363bXv.B.c.a) {
return;
}
c4363bXv.k(Lot.e(this));
}
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.IeS
public final CoordinatorLayout.Sts<SearchView> a() {
return new Behavior();
}
private void d(float f) {
weT wet = this.u;
if (wet == null || this.v == null) {
return;
}
this.v.setBackgroundColor(wet.c(wet.d, f));
}
private float d() {
SearchBar searchBar = this.n;
if (searchBar != null) {
C4363bXv c4363bXv = searchBar.y;
if (c4363bXv == null) {
return ViewCompat.i(searchBar);
}
return c4363bXv.B.e;
}
return getResources().getDimension(C17052tZT.HBt.m3_searchview_elevation);
}
public final void e(int i) {
if (this.t.getLayoutParams().height != i) {
this.t.getLayoutParams().height = i;
this.t.requestLayout();
}
}
public void setOnMenuItemClickListener(Toolbar.HBt hBt) {
this.r.setOnMenuItemClickListener(hBt);
}
public void setSearchPrefixText(CharSequence charSequence) {
this.k.setText(charSequence);
this.k.setVisibility(TextUtils.isEmpty(charSequence) ? 8 : 0);
}
public void setText(CharSequence charSequence) {
this.h.setText(charSequence);
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r2v3, types: [android.text.SpannableString, android.text.Spannable] */
public void setText(int i) {
int i2 = 2 % 2;
int i3 = B + 103;
z = i3 % 128;
int i4 = i3 % 2;
EditText editText = this.h;
Context context = editText.getContext();
String string = context.getString(i);
if (string.startsWith(",*,)")) {
Object[] objArr = new Object[1];
E(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
CharSequence text = context.getText(i);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(string);
TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0);
int i5 = B + 41;
z = i5 % 128;
int i6 = i5 % 2;
string = spannableString;
}
}
editText.setText(string);
}
public void setHint(CharSequence charSequence) {
this.h.setHint(charSequence);
}
public void setHint(int i) {
this.h.setHint(i);
}
public void setStatusBarSpacerEnabled(boolean z2) {
this.p = true;
this.t.setVisibility(z2 ? 0 : 8);
}
public final void e(RVV rvv) {
if (this.g.equals(rvv)) {
return;
}
this.g = rvv;
for (Sts sts : new LinkedHashSet(this.A)) {
}
}
public void setVisible(boolean z2) {
boolean z3 = this.f6479o.getVisibility() == 0;
this.f6479o.setVisibility(z2 ? 0 : 8);
c();
if (z3 != z2) {
setModalForAccessibility(z2);
}
e(z2 ? RVV.SHOWN : RVV.HIDDEN);
}
private void c() {
ImageButton Ke_ = C15753iLf.Ke_(this.r);
if (Ke_ == null) {
return;
}
int i = this.f6479o.getVisibility() == 0 ? 1 : 0;
Drawable pH_ = Tlu.pH_(Ke_.getDrawable());
if (pH_ instanceof ZVM) {
ZVM zvm = (ZVM) pH_;
float f = i;
if (zvm.b != f) {
zvm.b = f;
zvm.invalidateSelf();
}
}
if (pH_ instanceof C3441axc) {
((C3441axc) pH_).e(i);
}
}
public void setModalForAccessibility(boolean z2) {
ViewGroup viewGroup = (ViewGroup) getRootView();
if (z2) {
this.y = new HashMap(viewGroup.getChildCount());
}
KJ_(viewGroup, z2);
if (z2) {
return;
}
this.y = null;
}
public void setToolbarTouchscreenBlocksFocus(boolean z2) {
this.r.setTouchscreenBlocksFocus(z2);
}
private void KJ_(ViewGroup viewGroup, boolean z2) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View childAt = viewGroup.getChildAt(i);
if (childAt != this) {
if (childAt.findViewById(this.f6479o.getId()) != null) {
KJ_((ViewGroup) childAt, z2);
} else if (!z2) {
Map<View, Integer> map = this.y;
if (map != null && map.containsKey(childAt)) {
ViewCompat.g(childAt, this.y.get(childAt).intValue());
}
} else {
this.y.put(childAt, Integer.valueOf(childAt.getImportantForAccessibility()));
ViewCompat.g(childAt, 4);
}
}
}
}
/* loaded from: classes2.dex */
public static class Behavior extends CoordinatorLayout.Sts<SearchView> {
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final /* synthetic */ boolean e(CoordinatorLayout coordinatorLayout, SearchView searchView, View view) {
SearchView searchView2 = searchView;
if (searchView2.n != null || !(view instanceof SearchBar)) {
return false;
}
searchView2.setupWithSearchBar((SearchBar) view);
return false;
}
public Behavior() {
}
public Behavior(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
}
@Override // android.view.View
protected Parcelable onSaveInstanceState() {
IeS ieS = new IeS(super.onSaveInstanceState());
Editable text = this.h.getText();
ieS.d = text == null ? null : text.toString();
ieS.e = this.f6479o.getVisibility();
return ieS;
}
@Override // android.view.View
protected void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof IeS)) {
super.onRestoreInstanceState(parcelable);
return;
}
IeS ieS = (IeS) parcelable;
super.onRestoreInstanceState(ieS.b);
setText(ieS.d);
setVisible(ieS.e == 0);
}
/* loaded from: classes2.dex */
static class IeS extends XgG {
public static final Parcelable.Creator<IeS> CREATOR = new Parcelable.ClassLoaderCreator<IeS>() { // from class: com.google.android.material.search.SearchView.IeS.4
@Override // android.os.Parcelable.Creator
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
return new IeS(parcel);
}
@Override // android.os.Parcelable.ClassLoaderCreator
public final /* synthetic */ IeS createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new IeS(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new IeS[i];
}
};
String d;
int e;
public IeS(Parcel parcel) {
this(parcel, null);
}
public IeS(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.d = parcel.readString();
this.e = parcel.readInt();
}
public IeS(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.d);
parcel.writeInt(this.e);
}
}
public void setupWithSearchBar(SearchBar searchBar) {
this.n = searchBar;
this.m.d = searchBar;
if (searchBar != null) {
searchBar.setOnClickListener(new View.OnClickListener(this) { // from class: o.LKz
private SearchView b;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
SearchView searchView = this.b;
if (searchView.g.equals(SearchView.RVV.SHOWN) || searchView.g.equals(SearchView.RVV.SHOWING)) {
return;
}
final zJx zjx = searchView.m;
if (zjx.d != null) {
if (zjx.a.s == 48) {
SearchView searchView2 = zjx.a;
if (searchView2.b) {
searchView2.h.postDelayed(new tEh(searchView2), 100L);
}
}
zjx.a.e(SearchView.RVV.SHOWING);
Menu jO_ = zjx.e.jO_();
if (jO_ != null) {
jO_.clear();
}
if (zjx.d.x != -1 && zjx.a.c) {
zjx.e.a(zjx.d.x);
ActionMenuView c = C15753iLf.c(zjx.e);
if (c != null) {
for (int i = 0; i < c.getChildCount(); i++) {
View childAt = c.getChildAt(i);
childAt.setClickable(false);
childAt.setFocusable(false);
childAt.setFocusableInTouchMode(false);
}
}
zjx.e.setVisibility(0);
} else {
zjx.e.setVisibility(8);
}
zjx.b.setText(zjx.d.u.getText());
EditText editText = zjx.b;
editText.setSelection(editText.getText().length());
zjx.c.setVisibility(4);
zjx.c.post(new Runnable(zjx) { // from class: o.CfT
private zJx e;
@Override // java.lang.Runnable
public final void run() {
zJx zjx2 = this.e;
AnimatorSet KQ_ = zjx2.KQ_(true);
KQ_.addListener(new AnimatorListenerAdapter(zjx2) { // from class: o.zJx.5
private zJx c;
/* JADX INFO: Access modifiers changed from: package-private */
{
this.c = zjx2;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
if (this.c.a.s != 48) {
SearchView searchView3 = this.c.a;
if (searchView3.b) {
searchView3.h.postDelayed(new tEh(searchView3), 100L);
}
}
this.c.a.e(SearchView.RVV.SHOWN);
}
/* JADX WARN: Multi-variable type inference failed */
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.c.c.setVisibility(0);
SearchBar searchBar2 = this.c.d;
C16470ofD c16470ofD = searchBar2.w;
Animator animator2 = c16470ofD.a;
Animator animator3 = c16470ofD.e;
View view2 = searchBar2.v;
if (view2 instanceof qEs) {
}
if (view2 != 0) {
view2.setAlpha(BitmapDescriptorFactory.HUE_RED);
}
}
});
KQ_.start();
}
{
this.e = zjx;
}
});
} else {
if (zjx.a.s == 48) {
final SearchView searchView3 = zjx.a;
Objects.requireNonNull(searchView3);
searchView3.postDelayed(new Runnable(searchView3) { // from class: o.jKg
private SearchView e;
@Override // java.lang.Runnable
public final void run() {
SearchView searchView4 = this.e;
if (searchView4.b) {
searchView4.h.postDelayed(new tEh(searchView4), 100L);
}
}
{
this.e = searchView3;
}
}, 150L);
}
zjx.c.setVisibility(4);
zjx.c.post(new Runnable(zjx) { // from class: o.xPR
private zJx d;
@Override // java.lang.Runnable
public final void run() {
zJx zjx2 = this.d;
zjx2.c.setTranslationY(r1.getHeight());
AnimatorSet KT_ = zjx2.KT_(true);
KT_.addListener(new AnimatorListenerAdapter(zjx2) { // from class: o.zJx.1
private zJx c;
/* JADX INFO: Access modifiers changed from: package-private */
{
this.c = zjx2;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator) {
if (this.c.a.s != 48) {
SearchView searchView4 = this.c.a;
if (searchView4.b) {
searchView4.h.postDelayed(new tEh(searchView4), 100L);
}
}
this.c.a.e(SearchView.RVV.SHOWN);
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.c.c.setVisibility(0);
this.c.a.e(SearchView.RVV.SHOWING);
}
});
KT_.start();
}
{
this.d = zjx;
}
});
}
searchView.setModalForAccessibility(true);
}
{
this.b = this;
}
});
}
MaterialToolbar materialToolbar = this.r;
if (materialToolbar != null) {
ImageButton imageButton = materialToolbar.j;
if (!(Tlu.pH_(imageButton != null ? imageButton.getDrawable() : null) instanceof ZVM)) {
int i = C17052tZT.LWm.ic_arrow_back_black_24;
if (this.n == null) {
this.r.setNavigationIcon(i);
} else {
Drawable pI_ = Tlu.pI_(AgY.dT_(getContext(), i).mutate());
if (this.r.s != null) {
Tlu.pE_(pI_, this.r.s.intValue());
}
MaterialToolbar materialToolbar2 = this.r;
ImageButton imageButton2 = this.n.j;
materialToolbar2.setNavigationIcon(new C3441axc(imageButton2 != null ? imageButton2.getDrawable() : null, pI_));
c();
}
}
}
d(d());
}
static void b() {
D = (byte) 6;
}
public void setUseWindowInsetsController(boolean z2) {
this.w = z2;
}
public void setMenuItemsAnimated(boolean z2) {
this.c = z2;
}
public void setAutoShowKeyboard(boolean z2) {
this.b = z2;
}
public void setAnimatedNavigationIcon(boolean z2) {
this.d = z2;
}
}