what-the-bank/sources/com/google/android/material/appbar/MaterialToolbar.java

295 lines
11 KiB
Java
Raw Permalink Normal View History

2024-07-27 18:17:47 +07:00
package com.google.android.material.appbar;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.util.Pair;
import android.view.Menu;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.widget.Toolbar;
import java.util.Collections;
import java.util.List;
import o.C15753iLf;
import o.C17052tZT;
import o.C4363bXv;
import o.Lot;
import o.NoP;
import o.Tlu;
/* loaded from: classes2.dex */
public class MaterialToolbar extends Toolbar {
public Integer s;
private Boolean v;
private boolean w;
private ImageView.ScaleType x;
private boolean z;
private static final int y = C17052tZT.NHB.Widget_MaterialComponents_Toolbar;
private static final ImageView.ScaleType[] u = {ImageView.ScaleType.MATRIX, ImageView.ScaleType.FIT_XY, ImageView.ScaleType.FIT_START, ImageView.ScaleType.FIT_CENTER, ImageView.ScaleType.FIT_END, ImageView.ScaleType.CENTER, ImageView.ScaleType.CENTER_CROP, ImageView.ScaleType.CENTER_INSIDE};
public MaterialToolbar(Context context) {
this(context, null);
}
public MaterialToolbar(Context context, AttributeSet attributeSet) {
this(context, attributeSet, C17052tZT.IeS.toolbarStyle);
}
/* 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 MaterialToolbar(android.content.Context r10, android.util.AttributeSet r11, int r12) {
/*
r9 = this;
int r6 = com.google.android.material.appbar.MaterialToolbar.y
android.content.Context r10 = o.hdZ.MQ_(r10, r11, r12, r6)
r9.<init>(r10, r11, r12)
android.content.Context r10 = r9.getContext()
int[] r7 = o.C17052tZT.jNh.MaterialToolbar
r8 = 0
int[] r5 = new int[r8]
o.uqW.Kb_(r10, r11, r12, r6)
r0 = r10
r1 = r11
r2 = r7
r3 = r12
r4 = r6
o.uqW.Kc_(r0, r1, r2, r3, r4, r5)
android.content.res.TypedArray r11 = r10.obtainStyledAttributes(r11, r7, r12, r6)
int r12 = o.C17052tZT.jNh.MaterialToolbar_navigationIconTint
boolean r12 = r11.hasValue(r12)
r0 = -1
if (r12 == 0) goto L33
int r12 = o.C17052tZT.jNh.MaterialToolbar_navigationIconTint
int r12 = r11.getColor(r12, r0)
r9.setNavigationIconTint(r12)
L33:
int r12 = o.C17052tZT.jNh.MaterialToolbar_titleCentered
boolean r12 = r11.getBoolean(r12, r8)
r9.z = r12
int r12 = o.C17052tZT.jNh.MaterialToolbar_subtitleCentered
boolean r12 = r11.getBoolean(r12, r8)
r9.w = r12
int r12 = o.C17052tZT.jNh.MaterialToolbar_logoScaleType
int r12 = r11.getInt(r12, r0)
if (r12 < 0) goto L54
android.widget.ImageView$ScaleType[] r0 = com.google.android.material.appbar.MaterialToolbar.u
int r1 = r0.length
if (r12 >= r1) goto L54
r12 = r0[r12]
r9.x = r12
L54:
int r12 = o.C17052tZT.jNh.MaterialToolbar_logoAdjustViewBounds
boolean r12 = r11.hasValue(r12)
if (r12 == 0) goto L68
int r12 = o.C17052tZT.jNh.MaterialToolbar_logoAdjustViewBounds
boolean r12 = r11.getBoolean(r12, r8)
java.lang.Boolean r12 = java.lang.Boolean.valueOf(r12)
r9.v = r12
L68:
r11.recycle()
android.graphics.drawable.Drawable r11 = r9.getBackground()
if (r11 == 0) goto L75
boolean r12 = r11 instanceof android.graphics.drawable.ColorDrawable
if (r12 == 0) goto La4
L75:
o.bXv r12 = new o.bXv
r12.<init>()
if (r11 == 0) goto L82
android.graphics.drawable.ColorDrawable r11 = (android.graphics.drawable.ColorDrawable) r11
int r8 = r11.getColor()
L82:
android.content.res.ColorStateList r11 = android.content.res.ColorStateList.valueOf(r8)
o.bXv$LWm r0 = r12.B
android.content.res.ColorStateList r0 = r0.d
if (r0 == r11) goto L97
o.bXv$LWm r0 = r12.B
r0.d = r11
int[] r11 = r12.getState()
r12.onStateChange(r11)
L97:
r12.d(r10)
float r10 = androidx.core.view.ViewCompat.i(r9)
r12.n(r10)
androidx.core.view.ViewCompat.sn_(r9, r12)
La4:
return
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.appbar.MaterialToolbar.<init>(android.content.Context, android.util.AttributeSet, int):void");
}
@Override // androidx.appcompat.widget.Toolbar
public final void a(int i) {
Menu jO_ = jO_();
boolean z = jO_ instanceof NoP;
if (z) {
NoP noP = (NoP) jO_;
if (!noP.t) {
noP.t = true;
noP.n = false;
noP.p = false;
}
}
super.a(i);
if (z) {
NoP noP2 = (NoP) jO_;
noP2.t = false;
if (noP2.n) {
noP2.n = false;
noP2.c(noP2.p);
}
}
}
@Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
ImageView imageView;
Drawable drawable;
super.onLayout(z, i, i2, i3, i4);
int i5 = 0;
ImageView imageView2 = null;
if (this.z || this.w) {
List<TextView> b = C15753iLf.b(this, this.q);
TextView textView = b.isEmpty() ? null : (TextView) Collections.min(b, C15753iLf.a);
List<TextView> b2 = C15753iLf.b(this, this.l);
TextView textView2 = b2.isEmpty() ? null : (TextView) Collections.max(b2, C15753iLf.a);
if (textView != null || textView2 != null) {
int measuredWidth = getMeasuredWidth();
int i6 = measuredWidth / 2;
int paddingLeft = getPaddingLeft();
int paddingRight = measuredWidth - getPaddingRight();
for (int i7 = 0; i7 < getChildCount(); i7++) {
View childAt = getChildAt(i7);
if (childAt.getVisibility() != 8 && childAt != textView && childAt != textView2) {
if (childAt.getRight() < i6 && childAt.getRight() > paddingLeft) {
paddingLeft = childAt.getRight();
}
if (childAt.getLeft() > i6 && childAt.getLeft() < paddingRight) {
paddingRight = childAt.getLeft();
}
}
}
Pair<Integer, Integer> pair = new Pair<>(Integer.valueOf(paddingLeft), Integer.valueOf(paddingRight));
if (this.z && textView != null) {
HX_(textView, pair);
}
if (this.w && textView2 != null) {
HX_(textView2, pair);
}
}
}
ImageView imageView3 = this.h;
Drawable drawable2 = imageView3 != null ? imageView3.getDrawable() : null;
if (drawable2 != null) {
while (true) {
if (i5 >= getChildCount()) {
break;
}
View childAt2 = getChildAt(i5);
if ((childAt2 instanceof ImageView) && (drawable = (imageView = (ImageView) childAt2).getDrawable()) != null && drawable.getConstantState() != null && drawable.getConstantState().equals(drawable2.getConstantState())) {
imageView2 = imageView;
break;
}
i5++;
}
}
if (imageView2 != null) {
Boolean bool = this.v;
if (bool != null) {
imageView2.setAdjustViewBounds(bool.booleanValue());
}
ImageView.ScaleType scaleType = this.x;
if (scaleType != null) {
imageView2.setScaleType(scaleType);
}
}
}
private void HX_(View view, Pair<Integer, Integer> pair) {
int measuredWidth = getMeasuredWidth();
int measuredWidth2 = view.getMeasuredWidth();
int i = (measuredWidth / 2) - (measuredWidth2 / 2);
int i2 = measuredWidth2 + i;
int max = Math.max(Math.max(((Integer) pair.first).intValue() - i, 0), Math.max(i2 - ((Integer) pair.second).intValue(), 0));
if (max > 0) {
i += max;
i2 -= max;
view.measure(View.MeasureSpec.makeMeasureSpec(i2 - i, 1073741824), view.getMeasuredHeightAndState());
}
view.layout(i, view.getTop(), i2, view.getBottom());
}
public void setLogoScaleType(ImageView.ScaleType scaleType) {
if (this.x != scaleType) {
this.x = scaleType;
requestLayout();
}
}
public void setLogoAdjustViewBounds(boolean z) {
Boolean bool = this.v;
if (bool == null || bool.booleanValue() != z) {
this.v = Boolean.valueOf(z);
requestLayout();
}
}
@Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View
public 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);
}
}
@Override // androidx.appcompat.widget.Toolbar
public void setNavigationIcon(Drawable drawable) {
if (drawable != null && this.s != null) {
drawable = Tlu.pI_(drawable.mutate());
Tlu.pE_(drawable, this.s.intValue());
}
super.setNavigationIcon(drawable);
}
public void setNavigationIconTint(int i) {
this.s = Integer.valueOf(i);
ImageButton imageButton = this.j;
Drawable drawable = imageButton != null ? imageButton.getDrawable() : null;
if (drawable != null) {
setNavigationIcon(drawable);
}
}
public void setTitleCentered(boolean z) {
if (this.z != z) {
this.z = z;
requestLayout();
}
}
public void setSubtitleCentered(boolean z) {
if (this.w != z) {
this.w = z;
requestLayout();
}
}
}