what-the-bank/sources/com/google/android/material/snackbar/Snackbar.java

283 lines
11 KiB
Java

package com.google.android.material.snackbar;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
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.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityManager;
import android.widget.Button;
import android.widget.FrameLayout;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import com.google.android.material.snackbar.BaseTransientBottomBar;
import com.google.android.material.snackbar.Snackbar;
import java.nio.charset.StandardCharsets;
import o.C17052tZT;
import o.InterfaceC15708htK;
/* loaded from: classes2.dex */
public final class Snackbar extends BaseTransientBottomBar<Snackbar> {
private static byte p = 0;
private static final int[] s;
private static int v = 0;
private static int w = 1;
private final AccessibilityManager q;
private boolean r;
private static 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] ^ p);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
static {
i();
int i = C17052tZT.IeS.snackbarButtonStyle;
s = new int[]{C17052tZT.IeS.snackbarButtonStyle, C17052tZT.IeS.snackbarTextViewStyle};
}
private Snackbar(Context context, ViewGroup viewGroup, View view, InterfaceC15708htK interfaceC15708htK) {
super(context, viewGroup, view, interfaceC15708htK);
this.q = (AccessibilityManager) viewGroup.getContext().getSystemService("accessibility");
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar
public final void h() {
super.h();
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar
public final void a() {
super.a();
}
public static Snackbar a(View view, CharSequence charSequence, int i) {
int i2;
ViewGroup LK_ = LK_(view);
if (LK_ == null) {
throw new IllegalArgumentException("No suitable parent found from the given view. Please provide a valid view.");
}
Context context = LK_.getContext();
LayoutInflater from = LayoutInflater.from(context);
if (a(context)) {
i2 = C17052tZT.tOB.mtrl_layout_snackbar_include;
} else {
i2 = C17052tZT.tOB.design_layout_snackbar_include;
}
SnackbarContentLayout snackbarContentLayout = (SnackbarContentLayout) from.inflate(i2, LK_, false);
Snackbar snackbar = new Snackbar(context, LK_, snackbarContentLayout, snackbarContentLayout);
((SnackbarContentLayout) snackbar.t.getChildAt(0)).c.setText(charSequence);
snackbar.e(i);
return snackbar;
}
private static boolean a(Context context) {
TypedArray obtainStyledAttributes = context.obtainStyledAttributes(s);
int resourceId = obtainStyledAttributes.getResourceId(0, -1);
int resourceId2 = obtainStyledAttributes.getResourceId(1, -1);
obtainStyledAttributes.recycle();
return (resourceId == -1 || resourceId2 == -1) ? false : true;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [android.text.SpannableString, android.text.Spannable] */
public static Snackbar a(View view, int i) {
int i2 = 2 % 2;
int i3 = v + 123;
w = i3 % 128;
int i4 = i3 % 2;
Resources resources = view.getResources();
String string = resources.getString(i);
if (!(!string.startsWith(",*,)"))) {
Object[] objArr = new Object[1];
E(string.substring(4), objArr);
string = ((String) objArr[0]).intern();
CharSequence text = resources.getText(i);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(string);
TextUtils.copySpansFrom((SpannedString) text, 0, string.length(), Object.class, spannableString, 0);
string = spannableString;
} else {
int i5 = w + 73;
v = i5 % 128;
int i6 = i5 % 2;
}
}
return a(view, string, -2);
}
private static ViewGroup LK_(View view) {
ViewGroup viewGroup = null;
while (!(view instanceof CoordinatorLayout)) {
if (view instanceof FrameLayout) {
if (view.getId() == 16908290) {
return (ViewGroup) view;
}
viewGroup = (ViewGroup) view;
}
if (view != null) {
Object parent = view.getParent();
view = parent instanceof View ? (View) parent : null;
}
if (view == null) {
return viewGroup;
}
}
return (ViewGroup) view;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v8, types: [android.text.SpannableString, android.text.Spannable] */
public final Snackbar LM_(int i, final View.OnClickListener onClickListener) {
int i2 = 2 % 2;
int i3 = w + 63;
v = i3 % 128;
int i4 = i3 % 2;
Context context = this.h;
String string = context.getString(i);
if (string.startsWith(",*,)")) {
int i5 = w + 107;
v = i5 % 128;
int i6 = i5 % 2;
String substring = string.substring(4);
Object[] objArr = new Object[1];
E(substring, 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);
string = spannableString;
}
}
Button button = ((SnackbarContentLayout) this.t.getChildAt(0)).d;
if (TextUtils.isEmpty(string)) {
button.setVisibility(8);
button.setOnClickListener(null);
this.r = false;
} else {
this.r = true;
button.setVisibility(0);
button.setText(string);
button.setOnClickListener(new View.OnClickListener(this, onClickListener) { // from class: o.MnB
private View.OnClickListener a;
private Snackbar e;
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
this.e.LL_(this.a, view);
}
{
this.e = this;
this.a = onClickListener;
}
});
}
return this;
}
public final /* synthetic */ void LL_(View.OnClickListener onClickListener, View view) {
onClickListener.onClick(view);
c();
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar
public final int d() {
int d = super.d();
if (d == -2) {
return -2;
}
try {
if (Build.VERSION.SDK_INT >= 29) {
return ((Integer) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("getRecommendedTimeoutMillis", Integer.TYPE, Integer.TYPE).invoke(this.q, Integer.valueOf(d), Integer.valueOf((this.r ? 4 : 0) | 3))).intValue();
}
if (this.r && ((Boolean) Class.forName("android.view.accessibility.AccessibilityManager").getMethod("isTouchExplorationEnabled", null).invoke(this.q, null)).booleanValue()) {
return -2;
}
return d;
} catch (Throwable th) {
Throwable cause = th.getCause();
if (cause != null) {
throw cause;
}
throw th;
}
}
/* loaded from: classes2.dex */
public static final class SnackbarLayout extends BaseTransientBottomBar.SnackbarBaseLayout {
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setBackground(Drawable drawable) {
super.setBackground(drawable);
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setBackgroundDrawable(Drawable drawable) {
super.setBackgroundDrawable(drawable);
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setBackgroundTintList(ColorStateList colorStateList) {
super.setBackgroundTintList(colorStateList);
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setBackgroundTintMode(PorterDuff.Mode mode) {
super.setBackgroundTintMode(mode);
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setLayoutParams(ViewGroup.LayoutParams layoutParams) {
super.setLayoutParams(layoutParams);
}
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.view.View
public final /* bridge */ /* synthetic */ void setOnClickListener(View.OnClickListener onClickListener) {
super.setOnClickListener(onClickListener);
}
public SnackbarLayout(Context context) {
super(context);
}
public SnackbarLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
}
/* JADX INFO: Access modifiers changed from: protected */
@Override // com.google.android.material.snackbar.BaseTransientBottomBar.SnackbarBaseLayout, android.widget.FrameLayout, android.view.View
public final void onMeasure(int i, int i2) {
super.onMeasure(i, i2);
int childCount = getChildCount();
int measuredWidth = getMeasuredWidth();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
for (int i3 = 0; i3 < childCount; i3++) {
View childAt = getChildAt(i3);
if (childAt.getLayoutParams().width == -1) {
childAt.measure(View.MeasureSpec.makeMeasureSpec((measuredWidth - paddingLeft) - paddingRight, 1073741824), View.MeasureSpec.makeMeasureSpec(childAt.getMeasuredHeight(), 1073741824));
}
}
}
}
static void i() {
p = (byte) 6;
}
}