what-the-bank/sources/androidx/appcompat/widget/Toolbar.java

1812 lines
66 KiB
Java
Raw Normal View History

2024-07-27 18:17:47 +07:00
package androidx.appcompat.widget;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;
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.ContextThemeWrapper;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import android.window.OnBackInvokedCallback;
import android.window.OnBackInvokedDispatcher;
import androidx.appcompat.view.menu.MenuItemImpl;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.Toolbar;
import androidx.core.view.ViewCompat;
import java.lang.ref.WeakReference;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import o.AHZ;
import o.AgY;
import o.C0683McA;
import o.C0926Rry;
import o.C1292Ztc;
import o.C6286cOZ;
import o.C7587crD;
import o.CYM;
import o.HpP;
import o.InterfaceC15933jjG;
import o.JHJ;
import o.JPw;
import o.NoP;
import o.RIz;
import o.SYO;
import o.SubMenuC16744qqn;
import o.XgG;
import o.jbe;
import o.mxt;
import o.pwE;
import org.bouncycastle.asn1.cmp.PKIFailureInfo;
/* loaded from: classes.dex */
public class Toolbar extends ViewGroup implements RIz {
private static int T = 1;
private static byte U = 6;
private static int V;
private int A;
private C1292Ztc B;
private boolean C;
private int D;
private boolean E;
private int F;
private int G;
private ActionMenuPresenter H;
private final ActionMenuView.OnMenuItemClickListener I;
private ColorStateList J;
private final Runnable K;
private int L;
private Context M;
private int N;
private final ArrayList<View> O;
private int P;
private TextView Q;
private final int[] R;
private ColorStateList S;
private TextView W;
public RVV a;
final ArrayList<View> b;
int c;
View d;
ImageButton e;
public ActionMenuView f;
public final C7587crD g;
public ImageView h;
NoP.Sts i;
public ImageButton j;
public int k;
public CharSequence l;
HBt m;
public ArrayList<MenuItem> n;
/* renamed from: o, reason: collision with root package name */
public int f6379o;
public int p;
public CharSequence q;
public int r;
private InterfaceC15933jjG.Sts s;
public C0926Rry t;
private OnBackInvokedDispatcher u;
private OnBackInvokedCallback v;
private boolean w;
private CharSequence x;
private Drawable y;
private boolean z;
/* loaded from: classes.dex */
public interface HBt {
boolean awL_(MenuItem menuItem);
}
private void aa(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] ^ U);
}
objArr[0] = new String(bArr, StandardCharsets.UTF_8);
}
@Override // android.view.ViewGroup
protected /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams layoutParams) {
return jN_(layoutParams);
}
public Toolbar(Context context) {
this(context, null);
}
public Toolbar(Context context, AttributeSet attributeSet) {
this(context, attributeSet, SYO.IeS.toolbarStyle);
}
public Toolbar(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.G = 8388627;
this.O = new ArrayList<>();
this.b = new ArrayList<>();
this.R = new int[2];
this.g = new C7587crD(new Runnable(this) { // from class: o.pfN
public final Toolbar d;
@Override // java.lang.Runnable
public final void run() {
Toolbar toolbar = this.d;
Iterator<MenuItem> it = toolbar.n.iterator();
while (it.hasNext()) {
MenuItem next = it.next();
toolbar.c();
toolbar.f.fp_().removeItem(next.getItemId());
}
toolbar.c();
Menu fp_ = toolbar.f.fp_();
ArrayList<MenuItem> e = toolbar.e();
toolbar.g.rF_(fp_, new JHJ(toolbar.getContext()));
ArrayList<MenuItem> e2 = toolbar.e();
e2.removeAll(e);
toolbar.n = e2;
}
{
this.d = this;
}
});
this.n = new ArrayList<>();
this.I = new ActionMenuView.OnMenuItemClickListener(this) { // from class: androidx.appcompat.widget.Toolbar.3
final Toolbar e;
{
this.e = this;
}
@Override // androidx.appcompat.widget.ActionMenuView.OnMenuItemClickListener
public final boolean onMenuItemClick(MenuItem menuItem) {
if (this.e.g.rH_(menuItem)) {
return true;
}
if (this.e.m != null) {
return this.e.m.awL_(menuItem);
}
return false;
}
};
this.K = new Runnable(this) { // from class: androidx.appcompat.widget.Toolbar.4
final Toolbar b;
{
this.b = this;
}
@Override // java.lang.Runnable
public final void run() {
this.b.h();
}
};
Context context2 = getContext();
C0683McA c0683McA = new C0683McA(context2, context2.obtainStyledAttributes(attributeSet, SYO.ZqN.Toolbar, i, 0));
ViewCompat.sm_(this, context, SYO.ZqN.Toolbar, attributeSet, c0683McA.d, i, 0);
this.P = c0683McA.d.getResourceId(SYO.ZqN.Toolbar_titleTextAppearance, 0);
this.N = c0683McA.d.getResourceId(SYO.ZqN.Toolbar_subtitleTextAppearance, 0);
this.G = c0683McA.d.getInteger(SYO.ZqN.Toolbar_android_gravity, this.G);
this.c = c0683McA.d.getInteger(SYO.ZqN.Toolbar_buttonGravity, 48);
int dimensionPixelOffset = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMargin, 0);
if (c0683McA.d.hasValue(SYO.ZqN.Toolbar_titleMargins)) {
dimensionPixelOffset = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMargins, dimensionPixelOffset);
}
this.f6379o = dimensionPixelOffset;
this.r = dimensionPixelOffset;
this.k = dimensionPixelOffset;
this.p = dimensionPixelOffset;
int dimensionPixelOffset2 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMarginStart, -1);
if (dimensionPixelOffset2 >= 0) {
this.p = dimensionPixelOffset2;
}
int dimensionPixelOffset3 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMarginEnd, -1);
if (dimensionPixelOffset3 >= 0) {
this.k = dimensionPixelOffset3;
}
int dimensionPixelOffset4 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMarginTop, -1);
if (dimensionPixelOffset4 >= 0) {
this.r = dimensionPixelOffset4;
}
int dimensionPixelOffset5 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_titleMarginBottom, -1);
if (dimensionPixelOffset5 >= 0) {
this.f6379o = dimensionPixelOffset5;
}
this.F = c0683McA.d.getDimensionPixelSize(SYO.ZqN.Toolbar_maxButtonHeight, -1);
int dimensionPixelOffset6 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_contentInsetStart, PKIFailureInfo.systemUnavail);
int dimensionPixelOffset7 = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_contentInsetEnd, PKIFailureInfo.systemUnavail);
int dimensionPixelSize = c0683McA.d.getDimensionPixelSize(SYO.ZqN.Toolbar_contentInsetLeft, 0);
int dimensionPixelSize2 = c0683McA.d.getDimensionPixelSize(SYO.ZqN.Toolbar_contentInsetRight, 0);
if (this.B == null) {
this.B = new C1292Ztc();
}
this.B.a(dimensionPixelSize, dimensionPixelSize2);
if (dimensionPixelOffset6 != Integer.MIN_VALUE || dimensionPixelOffset7 != Integer.MIN_VALUE) {
this.B.e(dimensionPixelOffset6, dimensionPixelOffset7);
}
this.A = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_contentInsetStartWithNavigation, PKIFailureInfo.systemUnavail);
this.D = c0683McA.d.getDimensionPixelOffset(SYO.ZqN.Toolbar_contentInsetEndWithActions, PKIFailureInfo.systemUnavail);
this.y = c0683McA.jL_(SYO.ZqN.Toolbar_collapseIcon);
this.x = c0683McA.d.getText(SYO.ZqN.Toolbar_collapseContentDescription);
CharSequence text = c0683McA.d.getText(SYO.ZqN.Toolbar_title);
if (!TextUtils.isEmpty(text)) {
setTitle(text);
}
CharSequence text2 = c0683McA.d.getText(SYO.ZqN.Toolbar_subtitle);
if (!TextUtils.isEmpty(text2)) {
setSubtitle(text2);
}
this.M = getContext();
setPopupTheme(c0683McA.d.getResourceId(SYO.ZqN.Toolbar_popupTheme, 0));
Drawable jL_ = c0683McA.jL_(SYO.ZqN.Toolbar_navigationIcon);
if (jL_ != null) {
setNavigationIcon(jL_);
}
CharSequence text3 = c0683McA.d.getText(SYO.ZqN.Toolbar_navigationContentDescription);
if (!TextUtils.isEmpty(text3)) {
setNavigationContentDescription(text3);
}
Drawable jL_2 = c0683McA.jL_(SYO.ZqN.Toolbar_logo);
if (jL_2 != null) {
setLogo(jL_2);
}
CharSequence text4 = c0683McA.d.getText(SYO.ZqN.Toolbar_logoDescription);
if (!TextUtils.isEmpty(text4)) {
setLogoDescription(text4);
}
if (c0683McA.d.hasValue(SYO.ZqN.Toolbar_titleTextColor)) {
setTitleTextColor(c0683McA.jK_(SYO.ZqN.Toolbar_titleTextColor));
}
if (c0683McA.d.hasValue(SYO.ZqN.Toolbar_subtitleTextColor)) {
setSubtitleTextColor(c0683McA.jK_(SYO.ZqN.Toolbar_subtitleTextColor));
}
if (c0683McA.d.hasValue(SYO.ZqN.Toolbar_menu)) {
a(c0683McA.d.getResourceId(SYO.ZqN.Toolbar_menu, 0));
}
c0683McA.d.recycle();
}
public void setBackInvokedCallbackEnabled(boolean z) {
if (this.w != z) {
this.w = z;
j();
}
}
public void setPopupTheme(int i) {
if (this.L != i) {
this.L = i;
if (i == 0) {
this.M = getContext();
} else {
this.M = new ContextThemeWrapper(getContext(), i);
}
}
}
public void setTitleMargin(int i, int i2, int i3, int i4) {
this.p = i;
this.r = i2;
this.k = i3;
this.f6379o = i4;
requestLayout();
}
public void setTitleMarginStart(int i) {
this.p = i;
requestLayout();
}
public void setTitleMarginTop(int i) {
this.r = i;
requestLayout();
}
public void setTitleMarginEnd(int i) {
this.k = i;
requestLayout();
}
public void setTitleMarginBottom(int i) {
this.f6379o = i;
requestLayout();
}
@Override // android.view.View
public void onRtlPropertiesChanged(int i) {
super.onRtlPropertiesChanged(i);
if (this.B == null) {
this.B = new C1292Ztc();
}
C1292Ztc c1292Ztc = this.B;
boolean z = i == 1;
if (z != c1292Ztc.a) {
c1292Ztc.a = z;
if (!c1292Ztc.c) {
c1292Ztc.i = c1292Ztc.e;
c1292Ztc.g = c1292Ztc.b;
return;
}
if (z) {
int i2 = c1292Ztc.d;
if (i2 == Integer.MIN_VALUE) {
i2 = c1292Ztc.e;
}
c1292Ztc.i = i2;
int i3 = c1292Ztc.h;
if (i3 == Integer.MIN_VALUE) {
i3 = c1292Ztc.b;
}
c1292Ztc.g = i3;
return;
}
int i4 = c1292Ztc.h;
if (i4 == Integer.MIN_VALUE) {
i4 = c1292Ztc.e;
}
c1292Ztc.i = i4;
int i5 = c1292Ztc.d;
if (i5 == Integer.MIN_VALUE) {
i5 = c1292Ztc.b;
}
c1292Ztc.g = i5;
}
}
public void setLogo(int i) {
setLogo(AgY.dT_(getContext(), i));
}
public final boolean f() {
ActionMenuPresenter actionMenuPresenter;
ActionMenuView actionMenuView = this.f;
return (actionMenuView == null || (actionMenuPresenter = actionMenuView.b) == null || !actionMenuPresenter.d()) ? false : true;
}
public final boolean h() {
ActionMenuPresenter actionMenuPresenter;
ActionMenuView actionMenuView = this.f;
return (actionMenuView == null || (actionMenuPresenter = actionMenuView.b) == null || !actionMenuPresenter.b()) ? false : true;
}
public void setMenu(NoP noP, ActionMenuPresenter actionMenuPresenter) {
if (noP == null && this.f == null) {
return;
}
g();
NoP noP2 = this.f.d;
if (noP2 == noP) {
return;
}
if (noP2 != null) {
noP2.b(this.H);
noP2.b(this.a);
}
if (this.a == null) {
this.a = new RVV(this);
}
actionMenuPresenter.f = true;
if (noP != null) {
Context context = this.M;
noP.r.add(new WeakReference<>(actionMenuPresenter));
actionMenuPresenter.a(context, noP);
noP.f = true;
RVV rvv = this.a;
Context context2 = this.M;
noP.r.add(new WeakReference<>(rvv));
rvv.a(context2, noP);
noP.f = true;
} else {
actionMenuPresenter.a(this.M, (NoP) null);
this.a.a(this.M, null);
actionMenuPresenter.a(true);
this.a.a(true);
}
this.f.setPopupTheme(this.L);
this.f.setPresenter(actionMenuPresenter);
this.H = actionMenuPresenter;
j();
}
public void setLogo(Drawable drawable) {
if (drawable != null) {
if (this.h == null) {
this.h = new AppCompatImageView(getContext());
}
ImageView imageView = this.h;
if (imageView.getParent() != this && !this.b.contains(imageView)) {
a((View) this.h, true);
}
} else {
ImageView imageView2 = this.h;
if (imageView2 != null && (imageView2.getParent() == this || this.b.contains(imageView2))) {
removeView(this.h);
this.b.remove(this.h);
}
}
ImageView imageView3 = this.h;
if (imageView3 != null) {
imageView3.setImageDrawable(drawable);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r1v3, types: [android.text.SpannableString, android.text.Spannable] */
public void setLogoDescription(int i) {
int i2 = 2 % 2;
Context context = getContext();
String string = context.getString(i);
if (string.startsWith(",*,)")) {
int i3 = V + 97;
T = i3 % 128;
int i4 = i3 % 2;
Object[] objArr = new Object[1];
aa(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 = V + 77;
T = i5 % 128;
int i6 = i5 % 2;
string = spannableString;
}
}
setLogoDescription(string);
}
public void setLogoDescription(CharSequence charSequence) {
if (!TextUtils.isEmpty(charSequence) && this.h == null) {
this.h = new AppCompatImageView(getContext());
}
ImageView imageView = this.h;
if (imageView != null) {
imageView.setContentDescription(charSequence);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v2, types: [android.text.SpannableString, android.text.Spannable] */
public void setTitle(int i) {
int i2 = 2 % 2;
int i3 = V + 63;
T = i3 % 128;
if (i3 % 2 == 0) {
getContext().getString(i).startsWith(",*,)");
throw null;
}
Context context = getContext();
String string = context.getString(i);
if (string.startsWith(",*,)")) {
String substring = string.substring(4);
Object[] objArr = new Object[1];
aa(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;
} else {
int i4 = V + 31;
T = i4 % 128;
int i5 = i4 % 2;
}
}
setTitle(string);
}
public void setTitle(CharSequence charSequence) {
if (!TextUtils.isEmpty(charSequence)) {
if (this.W == null) {
Context context = getContext();
AppCompatTextView appCompatTextView = new AppCompatTextView(context);
this.W = appCompatTextView;
appCompatTextView.setSingleLine();
this.W.setEllipsize(TextUtils.TruncateAt.END);
int i = this.P;
if (i != 0) {
this.W.setTextAppearance(context, i);
}
ColorStateList colorStateList = this.S;
if (colorStateList != null) {
this.W.setTextColor(colorStateList);
}
}
TextView textView = this.W;
if (textView.getParent() != this && !this.b.contains(textView)) {
a((View) this.W, true);
}
} else {
TextView textView2 = this.W;
if (textView2 != null && (textView2.getParent() == this || this.b.contains(textView2))) {
removeView(this.W);
this.b.remove(this.W);
}
}
TextView textView3 = this.W;
if (textView3 != null) {
textView3.setText(charSequence);
}
this.q = charSequence;
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [android.text.SpannableString, android.text.Spannable] */
public void setSubtitle(int i) {
int i2 = 2 % 2;
int i3 = T + 85;
V = i3 % 128;
int i4 = i3 % 2;
Context context = getContext();
String string = context.getString(i);
if (!(!string.startsWith(",*,)"))) {
Object[] objArr = new Object[1];
aa(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);
string = spannableString;
} else {
int i5 = V + 7;
T = i5 % 128;
int i6 = i5 % 2;
}
}
setSubtitle(string);
}
public void setSubtitle(CharSequence charSequence) {
if (!TextUtils.isEmpty(charSequence)) {
if (this.Q == null) {
Context context = getContext();
AppCompatTextView appCompatTextView = new AppCompatTextView(context);
this.Q = appCompatTextView;
appCompatTextView.setSingleLine();
this.Q.setEllipsize(TextUtils.TruncateAt.END);
int i = this.N;
if (i != 0) {
this.Q.setTextAppearance(context, i);
}
ColorStateList colorStateList = this.J;
if (colorStateList != null) {
this.Q.setTextColor(colorStateList);
}
}
TextView textView = this.Q;
if (textView.getParent() != this && !this.b.contains(textView)) {
a((View) this.Q, true);
}
} else {
TextView textView2 = this.Q;
if (textView2 != null && (textView2.getParent() == this || this.b.contains(textView2))) {
removeView(this.Q);
this.b.remove(this.Q);
}
}
TextView textView3 = this.Q;
if (textView3 != null) {
textView3.setText(charSequence);
}
this.l = charSequence;
}
public void setTitleTextAppearance(Context context, int i) {
this.P = i;
TextView textView = this.W;
if (textView != null) {
textView.setTextAppearance(context, i);
}
}
public void setSubtitleTextAppearance(Context context, int i) {
this.N = i;
TextView textView = this.Q;
if (textView != null) {
textView.setTextAppearance(context, i);
}
}
public void setTitleTextColor(int i) {
setTitleTextColor(ColorStateList.valueOf(i));
}
public void setTitleTextColor(ColorStateList colorStateList) {
this.S = colorStateList;
TextView textView = this.W;
if (textView != null) {
textView.setTextColor(colorStateList);
}
}
public void setSubtitleTextColor(int i) {
setSubtitleTextColor(ColorStateList.valueOf(i));
}
public void setSubtitleTextColor(ColorStateList colorStateList) {
this.J = colorStateList;
TextView textView = this.Q;
if (textView != null) {
textView.setTextColor(colorStateList);
}
}
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v1, types: [android.text.SpannableString, android.text.Spannable] */
/* JADX WARN: Type inference failed for: r9v0, types: [androidx.appcompat.widget.Toolbar, android.view.View] */
public void setNavigationContentDescription(int i) {
String str;
int i2 = 2 % 2;
int i3 = T + 93;
int i4 = i3 % 128;
V = i4;
int i5 = i3 % 2;
if (i != 0) {
int i6 = i4 + 115;
T = i6 % 128;
int i7 = i6 % 2;
Context context = getContext();
str = context.getString(i);
if (str.startsWith(",*,)")) {
Object[] objArr = new Object[1];
aa(str.substring(4), objArr);
str = ((String) objArr[0]).intern();
CharSequence text = context.getText(i);
if (text instanceof Spanned) {
?? spannableString = new SpannableString(str);
TextUtils.copySpansFrom((SpannedString) text, 0, str.length(), Object.class, spannableString, 0);
str = spannableString;
} else {
int i8 = T + 75;
V = i8 % 128;
int i9 = i8 % 2;
}
}
} else {
str = null;
}
setNavigationContentDescription(str);
}
public void setNavigationContentDescription(CharSequence charSequence) {
if (!TextUtils.isEmpty(charSequence)) {
i();
}
ImageButton imageButton = this.j;
if (imageButton != null) {
imageButton.setContentDescription(charSequence);
C6286cOZ.e(this.j, charSequence);
}
}
public void setNavigationIcon(int i) {
setNavigationIcon(AgY.dT_(getContext(), i));
}
public void setNavigationIcon(Drawable drawable) {
if (drawable != null) {
i();
ImageButton imageButton = this.j;
if (imageButton.getParent() != this && !this.b.contains(imageButton)) {
a((View) this.j, true);
}
} else {
ImageButton imageButton2 = this.j;
if (imageButton2 != null && (imageButton2.getParent() == this || this.b.contains(imageButton2))) {
removeView(this.j);
this.b.remove(this.j);
}
}
ImageButton imageButton3 = this.j;
if (imageButton3 != null) {
imageButton3.setImageDrawable(drawable);
}
}
public void setNavigationOnClickListener(View.OnClickListener onClickListener) {
i();
this.j.setOnClickListener(onClickListener);
}
/* JADX WARN: Code restructure failed: missing block: B:11:0x0052, code lost:
if ((r9 instanceof android.text.Spanned) != false) goto L16;
*/
/* JADX WARN: Code restructure failed: missing block: B:12:0x0087, code lost:
r9 = androidx.appcompat.widget.Toolbar.V + 105;
androidx.appcompat.widget.Toolbar.T = r9 % 128;
*/
/* JADX WARN: Code restructure failed: missing block: B:13:0x0090, code lost:
if ((r9 % 2) != 0) goto L20;
*/
/* JADX WARN: Code restructure failed: missing block: B:14:0x0092, code lost:
r0 = 2 / 4;
*/
/* JADX WARN: Code restructure failed: missing block: B:15:0x0093, code lost:
r3 = r1;
*/
/* JADX WARN: Code restructure failed: missing block: B:16:0x006e, code lost:
r0 = new android.text.SpannableString(r1);
r9 = (android.text.SpannableString) r0;
android.text.TextUtils.copySpansFrom((android.text.SpannedString) r9, 0, r1.length(), java.lang.Object.class, r0, 0);
r3 = r0;
*/
/* JADX WARN: Code restructure failed: missing block: B:18:0x006c, code lost:
if ((r9 instanceof android.text.Spanned) != false) goto L16;
*/
/* JADX WARN: Multi-variable type inference failed */
/* JADX WARN: Type inference failed for: r0v2, types: [android.text.SpannableString, android.text.Spannable] */
/* JADX WARN: Type inference failed for: r8v0, types: [androidx.appcompat.widget.Toolbar, android.view.View] */
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void setCollapseContentDescription(int r9) {
/*
r8 = this;
r0 = 2
int r1 = r0 % r0
int r1 = androidx.appcompat.widget.Toolbar.T
int r1 = r1 + 67
int r2 = r1 % 128
androidx.appcompat.widget.Toolbar.V = r2
int r1 = r1 % r0
r3 = 0
if (r1 != 0) goto La5
if (r9 == 0) goto La1
int r2 = r2 + 51
int r1 = r2 % 128
androidx.appcompat.widget.Toolbar.T = r1
int r2 = r2 % r0
java.lang.String r1 = ",*,)"
if (r2 == 0) goto L95
android.content.Context r2 = r8.getContext()
java.lang.String r3 = r2.getString(r9)
boolean r1 = r3.startsWith(r1)
if (r1 == 0) goto La1
int r1 = androidx.appcompat.widget.Toolbar.T
int r1 = r1 + 43
int r4 = r1 % 128
androidx.appcompat.widget.Toolbar.V = r4
int r1 = r1 % r0
r4 = 1
r5 = 0
r6 = 4
if (r1 == 0) goto L55
java.lang.String r1 = r3.substring(r6)
java.lang.Object[] r3 = new java.lang.Object[r4]
r8.aa(r1, r3)
r1 = r3[r5]
java.lang.String r1 = (java.lang.String) r1
java.lang.String r1 = r1.intern()
java.lang.CharSequence r9 = r2.getText(r9)
boolean r2 = r9 instanceof android.text.Spanned
r3 = 74
int r3 = r3 / r5
if (r2 == 0) goto L87
goto L6e
L55:
java.lang.String r1 = r3.substring(r6)
java.lang.Object[] r3 = new java.lang.Object[r4]
r8.aa(r1, r3)
r1 = r3[r5]
java.lang.String r1 = (java.lang.String) r1
java.lang.String r1 = r1.intern()
java.lang.CharSequence r9 = r2.getText(r9)
boolean r2 = r9 instanceof android.text.Spanned
if (r2 == 0) goto L87
L6e:
android.text.SpannableString r0 = new android.text.SpannableString
r0.<init>(r1)
r2 = r9
android.text.SpannedString r2 = (android.text.SpannedString) r2
r3 = 0
int r4 = r1.length()
java.lang.Class<java.lang.Object> r5 = java.lang.Object.class
r9 = r0
android.text.SpannableString r9 = (android.text.SpannableString) r9
r7 = 0
r6 = r0
android.text.TextUtils.copySpansFrom(r2, r3, r4, r5, r6, r7)
r3 = r0
goto La1
L87:
int r9 = androidx.appcompat.widget.Toolbar.V
int r9 = r9 + 105
int r2 = r9 % 128
androidx.appcompat.widget.Toolbar.T = r2
int r9 = r9 % r0
if (r9 != 0) goto L93
int r0 = r0 / r6
L93:
r3 = r1
goto La1
L95:
android.content.Context r0 = r8.getContext()
java.lang.String r9 = r0.getString(r9)
r9.startsWith(r1)
throw r3
La1:
r8.setCollapseContentDescription(r3)
return
La5:
throw r3
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.Toolbar.setCollapseContentDescription(int):void");
}
public void setCollapseContentDescription(CharSequence charSequence) {
if (!TextUtils.isEmpty(charSequence)) {
o_();
}
ImageButton imageButton = this.e;
if (imageButton != null) {
imageButton.setContentDescription(charSequence);
}
}
public void setCollapseIcon(int i) {
setCollapseIcon(AgY.dT_(getContext(), i));
}
public void setCollapseIcon(Drawable drawable) {
if (drawable != null) {
o_();
this.e.setImageDrawable(drawable);
} else {
ImageButton imageButton = this.e;
if (imageButton != null) {
imageButton.setImageDrawable(this.y);
}
}
}
public final Menu jO_() {
c();
return this.f.fp_();
}
public void setOverflowIcon(Drawable drawable) {
c();
this.f.setOverflowIcon(drawable);
}
public final void c() {
g();
if (this.f.d == null) {
NoP noP = (NoP) this.f.fp_();
if (this.a == null) {
this.a = new RVV(this);
}
this.f.setExpandedActionViewsExclusive(true);
RVV rvv = this.a;
Context context = this.M;
noP.r.add(new WeakReference<>(rvv));
rvv.a(context, noP);
noP.f = true;
j();
}
}
private void g() {
if (this.f == null) {
ActionMenuView actionMenuView = new ActionMenuView(getContext());
this.f = actionMenuView;
actionMenuView.setPopupTheme(this.L);
this.f.setOnMenuItemClickListener(this.I);
this.f.setMenuCallbacks(this.s, new NoP.Sts(this) { // from class: androidx.appcompat.widget.Toolbar.2
final Toolbar c;
{
this.c = this;
}
@Override // o.NoP.Sts
public final boolean Ko_(NoP noP, MenuItem menuItem) {
return this.c.i != null && this.c.i.Ko_(noP, menuItem);
}
@Override // o.NoP.Sts
public final void b(NoP noP) {
ActionMenuPresenter actionMenuPresenter = this.c.f.b;
if (actionMenuPresenter == null || !actionMenuPresenter.d()) {
this.c.g.rI_(noP);
}
if (this.c.i != null) {
this.c.i.b(noP);
}
}
});
LWm lWm = new LWm();
lWm.d = (this.c & 112) | 8388613;
this.f.setLayoutParams(lWm);
a((View) this.f, false);
}
}
public void setContentInsetsRelative(int i, int i2) {
if (this.B == null) {
this.B = new C1292Ztc();
}
this.B.e(i, i2);
}
public void setContentInsetsAbsolute(int i, int i2) {
if (this.B == null) {
this.B = new C1292Ztc();
}
this.B.a(i, i2);
}
public void setContentInsetStartWithNavigation(int i) {
if (i < 0) {
i = PKIFailureInfo.systemUnavail;
}
if (i != this.A) {
this.A = i;
ImageButton imageButton = this.j;
if ((imageButton != null ? imageButton.getDrawable() : null) != null) {
requestLayout();
}
}
}
public void setContentInsetEndWithActions(int i) {
if (i < 0) {
i = PKIFailureInfo.systemUnavail;
}
if (i != this.D) {
this.D = i;
ImageButton imageButton = this.j;
if ((imageButton != null ? imageButton.getDrawable() : null) != null) {
requestLayout();
}
}
}
private int n() {
ImageButton imageButton = this.j;
if ((imageButton != null ? imageButton.getDrawable() : null) != null) {
return Math.max(k(), Math.max(this.A, 0));
}
return k();
}
private void i() {
if (this.j == null) {
this.j = new AppCompatImageButton(getContext(), null, SYO.IeS.toolbarNavigationButtonStyle);
LWm lWm = new LWm();
lWm.d = (this.c & 112) | 8388611;
this.j.setLayoutParams(lWm);
}
}
final void o_() {
if (this.e == null) {
AppCompatImageButton appCompatImageButton = new AppCompatImageButton(getContext(), null, SYO.IeS.toolbarNavigationButtonStyle);
this.e = appCompatImageButton;
appCompatImageButton.setImageDrawable(this.y);
this.e.setContentDescription(this.x);
LWm lWm = new LWm();
lWm.d = (this.c & 112) | 8388611;
lWm.c = 2;
this.e.setLayoutParams(lWm);
this.e.setOnClickListener(new View.OnClickListener(this) { // from class: androidx.appcompat.widget.Toolbar.5
final Toolbar e;
{
this.e = this;
}
@Override // android.view.View.OnClickListener
public final void onClick(View view) {
RVV rvv = this.e.a;
MenuItemImpl menuItemImpl = rvv == null ? null : rvv.b;
if (menuItemImpl != null) {
menuItemImpl.collapseActionView();
}
}
});
}
}
private void a(View view, boolean z) {
LWm lWm;
ViewGroup.LayoutParams layoutParams = view.getLayoutParams();
if (layoutParams != null) {
if (!checkLayoutParams(layoutParams)) {
lWm = jN_(layoutParams);
} else {
lWm = (LWm) layoutParams;
}
} else {
lWm = new LWm();
}
lWm.c = 1;
if (z && this.d != null) {
view.setLayoutParams(lWm);
this.b.add(view);
} else {
addView(view, lWm);
}
}
@Override // android.view.View
public Parcelable onSaveInstanceState() {
Sts sts = new Sts(super.onSaveInstanceState());
RVV rvv = this.a;
if (rvv != null && rvv.b != null) {
sts.c = this.a.b.getItemId();
}
sts.e = f();
return sts;
}
@Override // android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
MenuItem findItem;
if (!(parcelable instanceof Sts)) {
super.onRestoreInstanceState(parcelable);
return;
}
Sts sts = (Sts) parcelable;
super.onRestoreInstanceState(sts.b);
ActionMenuView actionMenuView = this.f;
NoP noP = actionMenuView != null ? actionMenuView.d : null;
if (sts.c != 0 && this.a != null && noP != null && (findItem = noP.findItem(sts.c)) != null) {
findItem.expandActionView();
}
if (sts.e) {
removeCallbacks(this.K);
post(this.K);
}
}
@Override // android.view.ViewGroup, android.view.View
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
removeCallbacks(this.K);
j();
}
@Override // android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
j();
}
@Override // android.view.View
public boolean onTouchEvent(MotionEvent motionEvent) {
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 0) {
this.E = false;
}
if (!this.E) {
boolean onTouchEvent = super.onTouchEvent(motionEvent);
if (actionMasked == 0 && !onTouchEvent) {
this.E = true;
}
}
if (actionMasked == 1 || actionMasked == 3) {
this.E = false;
}
return true;
}
@Override // android.view.View
public boolean onHoverEvent(MotionEvent motionEvent) {
int actionMasked = motionEvent.getActionMasked();
if (actionMasked == 9) {
this.C = false;
}
if (!this.C) {
boolean onHoverEvent = super.onHoverEvent(motionEvent);
if (actionMasked == 9 && !onHoverEvent) {
this.C = true;
}
}
if (actionMasked == 10 || actionMasked == 3) {
this.C = false;
}
return true;
}
private void e(View view, int i, int i2, int i3, int i4) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int i5 = marginLayoutParams.leftMargin;
int childMeasureSpec = getChildMeasureSpec(i, paddingLeft + paddingRight + i5 + marginLayoutParams.rightMargin + i2, ((ViewGroup.LayoutParams) marginLayoutParams).width);
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int i6 = marginLayoutParams.topMargin;
int childMeasureSpec2 = getChildMeasureSpec(i3, paddingTop + paddingBottom + i6 + marginLayoutParams.bottomMargin, ((ViewGroup.LayoutParams) marginLayoutParams).height);
int mode = View.MeasureSpec.getMode(childMeasureSpec2);
if (mode != 1073741824 && i4 >= 0) {
if (mode != 0) {
i4 = Math.min(View.MeasureSpec.getSize(childMeasureSpec2), i4);
}
childMeasureSpec2 = View.MeasureSpec.makeMeasureSpec(i4, 1073741824);
}
view.measure(childMeasureSpec, childMeasureSpec2);
}
private int c(View view, int i, int i2, int i3, int i4, int[] iArr) {
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
int i5 = marginLayoutParams.leftMargin - iArr[0];
int i6 = marginLayoutParams.rightMargin - iArr[1];
int max = Math.max(0, i5) + Math.max(0, i6);
iArr[0] = Math.max(0, -i5);
iArr[1] = Math.max(0, -i6);
int childMeasureSpec = getChildMeasureSpec(i, getPaddingLeft() + getPaddingRight() + max + i2, ((ViewGroup.LayoutParams) marginLayoutParams).width);
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int i7 = marginLayoutParams.topMargin;
view.measure(childMeasureSpec, getChildMeasureSpec(i3, paddingTop + paddingBottom + i7 + marginLayoutParams.bottomMargin + i4, ((ViewGroup.LayoutParams) marginLayoutParams).height));
return view.getMeasuredWidth() + max;
}
@Override // android.view.View
public void onMeasure(int i, int i2) {
int i3;
int i4;
int i5;
int i6;
int i7;
int i8;
int i9;
int i10;
int[] iArr = this.R;
boolean b = mxt.b(this);
ImageButton imageButton = this.j;
int i11 = 0;
if (imageButton == null || imageButton.getParent() != this || imageButton.getVisibility() == 8) {
i3 = 0;
i4 = 0;
i5 = 0;
} else {
e(this.j, i, 0, i2, this.F);
int measuredWidth = this.j.getMeasuredWidth();
ViewGroup.MarginLayoutParams marginLayoutParams = (ViewGroup.MarginLayoutParams) this.j.getLayoutParams();
i3 = measuredWidth + CYM.ry_(marginLayoutParams) + CYM.rx_(marginLayoutParams);
int measuredHeight = this.j.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams2 = (ViewGroup.MarginLayoutParams) this.j.getLayoutParams();
i4 = Math.max(0, measuredHeight + marginLayoutParams2.topMargin + marginLayoutParams2.bottomMargin);
i5 = View.combineMeasuredStates(0, this.j.getMeasuredState());
}
ImageButton imageButton2 = this.e;
if (imageButton2 != null && imageButton2.getParent() == this && imageButton2.getVisibility() != 8) {
e(this.e, i, 0, i2, this.F);
int measuredWidth2 = this.e.getMeasuredWidth();
ViewGroup.MarginLayoutParams marginLayoutParams3 = (ViewGroup.MarginLayoutParams) this.e.getLayoutParams();
i3 = measuredWidth2 + CYM.ry_(marginLayoutParams3) + CYM.rx_(marginLayoutParams3);
int measuredHeight2 = this.e.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams4 = (ViewGroup.MarginLayoutParams) this.e.getLayoutParams();
i4 = Math.max(i4, measuredHeight2 + marginLayoutParams4.topMargin + marginLayoutParams4.bottomMargin);
i5 = View.combineMeasuredStates(i5, this.e.getMeasuredState());
}
int n = n();
int max = Math.max(n, i3);
iArr[b ? 1 : 0] = Math.max(0, n - i3);
ActionMenuView actionMenuView = this.f;
if (actionMenuView == null || actionMenuView.getParent() != this || actionMenuView.getVisibility() == 8) {
i6 = 0;
} else {
e(this.f, i, max, i2, this.F);
int measuredWidth3 = this.f.getMeasuredWidth();
ViewGroup.MarginLayoutParams marginLayoutParams5 = (ViewGroup.MarginLayoutParams) this.f.getLayoutParams();
i6 = measuredWidth3 + CYM.ry_(marginLayoutParams5) + CYM.rx_(marginLayoutParams5);
int measuredHeight3 = this.f.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams6 = (ViewGroup.MarginLayoutParams) this.f.getLayoutParams();
i4 = Math.max(i4, measuredHeight3 + marginLayoutParams6.topMargin + marginLayoutParams6.bottomMargin);
i5 = View.combineMeasuredStates(i5, this.f.getMeasuredState());
}
int m = m();
int max2 = max + Math.max(m, i6);
iArr[!b ? 1 : 0] = Math.max(0, m - i6);
View view = this.d;
if (view != null && view.getParent() == this && view.getVisibility() != 8) {
max2 += c(this.d, i, max2, i2, 0, iArr);
int measuredHeight4 = this.d.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams7 = (ViewGroup.MarginLayoutParams) this.d.getLayoutParams();
i4 = Math.max(i4, measuredHeight4 + marginLayoutParams7.topMargin + marginLayoutParams7.bottomMargin);
i5 = View.combineMeasuredStates(i5, this.d.getMeasuredState());
}
ImageView imageView = this.h;
if (imageView != null && imageView.getParent() == this && imageView.getVisibility() != 8) {
max2 += c(this.h, i, max2, i2, 0, iArr);
int measuredHeight5 = this.h.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams8 = (ViewGroup.MarginLayoutParams) this.h.getLayoutParams();
i4 = Math.max(i4, measuredHeight5 + marginLayoutParams8.topMargin + marginLayoutParams8.bottomMargin);
i5 = View.combineMeasuredStates(i5, this.h.getMeasuredState());
}
int childCount = getChildCount();
for (int i12 = 0; i12 < childCount; i12++) {
View childAt = getChildAt(i12);
if (((LWm) childAt.getLayoutParams()).c == 0 && childAt != null && childAt.getParent() == this && childAt.getVisibility() != 8) {
max2 += c(childAt, i, max2, i2, 0, iArr);
int measuredHeight6 = childAt.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams9 = (ViewGroup.MarginLayoutParams) childAt.getLayoutParams();
i4 = Math.max(i4, measuredHeight6 + marginLayoutParams9.topMargin + marginLayoutParams9.bottomMargin);
i5 = View.combineMeasuredStates(i5, childAt.getMeasuredState());
}
}
int i13 = this.r + this.f6379o;
int i14 = this.p + this.k;
TextView textView = this.W;
if (textView == null || textView.getParent() != this || textView.getVisibility() == 8) {
i7 = 0;
i8 = i5;
i9 = 0;
} else {
c(this.W, i, max2 + i14, i2, i13, iArr);
int measuredWidth4 = this.W.getMeasuredWidth();
ViewGroup.MarginLayoutParams marginLayoutParams10 = (ViewGroup.MarginLayoutParams) this.W.getLayoutParams();
int ry_ = CYM.ry_(marginLayoutParams10) + CYM.rx_(marginLayoutParams10);
int measuredHeight7 = this.W.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams11 = (ViewGroup.MarginLayoutParams) this.W.getLayoutParams();
i7 = measuredHeight7 + marginLayoutParams11.topMargin + marginLayoutParams11.bottomMargin;
i8 = View.combineMeasuredStates(i5, this.W.getMeasuredState());
i9 = measuredWidth4 + ry_;
}
TextView textView2 = this.Q;
if (textView2 == null || textView2.getParent() != this || textView2.getVisibility() == 8) {
i10 = i8;
} else {
i9 = Math.max(i9, c(this.Q, i, max2 + i14, i2, i7 + i13, iArr));
int measuredHeight8 = this.Q.getMeasuredHeight();
ViewGroup.MarginLayoutParams marginLayoutParams12 = (ViewGroup.MarginLayoutParams) this.Q.getLayoutParams();
i7 += measuredHeight8 + marginLayoutParams12.topMargin + marginLayoutParams12.bottomMargin;
i10 = View.combineMeasuredStates(i8, this.Q.getMeasuredState());
}
int max3 = Math.max(i4, i7);
int paddingLeft = getPaddingLeft();
int paddingRight = getPaddingRight();
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int resolveSizeAndState = View.resolveSizeAndState(Math.max(max2 + i9 + paddingLeft + paddingRight, getSuggestedMinimumWidth()), i, (-16777216) & i10);
int resolveSizeAndState2 = View.resolveSizeAndState(Math.max(max3 + paddingTop + paddingBottom, getSuggestedMinimumHeight()), i2, i10 << 16);
if (this.z) {
int childCount2 = getChildCount();
for (int i15 = 0; i15 < childCount2; i15++) {
View childAt2 = getChildAt(i15);
if (childAt2 == null || childAt2.getParent() != this || childAt2.getVisibility() == 8 || childAt2.getMeasuredWidth() <= 0 || childAt2.getMeasuredHeight() <= 0) {
}
}
setMeasuredDimension(resolveSizeAndState, i11);
}
i11 = resolveSizeAndState2;
setMeasuredDimension(resolveSizeAndState, i11);
}
/* JADX WARN: Removed duplicated region for block: B:104:0x018b */
/* JADX WARN: Removed duplicated region for block: B:106:0x0192 */
/* JADX WARN: Removed duplicated region for block: B:109:0x01a5 */
/* JADX WARN: Removed duplicated region for block: B:114:0x01c8 */
/* JADX WARN: Removed duplicated region for block: B:121:0x0216 */
/* JADX WARN: Removed duplicated region for block: B:133:0x0288 */
/* JADX WARN: Removed duplicated region for block: B:150:0x0207 */
/* JADX WARN: Removed duplicated region for block: B:155:0x0195 */
/* JADX WARN: Removed duplicated region for block: B:156:0x018e */
/* JADX WARN: Removed duplicated region for block: B:157:0x017b */
/* JADX WARN: Removed duplicated region for block: B:158:0x0160 */
/* JADX WARN: Removed duplicated region for block: B:162:0x00ba */
/* JADX WARN: Removed duplicated region for block: B:163:0x00ab */
/* JADX WARN: Removed duplicated region for block: B:22:0x0073 */
/* JADX WARN: Removed duplicated region for block: B:23:0x007a */
/* JADX WARN: Removed duplicated region for block: B:31:0x0092 */
/* JADX WARN: Removed duplicated region for block: B:32:0x0099 */
/* JADX WARN: Removed duplicated region for block: B:35:0x00a6 */
/* JADX WARN: Removed duplicated region for block: B:38:0x00b5 */
/* JADX WARN: Removed duplicated region for block: B:46:0x00f1 */
/* JADX WARN: Removed duplicated region for block: B:47:0x00f8 */
/* JADX WARN: Removed duplicated region for block: B:55:0x0112 */
/* JADX WARN: Removed duplicated region for block: B:56:0x0119 */
/* JADX WARN: Removed duplicated region for block: B:66:0x013a */
/* JADX WARN: Removed duplicated region for block: B:72:0x014b */
/* JADX WARN: Removed duplicated region for block: B:74:0x0163 */
/* JADX WARN: Removed duplicated region for block: B:76:0x017f A[ADDED_TO_REGION] */
/* JADX WARN: Removed duplicated region for block: B:81:0x0304 A[LOOP:0: B:80:0x0302->B:81:0x0304, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:85:0x0326 A[LOOP:1: B:84:0x0324->B:85:0x0326, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:89:0x034a A[LOOP:2: B:88:0x0348->B:89:0x034a, LOOP_END] */
/* JADX WARN: Removed duplicated region for block: B:93:0x038a */
/* JADX WARN: Removed duplicated region for block: B:98:0x0399 A[LOOP:3: B:97:0x0397->B:98:0x0399, LOOP_END] */
@Override // android.view.ViewGroup, android.view.View
/*
Code decompiled incorrectly, please refer to instructions dump.
To view partially-correct add '--show-bad-code' argument
*/
public void onLayout(boolean r19, int r20, int r21, int r22, int r23) {
/*
Method dump skipped, instructions count: 942
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: androidx.appcompat.widget.Toolbar.onLayout(boolean, int, int, int, int):void");
}
private int a(View view, int i, int[] iArr, int i2) {
LWm lWm = (LWm) view.getLayoutParams();
int i3 = ((ViewGroup.MarginLayoutParams) lWm).leftMargin - iArr[0];
int max = i + Math.max(0, i3);
iArr[0] = Math.max(0, -i3);
int a = a(view, i2);
int measuredWidth = view.getMeasuredWidth();
view.layout(max, a, max + measuredWidth, view.getMeasuredHeight() + a);
return max + measuredWidth + ((ViewGroup.MarginLayoutParams) lWm).rightMargin;
}
private int d(View view, int i, int[] iArr, int i2) {
LWm lWm = (LWm) view.getLayoutParams();
int i3 = ((ViewGroup.MarginLayoutParams) lWm).rightMargin - iArr[1];
int max = i - Math.max(0, i3);
iArr[1] = Math.max(0, -i3);
int a = a(view, i2);
int measuredWidth = view.getMeasuredWidth();
view.layout(max - measuredWidth, a, max, view.getMeasuredHeight() + a);
return max - (measuredWidth + ((ViewGroup.MarginLayoutParams) lWm).leftMargin);
}
private int a(View view, int i) {
LWm lWm = (LWm) view.getLayoutParams();
int measuredHeight = view.getMeasuredHeight();
int i2 = i > 0 ? (measuredHeight - i) / 2 : 0;
int i3 = lWm.d & 112;
if (i3 != 16 && i3 != 48 && i3 != 80) {
i3 = this.G & 112;
}
if (i3 == 48) {
return getPaddingTop() - i2;
}
if (i3 == 80) {
return (((getHeight() - getPaddingBottom()) - measuredHeight) - ((ViewGroup.MarginLayoutParams) lWm).bottomMargin) - i2;
}
int paddingTop = getPaddingTop();
int paddingBottom = getPaddingBottom();
int height = getHeight();
int i4 = (((height - paddingTop) - paddingBottom) - measuredHeight) / 2;
if (i4 < ((ViewGroup.MarginLayoutParams) lWm).topMargin) {
i4 = ((ViewGroup.MarginLayoutParams) lWm).topMargin;
} else {
int i5 = (((height - paddingBottom) - measuredHeight) - i4) - paddingTop;
if (i5 < ((ViewGroup.MarginLayoutParams) lWm).bottomMargin) {
i4 = Math.max(0, i4 - (((ViewGroup.MarginLayoutParams) lWm).bottomMargin - i5));
}
}
return paddingTop + i4;
}
private void c(List<View> list, int i) {
boolean z = ViewCompat.m(this) == 1;
int childCount = getChildCount();
int c = HpP.c(i, ViewCompat.m(this));
list.clear();
if (!z) {
for (int i2 = 0; i2 < childCount; i2++) {
View childAt = getChildAt(i2);
LWm lWm = (LWm) childAt.getLayoutParams();
if (lWm.c == 0 && childAt != null && childAt.getParent() == this && childAt.getVisibility() != 8 && b(lWm.d) == c) {
list.add(childAt);
}
}
return;
}
for (int i3 = childCount - 1; i3 >= 0; i3--) {
View childAt2 = getChildAt(i3);
LWm lWm2 = (LWm) childAt2.getLayoutParams();
if (lWm2.c == 0 && childAt2 != null && childAt2.getParent() == this && childAt2.getVisibility() != 8 && b(lWm2.d) == c) {
list.add(childAt2);
}
}
}
private int b(int i) {
int m = ViewCompat.m(this);
int c = HpP.c(i, m) & 7;
return (c == 1 || c == 3 || c == 5) ? c : m == 1 ? 5 : 3;
}
private static LWm jN_(ViewGroup.LayoutParams layoutParams) {
if (layoutParams instanceof LWm) {
return new LWm((LWm) layoutParams);
}
if (layoutParams instanceof pwE.HBt) {
return new LWm((pwE.HBt) layoutParams);
}
if (layoutParams instanceof ViewGroup.MarginLayoutParams) {
return new LWm((ViewGroup.MarginLayoutParams) layoutParams);
}
return new LWm(layoutParams);
}
protected static LWm b() {
return new LWm();
}
@Override // android.view.ViewGroup
protected boolean checkLayoutParams(ViewGroup.LayoutParams layoutParams) {
return super.checkLayoutParams(layoutParams) && (layoutParams instanceof LWm);
}
public void setCollapsible(boolean z) {
this.z = z;
requestLayout();
}
public void setMenuCallbacks(InterfaceC15933jjG.Sts sts, NoP.Sts sts2) {
this.s = sts;
this.i = sts2;
ActionMenuView actionMenuView = this.f;
if (actionMenuView != null) {
actionMenuView.setMenuCallbacks(sts, sts2);
}
}
public final ArrayList<MenuItem> e() {
ArrayList<MenuItem> arrayList = new ArrayList<>();
c();
Menu fp_ = this.f.fp_();
for (int i = 0; i < fp_.size(); i++) {
arrayList.add(fp_.getItem(i));
}
return arrayList;
}
@Override // o.RIz
public void addMenuProvider(AHZ ahz) {
C7587crD c7587crD = this.g;
c7587crD.b.add(ahz);
c7587crD.a.run();
}
@Override // o.RIz
public void removeMenuProvider(AHZ ahz) {
this.g.c(ahz);
}
final void j() {
OnBackInvokedDispatcher onBackInvokedDispatcher;
if (Build.VERSION.SDK_INT >= 33) {
OnBackInvokedDispatcher jQ_ = IeS.jQ_(this);
RVV rvv = this.a;
boolean z = (rvv == null || rvv.b == null || jQ_ == null || !ViewCompat.H(this) || !this.w) ? false : true;
if (z && this.u == null) {
if (this.v == null) {
this.v = IeS.jR_(new Runnable(this) { // from class: o.GbZ
public final Toolbar b;
@Override // java.lang.Runnable
public final void run() {
Toolbar.RVV rvv2 = this.b.a;
MenuItemImpl menuItemImpl = rvv2 == null ? null : rvv2.b;
if (menuItemImpl != null) {
menuItemImpl.collapseActionView();
}
}
{
this.b = this;
}
});
}
IeS.a(jQ_, this.v);
this.u = jQ_;
return;
}
if (z || (onBackInvokedDispatcher = this.u) == null) {
return;
}
IeS.c(onBackInvokedDispatcher, this.v);
this.u = null;
}
}
/* loaded from: classes.dex */
public static class LWm extends pwE.HBt {
int c;
public LWm(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.c = 0;
}
public LWm() {
this.c = 0;
this.d = 8388627;
}
public LWm(LWm lWm) {
super((pwE.HBt) lWm);
this.c = 0;
this.c = lWm.c;
}
public LWm(pwE.HBt hBt) {
super(hBt);
this.c = 0;
}
public LWm(ViewGroup.MarginLayoutParams marginLayoutParams) {
super(marginLayoutParams);
this.c = 0;
((ViewGroup.MarginLayoutParams) this).leftMargin = marginLayoutParams.leftMargin;
((ViewGroup.MarginLayoutParams) this).topMargin = marginLayoutParams.topMargin;
((ViewGroup.MarginLayoutParams) this).rightMargin = marginLayoutParams.rightMargin;
((ViewGroup.MarginLayoutParams) this).bottomMargin = marginLayoutParams.bottomMargin;
}
public LWm(ViewGroup.LayoutParams layoutParams) {
super(layoutParams);
this.c = 0;
}
}
/* loaded from: classes.dex */
public static class Sts extends XgG {
public static final Parcelable.Creator<Sts> CREATOR = new Parcelable.ClassLoaderCreator<Sts>() { // from class: androidx.appcompat.widget.Toolbar.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];
}
};
int c;
boolean e;
public Sts(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.c = parcel.readInt();
this.e = parcel.readInt() != 0;
}
public Sts(Parcelable parcelable) {
super(parcelable);
}
@Override // o.XgG, android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.c);
parcel.writeInt(this.e ? 1 : 0);
}
}
/* loaded from: classes.dex */
public class RVV implements InterfaceC15933jjG {
final Toolbar a;
public MenuItemImpl b;
private NoP d;
@Override // o.InterfaceC15933jjG
public final void Km_(Parcelable parcelable) {
}
@Override // o.InterfaceC15933jjG
public final Parcelable Kn_() {
return null;
}
@Override // o.InterfaceC15933jjG
public final int a() {
return 0;
}
@Override // o.InterfaceC15933jjG
public final void b(NoP noP, boolean z) {
}
@Override // o.InterfaceC15933jjG
public final void c(InterfaceC15933jjG.Sts sts) {
}
@Override // o.InterfaceC15933jjG
public final boolean d(SubMenuC16744qqn subMenuC16744qqn) {
return false;
}
@Override // o.InterfaceC15933jjG
public final boolean e() {
return false;
}
RVV(Toolbar toolbar) {
this.a = toolbar;
}
@Override // o.InterfaceC15933jjG
public final void a(Context context, NoP noP) {
MenuItemImpl menuItemImpl;
NoP noP2 = this.d;
if (noP2 != null && (menuItemImpl = this.b) != null) {
noP2.c(menuItemImpl);
}
this.d = noP;
}
@Override // o.InterfaceC15933jjG
public final void a(boolean z) {
if (this.b != null) {
NoP noP = this.d;
if (noP != null) {
int size = noP.size();
for (int i = 0; i < size; i++) {
if (this.d.getItem(i) == this.b) {
return;
}
}
}
d(this.b);
}
}
@Override // o.InterfaceC15933jjG
public final boolean c(MenuItemImpl menuItemImpl) {
this.a.o_();
ViewParent parent = this.a.e.getParent();
Toolbar toolbar = this.a;
if (parent != toolbar) {
if (parent instanceof ViewGroup) {
((ViewGroup) parent).removeView(toolbar.e);
}
Toolbar toolbar2 = this.a;
toolbar2.addView(toolbar2.e);
}
this.a.d = menuItemImpl.getActionView();
this.b = menuItemImpl;
ViewParent parent2 = this.a.d.getParent();
Toolbar toolbar3 = this.a;
if (parent2 != toolbar3) {
if (parent2 instanceof ViewGroup) {
((ViewGroup) parent2).removeView(toolbar3.d);
}
LWm b = Toolbar.b();
b.d = (this.a.c & 112) | 8388611;
b.c = 2;
this.a.d.setLayoutParams(b);
Toolbar toolbar4 = this.a;
toolbar4.addView(toolbar4.d);
}
Toolbar toolbar5 = this.a;
for (int childCount = toolbar5.getChildCount() - 1; childCount >= 0; childCount--) {
View childAt = toolbar5.getChildAt(childCount);
if (((LWm) childAt.getLayoutParams()).c != 2 && childAt != toolbar5.f) {
toolbar5.removeViewAt(childCount);
toolbar5.b.add(childAt);
}
}
this.a.requestLayout();
menuItemImpl.b = true;
menuItemImpl.e.c(false);
if (this.a.d instanceof JPw) {
((JPw) this.a.d).c();
}
this.a.j();
return true;
}
@Override // o.InterfaceC15933jjG
public final boolean d(MenuItemImpl menuItemImpl) {
if (this.a.d instanceof JPw) {
((JPw) this.a.d).b();
}
Toolbar toolbar = this.a;
toolbar.removeView(toolbar.d);
Toolbar toolbar2 = this.a;
toolbar2.removeView(toolbar2.e);
this.a.d = null;
Toolbar toolbar3 = this.a;
for (int size = toolbar3.b.size() - 1; size >= 0; size--) {
toolbar3.addView(toolbar3.b.get(size));
}
toolbar3.b.clear();
this.b = null;
this.a.requestLayout();
menuItemImpl.b = false;
menuItemImpl.e.c(false);
this.a.j();
return true;
}
}
/* JADX INFO: Access modifiers changed from: package-private */
/* loaded from: classes.dex */
public static class IeS {
static void a(Object obj, Object obj2) {
((OnBackInvokedDispatcher) obj).registerOnBackInvokedCallback(1000000, (OnBackInvokedCallback) obj2);
}
static void c(Object obj, Object obj2) {
((OnBackInvokedDispatcher) obj).unregisterOnBackInvokedCallback((OnBackInvokedCallback) obj2);
}
static OnBackInvokedDispatcher jQ_(View view) {
return view.findOnBackInvokedDispatcher();
}
static OnBackInvokedCallback jR_(Runnable runnable) {
Objects.requireNonNull(runnable);
return new jbe(runnable);
}
}
private int o() {
C1292Ztc c1292Ztc = this.B;
if (c1292Ztc != null) {
return c1292Ztc.a ? c1292Ztc.i : c1292Ztc.g;
}
return 0;
}
@Override // android.view.ViewGroup
protected /* synthetic */ ViewGroup.LayoutParams generateDefaultLayoutParams() {
return new LWm();
}
private int k() {
C1292Ztc c1292Ztc = this.B;
if (c1292Ztc != null) {
return c1292Ztc.a ? c1292Ztc.g : c1292Ztc.i;
}
return 0;
}
@Override // android.view.ViewGroup
public /* synthetic */ ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
return new LWm(getContext(), attributeSet);
}
private int m() {
NoP noP;
ActionMenuView actionMenuView = this.f;
if (actionMenuView != null && (noP = actionMenuView.d) != null && noP.hasVisibleItems()) {
return Math.max(o(), Math.max(this.D, 0));
}
return o();
}
public void a(int i) {
JHJ jhj = new JHJ(getContext());
c();
jhj.inflate(i, this.f.fp_());
}
public void setOnMenuItemClickListener(HBt hBt) {
this.m = hBt;
}
}