package com.google.android.material.floatingactionbutton; import android.content.Context; import android.content.res.ColorStateList; import android.content.res.Resources; import android.content.res.TypedArray; import android.graphics.Matrix; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.os.Parcelable; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import android.view.ViewParent; import android.view.ViewTreeObserver; import androidx.coordinatorlayout.widget.CoordinatorLayout; import androidx.core.view.ViewCompat; import com.google.android.material.appbar.AppBarLayout; import com.google.android.material.bottomsheet.BottomSheetBehavior; import com.google.android.material.internal.VisibilityAwareImageButton; import java.util.List; import o.C16740qpB; import o.C17052tZT; import o.C4363bXv; import o.CEQ; import o.DFj; import o.DuC; import o.FLD; import o.Gmh; import o.InterfaceC16225mUi; import o.Jaq; import o.Lot; import o.RXZ; import o.Tlu; import o.lnR; import o.mje; import o.qXa; import o.sjh; import o.zWI; import o.zwp; /* loaded from: classes2.dex */ public class FloatingActionButton extends VisibilityAwareImageButton implements InterfaceC16225mUi, Jaq, CoordinatorLayout.IeS { private static final int g = C17052tZT.NHB.Widget_Design_FloatingActionButton; public DuC a; boolean b; final Rect c; int d; public final zWI e; private PorterDuff.Mode f; private ColorStateList h; public int j; private int k; private ColorStateList l; private final zwp m; private int n; /* renamed from: o, reason: collision with root package name */ private PorterDuff.Mode f6476o; private final Rect q; private ColorStateList r; private int t; /* loaded from: classes2.dex */ public static abstract class HBt { public void d() { } public void e(FloatingActionButton floatingActionButton) { } } @Override // android.view.View public void setBackgroundColor(int i) { } @Override // android.view.View public void setBackgroundDrawable(Drawable drawable) { } @Override // android.view.View public void setBackgroundResource(int i) { } public FloatingActionButton(Context context) { this(context, null); } public FloatingActionButton(Context context, AttributeSet attributeSet) { this(context, attributeSet, C17052tZT.IeS.floatingActionButtonStyle); } /* 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 FloatingActionButton(android.content.Context r12, android.util.AttributeSet r13, int r14) { /* Method dump skipped, instructions count: 467 To view this dump add '--comments-level debug' option */ throw new UnsupportedOperationException("Method not decompiled: com.google.android.material.floatingactionbutton.FloatingActionButton.(android.content.Context, android.util.AttributeSet, int):void"); } @Override // android.widget.ImageView, android.view.View protected void onMeasure(int i, int i2) { int a = a(this.j); this.d = (a - this.t) / 2; c().o(); int min = Math.min(View.resolveSize(a, i), View.resolveSize(a, i2)); setMeasuredDimension(this.c.left + min + this.c.right, min + this.c.top + this.c.bottom); } public void setRippleColor(int i) { setRippleColor(ColorStateList.valueOf(i)); } public void setRippleColor(ColorStateList colorStateList) { if (this.r != colorStateList) { this.r = colorStateList; c().JF_(this.r); } } @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.IeS public final CoordinatorLayout.Sts a() { return new Behavior(); } @Override // android.view.View public void setBackgroundTintList(ColorStateList colorStateList) { if (this.h != colorStateList) { this.h = colorStateList; DuC c = c(); C4363bXv c4363bXv = c.z; if (c4363bXv != null) { c4363bXv.setTintList(colorStateList); } Gmh gmh = c.f; if (gmh != null) { gmh.Jb_(colorStateList); } } } @Override // android.view.View public void setBackgroundTintMode(PorterDuff.Mode mode) { if (this.f != mode) { this.f = mode; C4363bXv c4363bXv = c().z; if (c4363bXv != null) { c4363bXv.setTintMode(mode); } } } public void setSupportBackgroundTintList(ColorStateList colorStateList) { setBackgroundTintList(colorStateList); } public void setSupportBackgroundTintMode(PorterDuff.Mode mode) { setBackgroundTintMode(mode); } public void setSupportImageTintList(ColorStateList colorStateList) { if (this.l != colorStateList) { this.l = colorStateList; b(); } } public void setSupportImageTintMode(PorterDuff.Mode mode) { if (this.f6476o != mode) { this.f6476o = mode; b(); } } private void b() { Drawable drawable = getDrawable(); if (drawable == null) { return; } ColorStateList colorStateList = this.l; if (colorStateList == null) { Tlu.pt_(drawable); return; } int colorForState = colorStateList.getColorForState(getDrawableState(), 0); PorterDuff.Mode mode = this.f6476o; if (mode == null) { mode = PorterDuff.Mode.SRC_IN; } drawable.mutate().setColorFilter(RXZ.fM_(colorForState, mode)); } @Override // android.widget.ImageView public void setImageResource(int i) { this.m.a(i); b(); } @Override // android.widget.ImageView public void setImageDrawable(Drawable drawable) { if (getDrawable() != drawable) { super.setImageDrawable(drawable); DuC c = c(); float f = c.s; c.s = f; Matrix matrix = c.C; c.Jt_(f, matrix); c.E.setImageMatrix(matrix); if (this.l != null) { b(); } } } @Override // o.Jaq public void setShapeAppearanceModel(FLD fld) { c().d(fld); } public void setEnsureMinTouchTargetSize(boolean z) { if (z != c().m) { c().m = z; requestLayout(); } } @Override // com.google.android.material.internal.VisibilityAwareImageButton, android.widget.ImageView, android.view.View public void setVisibility(int i) { super.setVisibility(i); } public void setMaxImageSize(int i) { this.t = i; DuC c = c(); if (c.q != i) { c.q = i; float f = c.s; c.s = f; Matrix matrix = c.C; c.Jt_(f, matrix); c.E.setImageMatrix(matrix); } } public void setUseCompatPadding(boolean z) { if (this.b != z) { this.b = z; c().j(); } } public void setSize(int i) { this.n = 0; if (i != this.j) { this.j = i; requestLayout(); } } /* renamed from: com.google.android.material.floatingactionbutton.FloatingActionButton$5, reason: invalid class name */ /* loaded from: classes2.dex */ public class AnonymousClass5 implements DuC.LWm { private HBt a; private FloatingActionButton b; public AnonymousClass5(FloatingActionButton floatingActionButton, HBt hBt) { this.b = floatingActionButton; this.a = hBt; } @Override // o.DuC.LWm public final void c() { this.a.d(); } @Override // o.DuC.LWm public final void b() { this.a.e(this.b); } } public void setCustomSize(int i) { if (i < 0) { throw new IllegalArgumentException("Custom size must be non-negative"); } if (i != this.n) { this.n = i; requestLayout(); } } public final int a(int i) { int i2 = this.n; if (i2 != 0) { return i2; } Resources resources = getResources(); if (i != -1) { if (i == 1) { return resources.getDimensionPixelSize(C17052tZT.HBt.design_fab_size_mini); } return resources.getDimensionPixelSize(C17052tZT.HBt.design_fab_size_normal); } if (Math.max(resources.getConfiguration().screenWidthDp, resources.getConfiguration().screenHeightDp) < 470) { return a(1); } return a(0); } @Override // android.widget.ImageView, android.view.View protected void onAttachedToWindow() { super.onAttachedToWindow(); final DuC c = c(); C4363bXv c4363bXv = c.z; if (c4363bXv != null) { FloatingActionButton floatingActionButton = c.E; if (c4363bXv.B.c != null && c4363bXv.B.c.a) { c4363bXv.k(Lot.e(floatingActionButton)); } } if (c.f()) { ViewTreeObserver viewTreeObserver = c.E.getViewTreeObserver(); if (c.t == null) { c.t = new ViewTreeObserver.OnPreDrawListener(c) { // from class: o.DuC.8 private DuC d; { this.d = c; } @Override // android.view.ViewTreeObserver.OnPreDrawListener public final boolean onPreDraw() { DuC duC = this.d; float rotation = duC.E.getRotation(); if (duC.v == rotation) { return true; } duC.v = rotation; duC.l(); return true; } }; } viewTreeObserver.addOnPreDrawListener(c.t); } } @Override // android.widget.ImageView, android.view.View protected void onDetachedFromWindow() { super.onDetachedFromWindow(); DuC c = c(); ViewTreeObserver viewTreeObserver = c.E.getViewTreeObserver(); ViewTreeObserver.OnPreDrawListener onPreDrawListener = c.t; if (onPreDrawListener != null) { viewTreeObserver.removeOnPreDrawListener(onPreDrawListener); c.t = null; } } @Override // android.widget.ImageView, android.view.View protected void drawableStateChanged() { super.drawableStateChanged(); c().d(getDrawableState()); } @Override // android.widget.ImageView, android.view.View public void jumpDrawablesToCurrentState() { super.jumpDrawablesToCurrentState(); c().e(); } @Override // android.view.View protected Parcelable onSaveInstanceState() { Parcelable onSaveInstanceState = super.onSaveInstanceState(); if (onSaveInstanceState == null) { onSaveInstanceState = new Bundle(); } C16740qpB c16740qpB = new C16740qpB(onSaveInstanceState); DFj dFj = c16740qpB.c; zWI zwi = this.e; Bundle bundle = new Bundle(); bundle.putBoolean("expanded", zwi.c); bundle.putInt("expandedComponentIdHint", zwi.e); dFj.put("expandableWidgetHelper", bundle); return c16740qpB; } @Override // android.view.View protected void onRestoreInstanceState(Parcelable parcelable) { if (!(parcelable instanceof C16740qpB)) { super.onRestoreInstanceState(parcelable); return; } C16740qpB c16740qpB = (C16740qpB) parcelable; super.onRestoreInstanceState(c16740qpB.b); zWI zwi = this.e; Bundle bundle = c16740qpB.c.get("expandableWidgetHelper"); zwi.c = bundle.getBoolean("expanded", false); zwi.e = bundle.getInt("expandedComponentIdHint", 0); if (zwi.c) { ViewParent parent = zwi.b.getParent(); if (parent instanceof CoordinatorLayout) { ((CoordinatorLayout) parent).b(zwi.b); } } } public final void Jo_(Rect rect) { rect.left += this.c.left; rect.top += this.c.top; rect.right -= this.c.right; rect.bottom -= this.c.bottom; } @Override // android.view.View public boolean onTouchEvent(MotionEvent motionEvent) { if (motionEvent.getAction() == 0) { Rect rect = this.q; if (ViewCompat.G(this)) { rect.set(0, 0, getWidth(), getHeight()); Jo_(rect); if (!this.q.contains((int) motionEvent.getX(), (int) motionEvent.getY())) { return false; } } } return super.onTouchEvent(motionEvent); } /* loaded from: classes2.dex */ public static class Behavior extends BaseBehavior { @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior /* renamed from: Jr_ */ public final /* bridge */ /* synthetic */ boolean Jp_(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, Rect rect) { return super.Jp_(coordinatorLayout, floatingActionButton, rect); } @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior, androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public final /* bridge */ /* synthetic */ void a(CoordinatorLayout.RVV rvv) { super.a(rvv); } @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior public final /* bridge */ /* synthetic */ boolean c(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, int i) { return super.c(coordinatorLayout, floatingActionButton, i); } @Override // com.google.android.material.floatingactionbutton.FloatingActionButton.BaseBehavior /* renamed from: d */ public final /* bridge */ /* synthetic */ boolean e(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view) { return super.e(coordinatorLayout, floatingActionButton, view); } public Behavior() { } public Behavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); } } /* loaded from: classes2.dex */ protected static class BaseBehavior extends CoordinatorLayout.Sts { private Rect a; private HBt b; private boolean c; public BaseBehavior() { this.c = true; } public BaseBehavior(Context context, AttributeSet attributeSet) { super(context, attributeSet); TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, C17052tZT.jNh.FloatingActionButton_Behavior_Layout); this.c = obtainStyledAttributes.getBoolean(C17052tZT.jNh.FloatingActionButton_Behavior_Layout_behavior_autoHide, true); obtainStyledAttributes.recycle(); } @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public void a(CoordinatorLayout.RVV rvv) { if (rvv.b == 0) { rvv.b = 80; } } @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts /* renamed from: d, reason: merged with bridge method [inline-methods] */ public boolean e(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, View view) { if (view instanceof AppBarLayout) { c(coordinatorLayout, (AppBarLayout) view, floatingActionButton); return false; } ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); if (!(layoutParams instanceof CoordinatorLayout.RVV) || !(((CoordinatorLayout.RVV) layoutParams).h instanceof BottomSheetBehavior)) { return false; } b(view, floatingActionButton); return false; } private boolean c(View view, FloatingActionButton floatingActionButton) { return this.c && ((CoordinatorLayout.RVV) floatingActionButton.getLayoutParams()).j == view.getId() && floatingActionButton.i == 0; } private boolean c(CoordinatorLayout coordinatorLayout, AppBarLayout appBarLayout, FloatingActionButton floatingActionButton) { if (!c(appBarLayout, floatingActionButton)) { return false; } if (this.a == null) { this.a = new Rect(); } Rect rect = this.a; rect.set(0, 0, appBarLayout.getWidth(), appBarLayout.getHeight()); CEQ.JT_(coordinatorLayout, appBarLayout, rect); if (rect.bottom <= appBarLayout.d()) { floatingActionButton.c().d(null, false); return true; } floatingActionButton.c().e(null, false); return true; } private boolean b(View view, FloatingActionButton floatingActionButton) { if (!c(view, floatingActionButton)) { return false; } if (view.getTop() < (floatingActionButton.getHeight() / 2) + ((ViewGroup.MarginLayoutParams) ((CoordinatorLayout.RVV) floatingActionButton.getLayoutParams())).topMargin) { floatingActionButton.c().d(null, false); return true; } floatingActionButton.c().e(null, false); return true; } @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts public boolean c(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, int i) { int i2; List c = coordinatorLayout.c(floatingActionButton); int size = c.size(); int i3 = 0; for (int i4 = 0; i4 < size; i4++) { View view = c.get(i4); if (view instanceof AppBarLayout) { if (c(coordinatorLayout, (AppBarLayout) view, floatingActionButton)) { break; } } else { ViewGroup.LayoutParams layoutParams = view.getLayoutParams(); if ((layoutParams instanceof CoordinatorLayout.RVV) && (((CoordinatorLayout.RVV) layoutParams).h instanceof BottomSheetBehavior) && b(view, floatingActionButton)) { break; } } } coordinatorLayout.c(floatingActionButton, i); Rect rect = floatingActionButton.c; if (rect == null || rect.centerX() <= 0 || rect.centerY() <= 0) { return true; } CoordinatorLayout.RVV rvv = (CoordinatorLayout.RVV) floatingActionButton.getLayoutParams(); if (floatingActionButton.getRight() >= coordinatorLayout.getWidth() - ((ViewGroup.MarginLayoutParams) rvv).rightMargin) { i2 = rect.right; } else { i2 = floatingActionButton.getLeft() <= ((ViewGroup.MarginLayoutParams) rvv).leftMargin ? -rect.left : 0; } if (floatingActionButton.getBottom() >= coordinatorLayout.getHeight() - ((ViewGroup.MarginLayoutParams) rvv).bottomMargin) { i3 = rect.bottom; } else if (floatingActionButton.getTop() <= ((ViewGroup.MarginLayoutParams) rvv).topMargin) { i3 = -rect.top; } if (i3 != 0) { ViewCompat.d(floatingActionButton, i3); } if (i2 == 0) { return true; } ViewCompat.e((View) floatingActionButton, i2); return true; } @Override // androidx.coordinatorlayout.widget.CoordinatorLayout.Sts /* renamed from: Jr_, reason: merged with bridge method [inline-methods] */ public boolean Jp_(CoordinatorLayout coordinatorLayout, FloatingActionButton floatingActionButton, Rect rect) { Rect rect2 = floatingActionButton.c; rect.set(floatingActionButton.getLeft() + rect2.left, floatingActionButton.getTop() + rect2.top, floatingActionButton.getRight() - rect2.right, floatingActionButton.getBottom() - rect2.bottom); return true; } } @Override // android.view.View public void setElevation(float f) { super.setElevation(f); C4363bXv c4363bXv = c().z; if (c4363bXv != null) { c4363bXv.n(f); } } public void setCompatElevation(float f) { DuC c = c(); if (c.n != f) { c.n = f; c.b(f, c.r, c.w); } } public void setCompatElevationResource(int i) { setCompatElevation(getResources().getDimension(i)); } public void setCompatHoveredFocusedTranslationZ(float f) { DuC c = c(); if (c.r != f) { c.r = f; c.b(c.n, f, c.w); } } public void setCompatHoveredFocusedTranslationZResource(int i) { setCompatHoveredFocusedTranslationZ(getResources().getDimension(i)); } public void setCompatPressedTranslationZ(float f) { DuC c = c(); if (c.w != f) { c.w = f; c.b(c.n, c.r, f); } } public void setCompatPressedTranslationZResource(int i) { setCompatPressedTranslationZ(getResources().getDimension(i)); } public void setShowMotionSpec(qXa qxa) { c().A = qxa; } public void setShowMotionSpecResource(int i) { setShowMotionSpec(qXa.b(getContext(), i)); } public void setHideMotionSpec(qXa qxa) { c().k = qxa; } public void setHideMotionSpecResource(int i) { setHideMotionSpec(qXa.b(getContext(), i)); } /* loaded from: classes2.dex */ public class IeS implements DuC.RVV { private FloatingActionButton b; private final lnR d; public IeS(FloatingActionButton floatingActionButton, lnR lnr) { this.b = floatingActionButton; this.d = lnr; } @Override // o.DuC.RVV public final void a() { this.d.e(this.b); } @Override // o.DuC.RVV public final void c() { this.d.d(this.b); } public final boolean equals(Object obj) { return (obj instanceof IeS) && ((IeS) obj).d.equals(this.d); } public final int hashCode() { return this.d.hashCode(); } } @Override // android.view.View public void setTranslationX(float f) { super.setTranslationX(f); c().h(); } @Override // android.view.View public void setTranslationY(float f) { super.setTranslationY(f); c().h(); } @Override // android.view.View public void setTranslationZ(float f) { super.setTranslationZ(f); c().h(); } @Override // android.view.View public void setScaleX(float f) { super.setScaleX(f); c().i(); } @Override // android.view.View public void setScaleY(float f) { super.setScaleY(f); c().i(); } public void setShadowPaddingEnabled(boolean z) { DuC c = c(); c.x = z; c.o(); } /* loaded from: classes2.dex */ public class Sts implements mje { private FloatingActionButton b; public Sts(FloatingActionButton floatingActionButton) { this.b = floatingActionButton; } @Override // o.mje public final void a(int i, int i2, int i3, int i4) { this.b.c.set(i, i2, i3, i4); FloatingActionButton floatingActionButton = this.b; floatingActionButton.setPadding(i + floatingActionButton.d, i2 + this.b.d, i3 + this.b.d, i4 + this.b.d); } @Override // o.mje public final void KW_(Drawable drawable) { if (drawable != null) { FloatingActionButton.super.setBackgroundDrawable(drawable); } } @Override // o.mje public final boolean e() { return this.b.b; } } @Override // o.rxp public final boolean e() { return this.e.c; } public final DuC c() { if (this.a == null) { this.a = new sjh(this, new Sts(this)); } return this.a; } public void setExpandedComponentIdHint(int i) { this.e.e = i; } @Override // android.view.View public PorterDuff.Mode getBackgroundTintMode() { return this.f; } @Override // android.view.View public ColorStateList getBackgroundTintList() { return this.h; } }