413 lines
16 KiB
Java
413 lines
16 KiB
Java
|
package com.google.android.material.navigation;
|
||
|
|
||
|
import android.content.Context;
|
||
|
import android.content.res.ColorStateList;
|
||
|
import android.content.res.TypedArray;
|
||
|
import android.graphics.drawable.ColorDrawable;
|
||
|
import android.graphics.drawable.Drawable;
|
||
|
import android.os.Bundle;
|
||
|
import android.os.Parcel;
|
||
|
import android.os.Parcelable;
|
||
|
import android.util.AttributeSet;
|
||
|
import android.util.SparseArray;
|
||
|
import android.view.MenuInflater;
|
||
|
import android.view.MenuItem;
|
||
|
import android.view.View;
|
||
|
import android.widget.FrameLayout;
|
||
|
import androidx.core.view.ViewCompat;
|
||
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
||
|
import com.scb.phone.R;
|
||
|
import java.lang.ref.WeakReference;
|
||
|
import java.util.Iterator;
|
||
|
import o.C0683McA;
|
||
|
import o.C14739fyr;
|
||
|
import o.C17052tZT;
|
||
|
import o.C17525xWe;
|
||
|
import o.C4363bXv;
|
||
|
import o.C5745byp;
|
||
|
import o.FLD;
|
||
|
import o.InterfaceC15933jjG;
|
||
|
import o.JHJ;
|
||
|
import o.Lot;
|
||
|
import o.NoP;
|
||
|
import o.QJQ;
|
||
|
import o.Tlu;
|
||
|
import o.Vnx;
|
||
|
import o.XgG;
|
||
|
import o.hdZ;
|
||
|
import o.uqW;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public abstract class NavigationBarView extends FrameLayout {
|
||
|
RVV a;
|
||
|
HBt b;
|
||
|
private final Vnx c;
|
||
|
private MenuInflater d;
|
||
|
public final NavigationBarMenuView e;
|
||
|
private final QJQ g;
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public interface HBt {
|
||
|
void XQ_(MenuItem menuItem);
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
public interface RVV {
|
||
|
boolean adS_(MenuItem menuItem);
|
||
|
}
|
||
|
|
||
|
public abstract int c();
|
||
|
|
||
|
protected abstract NavigationBarMenuView d(Context context);
|
||
|
|
||
|
public NavigationBarView(Context context, AttributeSet attributeSet, int i, int i2) {
|
||
|
super(hdZ.MQ_(context, attributeSet, i, i2), attributeSet, i);
|
||
|
ColorStateList valueOf;
|
||
|
QJQ qjq = new QJQ();
|
||
|
this.g = qjq;
|
||
|
Context context2 = getContext();
|
||
|
C0683McA Kd_ = uqW.Kd_(context2, attributeSet, C17052tZT.jNh.NavigationBarView, i, i2, C17052tZT.jNh.NavigationBarView_itemTextAppearanceInactive, C17052tZT.jNh.NavigationBarView_itemTextAppearanceActive);
|
||
|
Vnx vnx = new Vnx(context2, getClass(), c());
|
||
|
this.c = vnx;
|
||
|
NavigationBarMenuView d = d(context2);
|
||
|
this.e = d;
|
||
|
qjq.e = d;
|
||
|
qjq.a = 1;
|
||
|
d.setPresenter(qjq);
|
||
|
Context context3 = vnx.d;
|
||
|
vnx.r.add(new WeakReference<>(qjq));
|
||
|
qjq.a(context3, vnx);
|
||
|
vnx.f = true;
|
||
|
qjq.a(getContext(), vnx);
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemIconTint)) {
|
||
|
d.setIconTintList(Kd_.jK_(C17052tZT.jNh.NavigationBarView_itemIconTint));
|
||
|
} else {
|
||
|
d.setIconTintList(d.Kl_());
|
||
|
}
|
||
|
setItemIconSize(Kd_.d.getDimensionPixelSize(C17052tZT.jNh.NavigationBarView_itemIconSize, getResources().getDimensionPixelSize(C17052tZT.HBt.mtrl_navigation_bar_item_default_icon_size)));
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemTextAppearanceInactive)) {
|
||
|
setItemTextAppearanceInactive(Kd_.d.getResourceId(C17052tZT.jNh.NavigationBarView_itemTextAppearanceInactive, 0));
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemTextAppearanceActive)) {
|
||
|
setItemTextAppearanceActive(Kd_.d.getResourceId(C17052tZT.jNh.NavigationBarView_itemTextAppearanceActive, 0));
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemTextColor)) {
|
||
|
setItemTextColor(Kd_.jK_(C17052tZT.jNh.NavigationBarView_itemTextColor));
|
||
|
}
|
||
|
if (getBackground() == null || (getBackground() instanceof ColorDrawable)) {
|
||
|
C4363bXv c4363bXv = new C4363bXv();
|
||
|
Drawable background = getBackground();
|
||
|
if ((background instanceof ColorDrawable) && c4363bXv.B.d != (valueOf = ColorStateList.valueOf(((ColorDrawable) background).getColor()))) {
|
||
|
c4363bXv.B.d = valueOf;
|
||
|
c4363bXv.onStateChange(c4363bXv.getState());
|
||
|
}
|
||
|
c4363bXv.d(context2);
|
||
|
ViewCompat.sn_(this, c4363bXv);
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemPaddingTop)) {
|
||
|
setItemPaddingTop(Kd_.d.getDimensionPixelSize(C17052tZT.jNh.NavigationBarView_itemPaddingTop, 0));
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_itemPaddingBottom)) {
|
||
|
setItemPaddingBottom(Kd_.d.getDimensionPixelSize(C17052tZT.jNh.NavigationBarView_itemPaddingBottom, 0));
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_elevation)) {
|
||
|
setElevation(Kd_.d.getDimensionPixelSize(C17052tZT.jNh.NavigationBarView_elevation, 0));
|
||
|
}
|
||
|
Tlu.pF_(getBackground().mutate(), C14739fyr.Kv_(context2, Kd_, C17052tZT.jNh.NavigationBarView_backgroundTint));
|
||
|
setLabelVisibilityMode(Kd_.d.getInteger(C17052tZT.jNh.NavigationBarView_labelVisibilityMode, -1));
|
||
|
int resourceId = Kd_.d.getResourceId(C17052tZT.jNh.NavigationBarView_itemBackground, 0);
|
||
|
if (resourceId != 0) {
|
||
|
d.setItemBackgroundRes(resourceId);
|
||
|
} else {
|
||
|
setItemRippleColor(C14739fyr.Kv_(context2, Kd_, C17052tZT.jNh.NavigationBarView_itemRippleColor));
|
||
|
}
|
||
|
int resourceId2 = Kd_.d.getResourceId(C17052tZT.jNh.NavigationBarView_itemActiveIndicatorStyle, 0);
|
||
|
if (resourceId2 != 0) {
|
||
|
setItemActiveIndicatorEnabled(true);
|
||
|
TypedArray obtainStyledAttributes = context2.obtainStyledAttributes(resourceId2, C17052tZT.jNh.NavigationBarActiveIndicator);
|
||
|
setItemActiveIndicatorWidth(obtainStyledAttributes.getDimensionPixelSize(C17052tZT.jNh.NavigationBarActiveIndicator_android_width, 0));
|
||
|
setItemActiveIndicatorHeight(obtainStyledAttributes.getDimensionPixelSize(C17052tZT.jNh.NavigationBarActiveIndicator_android_height, 0));
|
||
|
setItemActiveIndicatorMarginHorizontal(obtainStyledAttributes.getDimensionPixelOffset(C17052tZT.jNh.NavigationBarActiveIndicator_marginHorizontal, 0));
|
||
|
setItemActiveIndicatorColor(C14739fyr.Ku_(context2, obtainStyledAttributes, C17052tZT.jNh.NavigationBarActiveIndicator_android_color));
|
||
|
setItemActiveIndicatorShapeAppearance(new FLD(FLD.d(context2, obtainStyledAttributes.getResourceId(C17052tZT.jNh.NavigationBarActiveIndicator_shapeAppearance, 0), 0, new C17525xWe(BitmapDescriptorFactory.HUE_RED)), (byte) 0));
|
||
|
obtainStyledAttributes.recycle();
|
||
|
}
|
||
|
if (Kd_.d.hasValue(C17052tZT.jNh.NavigationBarView_menu)) {
|
||
|
int resourceId3 = Kd_.d.getResourceId(C17052tZT.jNh.NavigationBarView_menu, 0);
|
||
|
qjq.d = true;
|
||
|
if (this.d == null) {
|
||
|
this.d = new JHJ(getContext());
|
||
|
}
|
||
|
this.d.inflate(resourceId3, vnx);
|
||
|
qjq.d = false;
|
||
|
qjq.a(true);
|
||
|
}
|
||
|
Kd_.d.recycle();
|
||
|
addView(d);
|
||
|
vnx.d(new NoP.Sts(this) { // from class: com.google.android.material.navigation.NavigationBarView.3
|
||
|
private NavigationBarView a;
|
||
|
|
||
|
@Override // o.NoP.Sts
|
||
|
public final void b(NoP noP) {
|
||
|
}
|
||
|
|
||
|
{
|
||
|
this.a = this;
|
||
|
}
|
||
|
|
||
|
@Override // o.NoP.Sts
|
||
|
public final boolean Ko_(NoP noP, MenuItem menuItem) {
|
||
|
if (this.a.b == null || menuItem.getItemId() != this.a.e.f) {
|
||
|
return (this.a.a == null || this.a.a.adS_(menuItem)) ? false : true;
|
||
|
}
|
||
|
this.a.b.XQ_(menuItem);
|
||
|
return true;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
@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 // android.view.View
|
||
|
public void setElevation(float f) {
|
||
|
super.setElevation(f);
|
||
|
Drawable background = getBackground();
|
||
|
if (background instanceof C4363bXv) {
|
||
|
((C4363bXv) background).n(f);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setItemIconTintList(ColorStateList colorStateList) {
|
||
|
this.e.setIconTintList(colorStateList);
|
||
|
}
|
||
|
|
||
|
public void setItemIconSize(int i) {
|
||
|
this.e.setItemIconSize(i);
|
||
|
}
|
||
|
|
||
|
public void setItemIconSizeRes(int i) {
|
||
|
setItemIconSize(getResources().getDimensionPixelSize(i));
|
||
|
}
|
||
|
|
||
|
public void setItemTextColor(ColorStateList colorStateList) {
|
||
|
this.e.setItemTextColor(colorStateList);
|
||
|
}
|
||
|
|
||
|
public void setItemBackgroundResource(int i) {
|
||
|
this.e.setItemBackgroundRes(i);
|
||
|
}
|
||
|
|
||
|
public void setItemBackground(Drawable drawable) {
|
||
|
this.e.setItemBackground(drawable);
|
||
|
}
|
||
|
|
||
|
public void setItemRippleColor(ColorStateList colorStateList) {
|
||
|
this.e.setItemRippleColor(colorStateList);
|
||
|
}
|
||
|
|
||
|
public void setItemPaddingTop(int i) {
|
||
|
this.e.setItemPaddingTop(i);
|
||
|
}
|
||
|
|
||
|
public void setItemPaddingBottom(int i) {
|
||
|
this.e.setItemPaddingBottom(i);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorEnabled(boolean z) {
|
||
|
this.e.setItemActiveIndicatorEnabled(z);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorWidth(int i) {
|
||
|
this.e.setItemActiveIndicatorWidth(i);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorHeight(int i) {
|
||
|
this.e.setItemActiveIndicatorHeight(i);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorMarginHorizontal(int i) {
|
||
|
this.e.setItemActiveIndicatorMarginHorizontal(i);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorShapeAppearance(FLD fld) {
|
||
|
this.e.setItemActiveIndicatorShapeAppearance(fld);
|
||
|
}
|
||
|
|
||
|
public void setItemActiveIndicatorColor(ColorStateList colorStateList) {
|
||
|
this.e.setItemActiveIndicatorColor(colorStateList);
|
||
|
}
|
||
|
|
||
|
public void setSelectedItemId(int i) {
|
||
|
MenuItem findItem = this.c.findItem(i);
|
||
|
if (findItem == null || this.c.eM_(findItem, this.g, 0)) {
|
||
|
return;
|
||
|
}
|
||
|
findItem.setChecked(true);
|
||
|
}
|
||
|
|
||
|
public void setItemTextAppearanceInactive(int i) {
|
||
|
this.e.setItemTextAppearanceInactive(i);
|
||
|
}
|
||
|
|
||
|
public void setItemTextAppearanceActive(int i) {
|
||
|
this.e.setItemTextAppearanceActive(i);
|
||
|
}
|
||
|
|
||
|
public void setItemOnTouchListener(int i, View.OnTouchListener onTouchListener) {
|
||
|
this.e.setItemOnTouchListener(i, onTouchListener);
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected Parcelable onSaveInstanceState() {
|
||
|
Parcelable Kn_;
|
||
|
Sts sts = new Sts(super.onSaveInstanceState());
|
||
|
sts.e = new Bundle();
|
||
|
Vnx vnx = this.c;
|
||
|
Bundle bundle = sts.e;
|
||
|
if (!vnx.r.isEmpty()) {
|
||
|
SparseArray<? extends Parcelable> sparseArray = new SparseArray<>();
|
||
|
Iterator<WeakReference<InterfaceC15933jjG>> it = vnx.r.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
WeakReference<InterfaceC15933jjG> next = it.next();
|
||
|
InterfaceC15933jjG interfaceC15933jjG = next.get();
|
||
|
if (interfaceC15933jjG == null) {
|
||
|
vnx.r.remove(next);
|
||
|
} else {
|
||
|
int a = interfaceC15933jjG.a();
|
||
|
if (a > 0 && (Kn_ = interfaceC15933jjG.Kn_()) != null) {
|
||
|
sparseArray.put(a, Kn_);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
bundle.putSparseParcelableArray("android:menu:presenters", sparseArray);
|
||
|
}
|
||
|
return sts;
|
||
|
}
|
||
|
|
||
|
@Override // android.view.View
|
||
|
protected void onRestoreInstanceState(Parcelable parcelable) {
|
||
|
Parcelable parcelable2;
|
||
|
if (!(parcelable instanceof Sts)) {
|
||
|
super.onRestoreInstanceState(parcelable);
|
||
|
return;
|
||
|
}
|
||
|
Sts sts = (Sts) parcelable;
|
||
|
super.onRestoreInstanceState(sts.b);
|
||
|
Vnx vnx = this.c;
|
||
|
SparseArray sparseParcelableArray = sts.e.getSparseParcelableArray("android:menu:presenters");
|
||
|
if (sparseParcelableArray == null || vnx.r.isEmpty()) {
|
||
|
return;
|
||
|
}
|
||
|
Iterator<WeakReference<InterfaceC15933jjG>> it = vnx.r.iterator();
|
||
|
while (it.hasNext()) {
|
||
|
WeakReference<InterfaceC15933jjG> next = it.next();
|
||
|
InterfaceC15933jjG interfaceC15933jjG = next.get();
|
||
|
if (interfaceC15933jjG == null) {
|
||
|
vnx.r.remove(next);
|
||
|
} else {
|
||
|
int a = interfaceC15933jjG.a();
|
||
|
if (a > 0 && (parcelable2 = (Parcelable) sparseParcelableArray.get(a)) != null) {
|
||
|
interfaceC15933jjG.Km_(parcelable2);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
/* loaded from: classes2.dex */
|
||
|
static class Sts extends XgG {
|
||
|
public static final Parcelable.Creator<Sts> CREATOR = new Parcelable.ClassLoaderCreator<Sts>() { // from class: com.google.android.material.navigation.NavigationBarView.Sts.2
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
|
||
|
return new Sts(parcel, null);
|
||
|
}
|
||
|
|
||
|
@Override // android.os.Parcelable.ClassLoaderCreator
|
||
|
public final /* synthetic */ Sts createFromParcel(Parcel parcel, ClassLoader classLoader) {
|
||
|
return new Sts(parcel, classLoader);
|
||
|
}
|
||
|
|
||
|
@Override // android.os.Parcelable.Creator
|
||
|
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
|
||
|
return new Sts[i];
|
||
|
}
|
||
|
};
|
||
|
Bundle e;
|
||
|
|
||
|
public Sts(Parcelable parcelable) {
|
||
|
super(parcelable);
|
||
|
}
|
||
|
|
||
|
public Sts(Parcel parcel, ClassLoader classLoader) {
|
||
|
super(parcel, classLoader);
|
||
|
this.e = parcel.readBundle(classLoader == null ? getClass().getClassLoader() : classLoader);
|
||
|
}
|
||
|
|
||
|
@Override // o.XgG, android.os.Parcelable
|
||
|
public final void writeToParcel(Parcel parcel, int i) {
|
||
|
super.writeToParcel(parcel, i);
|
||
|
parcel.writeBundle(this.e);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public final C5745byp d() {
|
||
|
NavigationBarMenuView navigationBarMenuView = this.e;
|
||
|
C5745byp c5745byp = navigationBarMenuView.b.get(R.id.notification_tab);
|
||
|
NavigationBarItemView navigationBarItemView = null;
|
||
|
if (c5745byp == null) {
|
||
|
C5745byp c5745byp2 = new C5745byp(navigationBarMenuView.getContext(), C5745byp.d, C5745byp.a, null);
|
||
|
navigationBarMenuView.b.put(R.id.notification_tab, c5745byp2);
|
||
|
c5745byp = c5745byp2;
|
||
|
}
|
||
|
NavigationBarItemView[] navigationBarItemViewArr = navigationBarMenuView.e;
|
||
|
if (navigationBarItemViewArr != null) {
|
||
|
int length = navigationBarItemViewArr.length;
|
||
|
int i = 0;
|
||
|
while (true) {
|
||
|
if (i >= length) {
|
||
|
break;
|
||
|
}
|
||
|
NavigationBarItemView navigationBarItemView2 = navigationBarItemViewArr[i];
|
||
|
if (navigationBarItemView2.getId() == R.id.notification_tab) {
|
||
|
navigationBarItemView = navigationBarItemView2;
|
||
|
break;
|
||
|
}
|
||
|
i++;
|
||
|
}
|
||
|
}
|
||
|
if (navigationBarItemView != null) {
|
||
|
navigationBarItemView.b(c5745byp);
|
||
|
}
|
||
|
return c5745byp;
|
||
|
}
|
||
|
|
||
|
public void setLabelVisibilityMode(int i) {
|
||
|
if (this.e.d != i) {
|
||
|
this.e.setLabelVisibilityMode(i);
|
||
|
this.g.a(false);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public void setOnItemSelectedListener(RVV rvv) {
|
||
|
this.a = rvv;
|
||
|
}
|
||
|
|
||
|
public void setOnItemReselectedListener(HBt hBt) {
|
||
|
this.b = hBt;
|
||
|
}
|
||
|
|
||
|
public final QJQ e() {
|
||
|
return this.g;
|
||
|
}
|
||
|
}
|