what-the-bank/sources/com/google/android/material/navigation/NavigationBarMenuView.java

470 lines
16 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.material.navigation;
import android.R;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.util.SparseArray;
import android.util.TypedValue;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.accessibility.AccessibilityNodeInfo;
import androidx.appcompat.view.menu.MenuItemImpl;
import androidx.core.view.ViewCompat;
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.HashSet;
import o.AgY;
import o.Bml;
import o.C17052tZT;
import o.C1915aRv;
import o.C4363bXv;
import o.C5745byp;
import o.C6217cMa;
import o.DAZ;
import o.FLD;
import o.NoP;
import o.QJQ;
import o.RDy;
import o.RZN;
import o.SYO;
import o.Sya;
import o.kin;
/* loaded from: classes2.dex */
public abstract class NavigationBarMenuView extends ViewGroup implements Sya {
private static final int[] a = {R.attr.state_checked};
private static final int[] i = {-16842910};
private int A;
private final View.OnClickListener B;
private final ColorStateList C;
private final SparseArray<View.OnTouchListener> D;
private final Bml G;
public final SparseArray<C5745byp> b;
public NoP c;
public int d;
public NavigationBarItemView[] e;
public int f;
private ColorStateList g;
public int h;
QJQ j;
private boolean k;
private boolean l;
private int m;
private int n;
/* renamed from: o, reason: collision with root package name */
private FLD f6478o;
private ColorStateList p;
private Drawable q;
private int r;
private int s;
private int t;
private ColorStateList u;
private int v;
private int w;
private int x;
private final RDy.Sts<NavigationBarItemView> y;
private ColorStateList z;
protected abstract NavigationBarItemView a(Context context);
public NavigationBarMenuView(Context context) {
super(context);
this.y = new RDy.LWm(5);
this.D = new SparseArray<>(5);
this.f = 0;
this.h = 0;
this.b = new SparseArray<>(5);
this.w = -1;
this.x = -1;
this.l = false;
this.C = Kl_();
if (isInEditMode()) {
this.G = null;
} else {
RZN rzn = new RZN();
this.G = rzn;
rzn.b(0);
rzn.c(DAZ.a(getContext(), C17052tZT.IeS.motionDurationMedium4, getResources().getInteger(C17052tZT.saX.material_motion_duration_long_1)));
rzn.Bj_(DAZ.Kh_(getContext(), C17052tZT.IeS.motionEasingStandard, C6217cMa.d));
rzn.d(new C1915aRv());
}
this.B = new View.OnClickListener(this) { // from class: com.google.android.material.navigation.NavigationBarMenuView.1
private NavigationBarMenuView e;
{
this.e = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
MenuItemImpl menuItemImpl = ((NavigationBarItemView) view).g;
if (this.e.c.eM_(menuItemImpl, this.e.j, 0)) {
return;
}
menuItemImpl.setChecked(true);
}
};
ViewCompat.g(this, 1);
}
@Override // android.view.View
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo accessibilityNodeInfo) {
super.onInitializeAccessibilityNodeInfo(accessibilityNodeInfo);
AccessibilityNodeInfoCompat.tU_(accessibilityNodeInfo).e(AccessibilityNodeInfoCompat.CollectionInfoCompat.e(1, this.c.d().size(), false, 1));
}
public void setIconTintList(ColorStateList colorStateList) {
this.p = colorStateList;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setIconTintList(colorStateList);
}
}
}
public void setItemIconSize(int i2) {
this.s = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setIconSize(i2);
}
}
}
public void setItemTextColor(ColorStateList colorStateList) {
this.z = colorStateList;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setTextColor(colorStateList);
}
}
}
public void setItemTextAppearanceInactive(int i2) {
this.A = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setTextAppearanceInactive(i2);
ColorStateList colorStateList = this.z;
if (colorStateList != null) {
navigationBarItemView.setTextColor(colorStateList);
}
}
}
}
public void setItemTextAppearanceActive(int i2) {
this.v = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setTextAppearanceActive(i2);
ColorStateList colorStateList = this.z;
if (colorStateList != null) {
navigationBarItemView.setTextColor(colorStateList);
}
}
}
}
public void setItemBackgroundRes(int i2) {
this.t = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setItemBackground(i2);
}
}
}
public void setItemPaddingTop(int i2) {
this.w = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setItemPaddingTop(i2);
}
}
}
public void setItemPaddingBottom(int i2) {
this.x = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setItemPaddingBottom(i2);
}
}
}
public void setItemActiveIndicatorEnabled(boolean z) {
this.k = z;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorEnabled(z);
}
}
}
public void setItemActiveIndicatorWidth(int i2) {
this.r = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorWidth(i2);
}
}
}
public void setItemActiveIndicatorHeight(int i2) {
this.n = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorHeight(i2);
}
}
}
public void setItemActiveIndicatorMarginHorizontal(int i2) {
this.m = i2;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorMarginHorizontal(i2);
}
}
}
public void setItemActiveIndicatorShapeAppearance(FLD fld) {
this.f6478o = fld;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorDrawable(Kk_());
}
}
}
public void setItemActiveIndicatorColor(ColorStateList colorStateList) {
this.g = colorStateList;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setActiveIndicatorDrawable(Kk_());
}
}
}
private Drawable Kk_() {
if (this.f6478o == null || this.g == null) {
return null;
}
C4363bXv c4363bXv = new C4363bXv(this.f6478o);
ColorStateList colorStateList = this.g;
if (c4363bXv.B.d != colorStateList) {
c4363bXv.B.d = colorStateList;
c4363bXv.onStateChange(c4363bXv.getState());
}
return c4363bXv;
}
public void setItemBackground(Drawable drawable) {
this.q = drawable;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setItemBackground(drawable);
}
}
}
public void setItemRippleColor(ColorStateList colorStateList) {
this.u = colorStateList;
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
navigationBarItemView.setItemRippleColor(colorStateList);
}
}
}
public void setItemOnTouchListener(int i2, View.OnTouchListener onTouchListener) {
if (onTouchListener == null) {
this.D.remove(i2);
} else {
this.D.put(i2, onTouchListener);
}
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
if (navigationBarItemView.g.getItemId() == i2) {
navigationBarItemView.setOnTouchListener(onTouchListener);
}
}
}
}
public final ColorStateList Kl_() {
TypedValue typedValue = new TypedValue();
if (!getContext().getTheme().resolveAttribute(R.attr.textColorSecondary, typedValue, true)) {
return null;
}
ColorStateList dS_ = AgY.dS_(getContext(), typedValue.resourceId);
if (!getContext().getTheme().resolveAttribute(SYO.IeS.colorPrimary, typedValue, true)) {
return null;
}
int i2 = typedValue.data;
int defaultColor = dS_.getDefaultColor();
int[] iArr = i;
return new ColorStateList(new int[][]{iArr, a, EMPTY_STATE_SET}, new int[]{dS_.getColorForState(iArr, defaultColor), i2, defaultColor});
}
public final void c() {
C5745byp c5745byp;
removeAllViews();
NavigationBarItemView[] navigationBarItemViewArr = this.e;
if (navigationBarItemViewArr != null) {
for (NavigationBarItemView navigationBarItemView : navigationBarItemViewArr) {
if (navigationBarItemView != null) {
this.y.d(navigationBarItemView);
navigationBarItemView.a(navigationBarItemView.e);
navigationBarItemView.g = null;
navigationBarItemView.d = BitmapDescriptorFactory.HUE_RED;
navigationBarItemView.j = false;
}
}
}
if (this.c.size() == 0) {
this.f = 0;
this.h = 0;
this.e = null;
return;
}
HashSet hashSet = new HashSet();
for (int i2 = 0; i2 < this.c.size(); i2++) {
hashSet.add(Integer.valueOf(this.c.getItem(i2).getItemId()));
}
for (int i3 = 0; i3 < this.b.size(); i3++) {
int keyAt = this.b.keyAt(i3);
if (!hashSet.contains(Integer.valueOf(keyAt))) {
this.b.delete(keyAt);
}
}
this.e = new NavigationBarItemView[this.c.size()];
int i4 = this.d;
boolean z = i4 != -1 ? i4 == 0 : this.c.d().size() > 3;
for (int i5 = 0; i5 < this.c.size(); i5++) {
this.j.d = true;
this.c.getItem(i5).setCheckable(true);
this.j.d = false;
NavigationBarItemView d = this.y.d();
if (d == null) {
d = a(getContext());
}
this.e[i5] = d;
d.setIconTintList(this.p);
d.setIconSize(this.s);
d.setTextColor(this.C);
d.setTextAppearanceInactive(this.A);
d.setTextAppearanceActive(this.v);
d.setTextColor(this.z);
int i6 = this.w;
if (i6 != -1) {
d.setItemPaddingTop(i6);
}
int i7 = this.x;
if (i7 != -1) {
d.setItemPaddingBottom(i7);
}
d.setActiveIndicatorWidth(this.r);
d.setActiveIndicatorHeight(this.n);
d.setActiveIndicatorMarginHorizontal(this.m);
d.setActiveIndicatorDrawable(Kk_());
d.setActiveIndicatorResizeable(false);
d.setActiveIndicatorEnabled(this.k);
Drawable drawable = this.q;
if (drawable != null) {
d.setItemBackground(drawable);
} else {
d.setItemBackground(this.t);
}
d.setItemRippleColor(this.u);
d.setShifting(z);
d.setLabelVisibilityMode(this.d);
MenuItemImpl menuItemImpl = (MenuItemImpl) this.c.getItem(i5);
d.c(menuItemImpl);
d.setItemPosition(i5);
int itemId = menuItemImpl.getItemId();
d.setOnTouchListener(this.D.get(itemId));
d.setOnClickListener(this.B);
int i8 = this.f;
if (i8 != 0 && itemId == i8) {
this.h = i5;
}
int id = d.getId();
if (id != -1 && (c5745byp = this.b.get(id)) != null) {
d.b(c5745byp);
}
addView(d);
}
int min = Math.min(this.c.size() - 1, this.h);
this.h = min;
this.c.getItem(min).setChecked(true);
}
public final void e() {
Bml bml;
NoP noP = this.c;
if (noP == null || this.e == null) {
return;
}
int size = noP.size();
if (size != this.e.length) {
c();
return;
}
int i2 = this.f;
for (int i3 = 0; i3 < size; i3++) {
MenuItem item = this.c.getItem(i3);
if (item.isChecked()) {
this.f = item.getItemId();
this.h = i3;
}
}
if (i2 != this.f && (bml = this.G) != null) {
kin.Bh_(this, bml);
}
int i4 = this.d;
boolean z = i4 != -1 ? i4 == 0 : this.c.d().size() > 3;
for (int i5 = 0; i5 < size; i5++) {
this.j.d = true;
this.e[i5].setLabelVisibilityMode(this.d);
this.e[i5].setShifting(z);
this.e[i5].c((MenuItemImpl) this.c.getItem(i5));
this.j.d = false;
}
}
public void setPresenter(QJQ qjq) {
this.j = qjq;
}
public void setLabelVisibilityMode(int i2) {
this.d = i2;
}
@Override // o.Sya
public final void a(NoP noP) {
this.c = noP;
}
}