what-the-bank/sources/com/google/android/material/bottomappbar/BottomAppBar.java

908 lines
36 KiB
Java

package com.google.android.material.bottomappbar;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
import androidx.appcompat.widget.ActionMenuView;
import androidx.appcompat.widget.Toolbar;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
import androidx.core.view.ViewCompat;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
import com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import o.C17052tZT;
import o.C4363bXv;
import o.C6217cMa;
import o.DAZ;
import o.DuC;
import o.Lot;
import o.Tlu;
import o.XgG;
import o.lnR;
import o.sjh;
import o.vXU;
/* loaded from: classes2.dex */
public class BottomAppBar extends Toolbar implements CoordinatorLayout.IeS {
final int A;
lnR<FloatingActionButton> B;
int C;
boolean D;
Animator E;
final C4363bXv F;
boolean G;
Animator H;
final boolean I;
int J;
final boolean K;
final boolean L;
int M;
final boolean N;
private Behavior O;
private int Q;
private int T;
private int U;
private Integer V;
int s;
AnimatorListenerAdapter u;
int v;
ArrayList<Object> w;
int x;
int y;
boolean z;
private static final int S = C17052tZT.NHB.Widget_MaterialComponents_BottomAppBar;
private static final int R = C17052tZT.IeS.motionDurationLong2;
private static final int P = C17052tZT.IeS.motionEasingEmphasizedInterpolator;
@Override // androidx.appcompat.widget.Toolbar
public void setSubtitle(CharSequence charSequence) {
}
@Override // androidx.appcompat.widget.Toolbar
public void setTitle(CharSequence charSequence) {
}
@Override // androidx.coordinatorlayout.widget.CoordinatorLayout.IeS
public final /* synthetic */ CoordinatorLayout.Sts a() {
if (this.O == null) {
this.O = new Behavior();
}
return this.O;
}
public BottomAppBar(Context context) {
this(context, null);
}
public BottomAppBar(Context context, AttributeSet attributeSet) {
this(context, attributeSet, C17052tZT.IeS.bottomAppBarStyle);
}
/* 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 BottomAppBar(android.content.Context r13, android.util.AttributeSet r14, int r15) {
/*
Method dump skipped, instructions count: 324
To view this dump add '--comments-level debug' option
*/
throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.bottomappbar.BottomAppBar.<init>(android.content.Context, android.util.AttributeSet, int):void");
}
@Override // androidx.appcompat.widget.Toolbar
public void setNavigationIcon(Drawable drawable) {
if (drawable != null && this.V != null) {
drawable = Tlu.pI_(drawable.mutate());
Tlu.pE_(drawable, this.V.intValue());
}
super.setNavigationIcon(drawable);
}
public void setNavigationIconTint(int i) {
this.V = Integer.valueOf(i);
ImageButton imageButton = this.j;
Drawable drawable = imageButton != null ? imageButton.getDrawable() : null;
if (drawable != null) {
setNavigationIcon(drawable);
}
}
public void setFabAlignmentMode(int i) {
setFabAlignmentModeAndReplaceMenu(i, 0);
}
public void setFabAlignmentModeAndReplaceMenu(int i, int i2) {
this.M = i2;
this.G = true;
a(i, this.D);
if (this.y != i && ViewCompat.G(this)) {
Animator animator = this.H;
if (animator != null) {
animator.cancel();
}
ArrayList arrayList = new ArrayList();
if (this.T == 1) {
View i3 = i();
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(i3 instanceof FloatingActionButton ? (FloatingActionButton) i3 : null, "translationX", b(i));
Context context = getContext();
int i4 = R;
TypedValue typedValue = new TypedValue();
TypedValue typedValue2 = context.getTheme().resolveAttribute(i4, typedValue, true) ? typedValue : null;
int i5 = 300;
if (typedValue2 != null && typedValue2.type == 16) {
i5 = typedValue2.data;
}
ofFloat.setDuration(i5);
arrayList.add(ofFloat);
} else {
View i6 = i();
FloatingActionButton floatingActionButton = i6 instanceof FloatingActionButton ? (FloatingActionButton) i6 : null;
if (floatingActionButton != null) {
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
if (!floatingActionButton.a.b()) {
this.s++;
AnonymousClass5 anonymousClass5 = new AnonymousClass5(this, i);
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
floatingActionButton.a.d(new FloatingActionButton.AnonymousClass5(floatingActionButton, anonymousClass5), true);
}
}
}
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(arrayList);
animatorSet.setInterpolator(DAZ.Kh_(getContext(), P, C6217cMa.e));
this.H = animatorSet;
animatorSet.addListener(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.bottomappbar.BottomAppBar.3
private BottomAppBar d;
{
this.d = this;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator2) {
BottomAppBar bottomAppBar = this.d;
int i7 = bottomAppBar.s - 1;
bottomAppBar.s = i7;
if (i7 == 0) {
ArrayList<Object> arrayList2 = bottomAppBar.w;
}
this.d.H = null;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator2) {
BottomAppBar bottomAppBar = this.d;
int i7 = bottomAppBar.s;
bottomAppBar.s = i7 + 1;
if (i7 == 0) {
ArrayList<Object> arrayList2 = bottomAppBar.w;
}
}
});
this.H.start();
}
this.y = i;
}
public void setFabAnchorMode(int i) {
this.v = i;
k();
View i2 = i();
if (i2 != null) {
c(this, i2);
i2.requestLayout();
this.F.invalidateSelf();
}
}
static void c(BottomAppBar bottomAppBar, View view) {
CoordinatorLayout.RVV rvv = (CoordinatorLayout.RVV) view.getLayoutParams();
rvv.d = 17;
if (bottomAppBar.v == 1) {
rvv.d |= 48;
}
if (bottomAppBar.v == 0) {
rvv.d |= 80;
}
}
public void setMenuAlignmentMode(int i) {
if (this.U != i) {
this.U = i;
ActionMenuView o2 = o();
if (o2 != null) {
new AnonymousClass6(this, o2, this.y, l()).run();
}
}
}
public void setBackgroundTint(ColorStateList colorStateList) {
Tlu.pF_(this.F, colorStateList);
}
public void setFabAlignmentModeEndMargin(int i) {
if (this.Q != i) {
this.Q = i;
k();
}
}
@Override // android.view.View
public void setElevation(float f) {
this.F.n(f);
int i = this.F.B.m;
C4363bXv c4363bXv = this.F;
int cos = (int) (c4363bXv.B.f8554o * Math.cos(Math.toRadians(c4363bXv.B.n)));
if (this.O == null) {
this.O = new Behavior();
}
Behavior behavior = this.O;
behavior.c = i - cos;
if (behavior.e == 1) {
setTranslationY(behavior.a + r6);
}
}
final View i() {
if (!(getParent() instanceof CoordinatorLayout)) {
return null;
}
for (View view : ((CoordinatorLayout) getParent()).e(this)) {
if ((view instanceof FloatingActionButton) || (view instanceof ExtendedFloatingActionButton)) {
return view;
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.google.android.material.bottomappbar.BottomAppBar$5, reason: invalid class name */
/* loaded from: classes2.dex */
public final class AnonymousClass5 extends FloatingActionButton.HBt {
private int a;
final BottomAppBar b;
AnonymousClass5(BottomAppBar bottomAppBar, int i) {
this.b = bottomAppBar;
this.a = i;
}
@Override // com.google.android.material.floatingactionbutton.FloatingActionButton.HBt
public final void e(FloatingActionButton floatingActionButton) {
floatingActionButton.setTranslationX(this.b.b(this.a));
FloatingActionButton.HBt hBt = new FloatingActionButton.HBt(this) { // from class: com.google.android.material.bottomappbar.BottomAppBar.5.4
private AnonymousClass5 b;
{
this.b = this;
}
@Override // com.google.android.material.floatingactionbutton.FloatingActionButton.HBt
public final void d() {
BottomAppBar bottomAppBar = this.b.b;
int i = bottomAppBar.s - 1;
bottomAppBar.s = i;
if (i == 0) {
ArrayList<Object> arrayList = bottomAppBar.w;
}
}
};
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
floatingActionButton.a.e(new FloatingActionButton.AnonymousClass5(floatingActionButton, hBt), true);
}
}
final void a(int i, boolean z) {
if (!ViewCompat.G(this)) {
this.G = false;
int i2 = this.M;
if (i2 != 0) {
this.M = 0;
jO_().clear();
a(i2);
return;
}
return;
}
Animator animator = this.E;
if (animator != null) {
animator.cancel();
}
ArrayList arrayList = new ArrayList();
if (!l()) {
i = 0;
z = false;
}
ActionMenuView o2 = o();
if (o2 != null) {
Context context = getContext();
int i3 = R;
TypedValue typedValue = new TypedValue();
if (!context.getTheme().resolveAttribute(i3, typedValue, true)) {
typedValue = null;
}
int i4 = 300;
if (typedValue != null && typedValue.type == 16) {
i4 = typedValue.data;
}
float f = i4;
ObjectAnimator ofFloat = ObjectAnimator.ofFloat(o2, "alpha", 1.0f);
ofFloat.setDuration(0.8f * f);
if (Math.abs(o2.getTranslationX() - d(o2, i, z)) > 1.0f) {
ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(o2, "alpha", BitmapDescriptorFactory.HUE_RED);
ofFloat2.setDuration(f * 0.2f);
ofFloat2.addListener(new AnimatorListenerAdapter(this, o2, i, z) { // from class: com.google.android.material.bottomappbar.BottomAppBar.10
private boolean a;
private BottomAppBar b;
private ActionMenuView c;
private int d;
private boolean e;
{
this.b = this;
this.c = o2;
this.d = i;
this.e = z;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator2) {
if (this.a) {
return;
}
boolean z2 = this.b.M != 0;
BottomAppBar bottomAppBar = this.b;
int i5 = bottomAppBar.M;
if (i5 != 0) {
bottomAppBar.M = 0;
bottomAppBar.jO_().clear();
bottomAppBar.a(i5);
}
BottomAppBar bottomAppBar2 = this.b;
ActionMenuView actionMenuView = this.c;
AnonymousClass6 anonymousClass6 = new AnonymousClass6(bottomAppBar2, actionMenuView, this.d, this.e);
if (z2) {
actionMenuView.post(anonymousClass6);
} else {
anonymousClass6.run();
}
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationCancel(Animator animator2) {
this.a = true;
}
});
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playSequentially(ofFloat2, ofFloat);
arrayList.add(animatorSet);
} else if (o2.getAlpha() < 1.0f) {
arrayList.add(ofFloat);
}
}
AnimatorSet animatorSet2 = new AnimatorSet();
animatorSet2.playTogether(arrayList);
this.E = animatorSet2;
animatorSet2.addListener(new AnimatorListenerAdapter(this) { // from class: com.google.android.material.bottomappbar.BottomAppBar.7
private BottomAppBar d;
{
this.d = this;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationEnd(Animator animator2) {
BottomAppBar bottomAppBar = this.d;
int i5 = bottomAppBar.s - 1;
bottomAppBar.s = i5;
if (i5 == 0) {
ArrayList<Object> arrayList2 = bottomAppBar.w;
}
this.d.G = false;
this.d.E = null;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator2) {
BottomAppBar bottomAppBar = this.d;
int i5 = bottomAppBar.s;
bottomAppBar.s = i5 + 1;
if (i5 == 0) {
ArrayList<Object> arrayList2 = bottomAppBar.w;
}
}
});
this.E.start();
}
private ActionMenuView o() {
for (int i = 0; i < getChildCount(); i++) {
View childAt = getChildAt(i);
if (childAt instanceof ActionMenuView) {
return (ActionMenuView) childAt;
}
}
return null;
}
/* JADX INFO: Access modifiers changed from: package-private */
/* renamed from: com.google.android.material.bottomappbar.BottomAppBar$6, reason: invalid class name */
/* loaded from: classes2.dex */
public final class AnonymousClass6 implements Runnable {
private BottomAppBar b;
private boolean c;
private int d;
private ActionMenuView e;
AnonymousClass6(BottomAppBar bottomAppBar, ActionMenuView actionMenuView, int i, boolean z) {
this.b = bottomAppBar;
this.e = actionMenuView;
this.d = i;
this.c = z;
}
@Override // java.lang.Runnable
public final void run() {
this.e.setTranslationX(this.b.d(r0, this.d, this.c));
}
}
@Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View
public void onLayout(boolean z, int i, int i2, int i3, int i4) {
super.onLayout(z, i, i2, i3, i4);
if (z) {
Animator animator = this.E;
if (animator != null) {
animator.cancel();
}
Animator animator2 = this.H;
if (animator2 != null) {
animator2.cancel();
}
k();
final View i5 = i();
if (i5 != null && ViewCompat.G(i5)) {
i5.post(new Runnable(i5) { // from class: o.gFg
private View a;
@Override // java.lang.Runnable
public final void run() {
this.a.requestLayout();
}
{
this.a = i5;
}
});
}
}
g();
}
final void k() {
float f;
((vXU) this.F.B.l.h).d = b(this.y);
C4363bXv c4363bXv = this.F;
float f2 = (this.D && l() && this.v == 1) ? 1.0f : BitmapDescriptorFactory.HUE_RED;
if (c4363bXv.B.h != f2) {
c4363bXv.B.h = f2;
c4363bXv.H = true;
c4363bXv.invalidateSelf();
}
View i = i();
if (i != null) {
if (this.v != 1) {
View i2 = i();
f = i2 != null ? (-((getMeasuredHeight() + this.x) - i2.getMeasuredHeight())) / 2 : 0;
} else {
f = -((vXU) this.F.B.l.h).c;
}
i.setTranslationY(f);
i.setTranslationX(b(this.y));
}
}
final void g() {
ActionMenuView o2 = o();
if (o2 == null || this.E != null) {
return;
}
o2.setAlpha(1.0f);
if (!l()) {
new AnonymousClass6(this, o2, 0, false).run();
} else {
new AnonymousClass6(this, o2, this.y, this.D).run();
}
}
@Override // androidx.appcompat.widget.Toolbar, android.view.ViewGroup, android.view.View
public void onAttachedToWindow() {
super.onAttachedToWindow();
C4363bXv c4363bXv = this.F;
if (c4363bXv.B.c != null && c4363bXv.B.c.a) {
c4363bXv.k(Lot.e(this));
}
if (getParent() instanceof ViewGroup) {
((ViewGroup) getParent()).setClipChildren(false);
}
}
/* loaded from: classes2.dex */
public static class Behavior extends HideBottomViewOnScrollBehavior<BottomAppBar> {
final Rect d;
private final View.OnLayoutChangeListener f;
int h;
WeakReference<BottomAppBar> i;
@Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final /* synthetic */ boolean c(CoordinatorLayout coordinatorLayout, View view, int i) {
BottomAppBar bottomAppBar = (BottomAppBar) view;
this.i = new WeakReference<>(bottomAppBar);
View i2 = bottomAppBar.i();
if (i2 != null && !ViewCompat.G(i2)) {
BottomAppBar.c(bottomAppBar, i2);
this.h = ((ViewGroup.MarginLayoutParams) ((CoordinatorLayout.RVV) i2.getLayoutParams())).bottomMargin;
if (i2 instanceof FloatingActionButton) {
FloatingActionButton floatingActionButton = (FloatingActionButton) i2;
if (bottomAppBar.v == 0 && bottomAppBar.K) {
ViewCompat.e(floatingActionButton, BitmapDescriptorFactory.HUE_RED);
floatingActionButton.setCompatElevation(BitmapDescriptorFactory.HUE_RED);
}
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
if (floatingActionButton.a.A == null) {
floatingActionButton.setShowMotionSpecResource(C17052tZT.RVV.mtrl_fab_show_motion_spec);
}
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
if (floatingActionButton.a.k == null) {
floatingActionButton.setHideMotionSpecResource(C17052tZT.RVV.mtrl_fab_hide_motion_spec);
}
AnimatorListenerAdapter animatorListenerAdapter = bottomAppBar.u;
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
DuC duC = floatingActionButton.a;
if (duC.f8139o == null) {
duC.f8139o = new ArrayList<>();
}
duC.f8139o.add(animatorListenerAdapter);
AnimatorListenerAdapter animatorListenerAdapter2 = new AnimatorListenerAdapter(bottomAppBar) { // from class: com.google.android.material.bottomappbar.BottomAppBar.8
private BottomAppBar e;
{
this.e = bottomAppBar;
}
@Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
public final void onAnimationStart(Animator animator) {
this.e.u.onAnimationStart(animator);
View i3 = this.e.i();
FloatingActionButton floatingActionButton2 = i3 instanceof FloatingActionButton ? (FloatingActionButton) i3 : null;
if (floatingActionButton2 != null) {
BottomAppBar bottomAppBar2 = this.e;
floatingActionButton2.setTranslationX(bottomAppBar2.b(bottomAppBar2.y));
}
}
};
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
DuC duC2 = floatingActionButton.a;
if (duC2.B == null) {
duC2.B = new ArrayList<>();
}
duC2.B.add(animatorListenerAdapter2);
lnR<FloatingActionButton> lnr = bottomAppBar.B;
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
DuC duC3 = floatingActionButton.a;
FloatingActionButton.IeS ieS = new FloatingActionButton.IeS(floatingActionButton, lnr);
if (duC3.G == null) {
duC3.G = new ArrayList<>();
}
duC3.G.add(ieS);
}
i2.addOnLayoutChangeListener(this.f);
bottomAppBar.k();
}
coordinatorLayout.c(bottomAppBar, i);
return super.c(coordinatorLayout, bottomAppBar, i);
}
@Override // com.google.android.material.behavior.HideBottomViewOnScrollBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Sts
public final /* bridge */ /* synthetic */ boolean e(CoordinatorLayout coordinatorLayout, View view, View view2, View view3, int i, int i2) {
BottomAppBar bottomAppBar = (BottomAppBar) view;
return bottomAppBar.z && super.e(coordinatorLayout, bottomAppBar, view2, view3, i, i2);
}
public Behavior() {
this.f = new View.OnLayoutChangeListener(this) { // from class: com.google.android.material.bottomappbar.BottomAppBar.Behavior.2
private Behavior c;
{
this.c = this;
}
@Override // android.view.View.OnLayoutChangeListener
public final void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
boolean z;
BottomAppBar bottomAppBar = this.c.i.get();
if (bottomAppBar == null || (!((z = view instanceof FloatingActionButton)) && !(view instanceof ExtendedFloatingActionButton))) {
view.removeOnLayoutChangeListener(this);
return;
}
int height = view.getHeight();
if (z) {
FloatingActionButton floatingActionButton = (FloatingActionButton) view;
Rect rect = this.c.d;
rect.set(0, 0, floatingActionButton.getMeasuredWidth(), floatingActionButton.getMeasuredHeight());
floatingActionButton.Jo_(rect);
height = this.c.d.height();
float f = height;
if (f != ((vXU) bottomAppBar.F.B.l.h).b) {
((vXU) bottomAppBar.F.B.l.h).b = f;
bottomAppBar.F.invalidateSelf();
}
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
float Lk_ = floatingActionButton.a.D.n.Lk_(new RectF(this.c.d));
if (Lk_ != ((vXU) bottomAppBar.F.B.l.h).a) {
((vXU) bottomAppBar.F.B.l.h).a = Lk_;
bottomAppBar.F.invalidateSelf();
}
}
CoordinatorLayout.RVV rvv = (CoordinatorLayout.RVV) view.getLayoutParams();
if (this.c.h == 0) {
if (bottomAppBar.v == 1) {
((ViewGroup.MarginLayoutParams) rvv).bottomMargin = bottomAppBar.x + (bottomAppBar.getResources().getDimensionPixelOffset(C17052tZT.HBt.mtrl_bottomappbar_fab_bottom_margin) - ((view.getMeasuredHeight() - height) / 2));
}
((ViewGroup.MarginLayoutParams) rvv).leftMargin = bottomAppBar.C;
((ViewGroup.MarginLayoutParams) rvv).rightMargin = bottomAppBar.J;
if (ViewCompat.m(view) == 1) {
((ViewGroup.MarginLayoutParams) rvv).leftMargin += bottomAppBar.A;
} else {
((ViewGroup.MarginLayoutParams) rvv).rightMargin += bottomAppBar.A;
}
}
bottomAppBar.k();
}
};
this.d = new Rect();
}
public Behavior(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.f = new View.OnLayoutChangeListener(this) { // from class: com.google.android.material.bottomappbar.BottomAppBar.Behavior.2
private Behavior c;
{
this.c = this;
}
@Override // android.view.View.OnLayoutChangeListener
public final void onLayoutChange(View view, int i, int i2, int i3, int i4, int i5, int i6, int i7, int i8) {
boolean z;
BottomAppBar bottomAppBar = this.c.i.get();
if (bottomAppBar == null || (!((z = view instanceof FloatingActionButton)) && !(view instanceof ExtendedFloatingActionButton))) {
view.removeOnLayoutChangeListener(this);
return;
}
int height = view.getHeight();
if (z) {
FloatingActionButton floatingActionButton = (FloatingActionButton) view;
Rect rect = this.c.d;
rect.set(0, 0, floatingActionButton.getMeasuredWidth(), floatingActionButton.getMeasuredHeight());
floatingActionButton.Jo_(rect);
height = this.c.d.height();
float f = height;
if (f != ((vXU) bottomAppBar.F.B.l.h).b) {
((vXU) bottomAppBar.F.B.l.h).b = f;
bottomAppBar.F.invalidateSelf();
}
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
float Lk_ = floatingActionButton.a.D.n.Lk_(new RectF(this.c.d));
if (Lk_ != ((vXU) bottomAppBar.F.B.l.h).a) {
((vXU) bottomAppBar.F.B.l.h).a = Lk_;
bottomAppBar.F.invalidateSelf();
}
}
CoordinatorLayout.RVV rvv = (CoordinatorLayout.RVV) view.getLayoutParams();
if (this.c.h == 0) {
if (bottomAppBar.v == 1) {
((ViewGroup.MarginLayoutParams) rvv).bottomMargin = bottomAppBar.x + (bottomAppBar.getResources().getDimensionPixelOffset(C17052tZT.HBt.mtrl_bottomappbar_fab_bottom_margin) - ((view.getMeasuredHeight() - height) / 2));
}
((ViewGroup.MarginLayoutParams) rvv).leftMargin = bottomAppBar.C;
((ViewGroup.MarginLayoutParams) rvv).rightMargin = bottomAppBar.J;
if (ViewCompat.m(view) == 1) {
((ViewGroup.MarginLayoutParams) rvv).leftMargin += bottomAppBar.A;
} else {
((ViewGroup.MarginLayoutParams) rvv).rightMargin += bottomAppBar.A;
}
}
bottomAppBar.k();
}
};
this.d = new Rect();
}
}
@Override // androidx.appcompat.widget.Toolbar, android.view.View
public Parcelable onSaveInstanceState() {
HBt hBt = new HBt(super.onSaveInstanceState());
hBt.e = this.y;
hBt.d = this.D;
return hBt;
}
@Override // androidx.appcompat.widget.Toolbar, android.view.View
public void onRestoreInstanceState(Parcelable parcelable) {
if (!(parcelable instanceof HBt)) {
super.onRestoreInstanceState(parcelable);
return;
}
HBt hBt = (HBt) parcelable;
super.onRestoreInstanceState(hBt.b);
this.y = hBt.e;
this.D = hBt.d;
}
/* loaded from: classes2.dex */
static class HBt extends XgG {
public static final Parcelable.Creator<HBt> CREATOR = new Parcelable.ClassLoaderCreator<HBt>() { // from class: com.google.android.material.bottomappbar.BottomAppBar.HBt.3
@Override // android.os.Parcelable.Creator
public final /* synthetic */ Object createFromParcel(Parcel parcel) {
return new HBt(parcel, null);
}
@Override // android.os.Parcelable.ClassLoaderCreator
public final /* synthetic */ HBt createFromParcel(Parcel parcel, ClassLoader classLoader) {
return new HBt(parcel, classLoader);
}
@Override // android.os.Parcelable.Creator
public final /* bridge */ /* synthetic */ Object[] newArray(int i) {
return new HBt[i];
}
};
boolean d;
int e;
public HBt(Parcelable parcelable) {
super(parcelable);
}
public HBt(Parcel parcel, ClassLoader classLoader) {
super(parcel, classLoader);
this.e = parcel.readInt();
this.d = parcel.readInt() != 0;
}
@Override // o.XgG, android.os.Parcelable
public final void writeToParcel(Parcel parcel, int i) {
super.writeToParcel(parcel, i);
parcel.writeInt(this.e);
parcel.writeInt(this.d ? 1 : 0);
}
}
final float b(int i) {
boolean z = ViewCompat.m(this) == 1;
if (i != 1) {
return BitmapDescriptorFactory.HUE_RED;
}
View i2 = i();
int i3 = z ? this.C : this.J;
int measuredWidth = (this.Q == -1 || i2 == null) ? this.A : (i2.getMeasuredWidth() / 2) + this.Q;
return ((getMeasuredWidth() / 2) - (i3 + measuredWidth)) * (z ? -1 : 1);
}
private boolean l() {
View i = i();
FloatingActionButton floatingActionButton = i instanceof FloatingActionButton ? (FloatingActionButton) i : null;
if (floatingActionButton != null) {
if (floatingActionButton.a == null) {
floatingActionButton.a = new sjh(floatingActionButton, new FloatingActionButton.Sts(floatingActionButton));
}
if (floatingActionButton.a.c()) {
return true;
}
}
return false;
}
protected final int d(ActionMenuView actionMenuView, int i, boolean z) {
int i2 = 0;
if (this.U != 1 && (i != 1 || !z)) {
return 0;
}
boolean z2 = ViewCompat.m(this) == 1;
int measuredWidth = z2 ? getMeasuredWidth() : 0;
for (int i3 = 0; i3 < getChildCount(); i3++) {
View childAt = getChildAt(i3);
if ((childAt.getLayoutParams() instanceof Toolbar.LWm) && (((Toolbar.LWm) childAt.getLayoutParams()).d & 8388615) == 8388611) {
if (z2) {
measuredWidth = Math.min(measuredWidth, childAt.getLeft());
} else {
measuredWidth = Math.max(measuredWidth, childAt.getRight());
}
}
}
int right = z2 ? actionMenuView.getRight() : actionMenuView.getLeft();
int i4 = z2 ? this.J : -this.C;
ImageButton imageButton = this.j;
if ((imageButton != null ? imageButton.getDrawable() : null) == null) {
i2 = getResources().getDimensionPixelOffset(C17052tZT.HBt.m3_bottomappbar_horizontal_padding);
if (!z2) {
i2 = -i2;
}
}
return measuredWidth - ((right + i4) + i2);
}
public void setCradleVerticalOffset(float f) {
if (f != ((vXU) this.F.B.l.h).c) {
vXU vxu = (vXU) this.F.B.l.h;
if (f >= BitmapDescriptorFactory.HUE_RED) {
vxu.c = f;
this.F.invalidateSelf();
k();
return;
}
throw new IllegalArgumentException("cradleVerticalOffset must be positive.");
}
}
public void setFabCradleMargin(float f) {
if (f != ((vXU) this.F.B.l.h).e) {
((vXU) this.F.B.l.h).e = f;
this.F.invalidateSelf();
}
}
public void setFabCradleRoundedCornerRadius(float f) {
if (f != ((vXU) this.F.B.l.h).i) {
((vXU) this.F.B.l.h).i = f;
this.F.invalidateSelf();
}
}
public void setHideOnScroll(boolean z) {
this.z = z;
}
public void setFabAnimationMode(int i) {
this.T = i;
}
}