package o; import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.AnimatorSet; import android.animation.FloatEvaluator; import android.animation.ObjectAnimator; import android.animation.TimeInterpolator; import android.animation.TypeEvaluator; import android.animation.ValueAnimator; import android.content.Context; import android.content.res.ColorStateList; import android.graphics.Matrix; import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; import android.graphics.drawable.InsetDrawable; import android.graphics.drawable.LayerDrawable; import android.os.Build; import android.util.Property; import android.util.StateSet; import android.util.TypedValue; import android.view.View; import android.view.ViewTreeObserver; import androidx.core.view.ViewCompat; import com.google.android.gms.maps.model.BitmapDescriptorFactory; import com.google.android.material.floatingactionbutton.FloatingActionButton; import java.util.ArrayList; import java.util.Iterator; import o.C17052tZT; import o.trM; /* loaded from: classes2.dex */ public class DuC { public qXa A; public ArrayList B; public FLD D; public final FloatingActionButton E; public ArrayList G; private final trM J; public Gmh f; Drawable g; public qXa k; Animator l; public boolean m; public float n; /* renamed from: o, reason: collision with root package name */ public ArrayList f8139o; public int p; public int q; public float r; public ViewTreeObserver.OnPreDrawListener t; final mje u; float v; public float w; Drawable y; public C4363bXv z; static final TimeInterpolator a = C6217cMa.c; private static final int F = C17052tZT.IeS.motionDurationLong2; private static final int N = C17052tZT.IeS.motionEasingEmphasizedInterpolator; private static final int I = C17052tZT.IeS.motionDurationMedium1; private static final int H = C17052tZT.IeS.motionEasingEmphasizedAccelerateInterpolator; static final int[] h = {android.R.attr.state_pressed, android.R.attr.state_enabled}; static final int[] i = {android.R.attr.state_hovered, android.R.attr.state_focused, android.R.attr.state_enabled}; static final int[] b = {android.R.attr.state_focused, android.R.attr.state_enabled}; static final int[] c = {android.R.attr.state_hovered, android.R.attr.state_enabled}; static final int[] d = {android.R.attr.state_enabled}; static final int[] e = new int[0]; public boolean x = true; public float s = 1.0f; int j = 0; private final Rect K = new Rect(); private final RectF L = new RectF(); private final RectF M = new RectF(); public final Matrix C = new Matrix(); /* loaded from: classes2.dex */ public interface LWm { void b(); void c(); } /* loaded from: classes2.dex */ public interface RVV { void a(); void c(); } public boolean f() { return true; } boolean g() { return true; } public void j() { } /* JADX INFO: Access modifiers changed from: package-private */ public DuC(FloatingActionButton floatingActionButton, mje mjeVar) { this.E = floatingActionButton; this.u = mjeVar; trM trm = new trM(); this.J = trm; int[] iArr = h; ValueAnimator Jw_ = Jw_(new IeS(this)); trM.Sts sts = new trM.Sts(iArr, Jw_); Jw_.addListener(trm.e); trm.c.add(sts); int[] iArr2 = i; ValueAnimator Jw_2 = Jw_(new Sts(this)); trM.Sts sts2 = new trM.Sts(iArr2, Jw_2); Jw_2.addListener(trm.e); trm.c.add(sts2); int[] iArr3 = b; ValueAnimator Jw_3 = Jw_(new Sts(this)); trM.Sts sts3 = new trM.Sts(iArr3, Jw_3); Jw_3.addListener(trm.e); trm.c.add(sts3); int[] iArr4 = c; ValueAnimator Jw_4 = Jw_(new Sts(this)); trM.Sts sts4 = new trM.Sts(iArr4, Jw_4); Jw_4.addListener(trm.e); trm.c.add(sts4); int[] iArr5 = d; ValueAnimator Jw_5 = Jw_(new saX(this)); trM.Sts sts5 = new trM.Sts(iArr5, Jw_5); Jw_5.addListener(trm.e); trm.c.add(sts5); int[] iArr6 = e; ValueAnimator Jw_6 = Jw_(new HBt(this)); trM.Sts sts6 = new trM.Sts(iArr6, Jw_6); Jw_6.addListener(trm.e); trm.c.add(sts6); this.v = floatingActionButton.getRotation(); } public void JE_(ColorStateList colorStateList, PorterDuff.Mode mode, ColorStateList colorStateList2, int i2) { C4363bXv a2 = a(); this.z = a2; a2.setTintList(colorStateList); if (mode != null) { this.z.setTintMode(mode); } this.z.f(); this.z.d(this.E.getContext()); Vdh vdh = new Vdh(this.z.B.l); vdh.setTintList(C0459HUs.KI_(colorStateList2)); this.y = vdh; this.g = new LayerDrawable(new Drawable[]{this.z, vdh}); } public void JF_(ColorStateList colorStateList) { Drawable drawable = this.y; if (drawable != null) { Tlu.pF_(drawable, C0459HUs.KI_(colorStateList)); } } public final void Jt_(float f, Matrix matrix) { matrix.reset(); if (this.E.getDrawable() == null || this.q == 0) { return; } RectF rectF = this.L; RectF rectF2 = this.M; rectF.set(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, r0.getIntrinsicWidth(), r0.getIntrinsicHeight()); float f2 = this.q; rectF2.set(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, f2, f2); matrix.setRectToRect(rectF, rectF2, Matrix.ScaleToFit.CENTER); float f3 = this.q / 2.0f; matrix.postScale(f, f, f3, f3); } public final void d(FLD fld) { this.D = fld; C4363bXv c4363bXv = this.z; if (c4363bXv != null) { c4363bXv.setShapeAppearanceModel(fld); } Object obj = this.y; if (obj instanceof Jaq) { ((Jaq) obj).setShapeAppearanceModel(fld); } Gmh gmh = this.f; if (gmh != null) { gmh.i = fld; gmh.invalidateSelf(); } } /* JADX INFO: Access modifiers changed from: package-private */ public final boolean k() { if (this.m) { FloatingActionButton floatingActionButton = this.E; if (floatingActionButton.a(floatingActionButton.j) < this.p) { return false; } } return true; } public void b(float f, float f2, float f3) { o(); C4363bXv c4363bXv = this.z; if (c4363bXv != null) { c4363bXv.n(f); } } public void d(int[] iArr) { trM.Sts sts; ValueAnimator valueAnimator; trM trm = this.J; int size = trm.c.size(); int i2 = 0; while (true) { if (i2 >= size) { sts = null; break; } sts = trm.c.get(i2); if (StateSet.stateSetMatches(sts.d, iArr)) { break; } else { i2++; } } trM.Sts sts2 = trm.d; if (sts != sts2) { if (sts2 != null && (valueAnimator = trm.b) != null) { valueAnimator.cancel(); trm.b = null; } trm.d = sts; if (sts != null) { ValueAnimator valueAnimator2 = sts.c; trm.b = valueAnimator2; valueAnimator2.start(); } } } public void e() { trM trm = this.J; ValueAnimator valueAnimator = trm.b; if (valueAnimator != null) { valueAnimator.end(); trm.b = null; } } public final void d(LWm lWm, boolean z) { AnimatorSet Jv_; if (b()) { return; } Animator animator = this.l; if (animator != null) { animator.cancel(); } if (ViewCompat.G(this.E) && !this.E.isInEditMode()) { qXa qxa = this.k; if (qxa != null) { Jv_ = Ju_(qxa, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED); } else { Jv_ = Jv_(BitmapDescriptorFactory.HUE_RED, 0.4f, 0.4f, I, H); } Jv_.addListener(new AnimatorListenerAdapter(this, z, lWm) { // from class: o.DuC.4 private DuC a; private boolean b; private LWm c; private boolean e; { this.a = this; this.e = z; this.c = lWm; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationStart(Animator animator2) { this.a.E.c(0, this.e); this.a.j = 1; this.a.l = animator2; this.b = false; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator2) { this.a.j = 0; this.a.l = null; if (this.b) { return; } FloatingActionButton floatingActionButton = this.a.E; boolean z2 = this.e; floatingActionButton.c(z2 ? 8 : 4, z2); LWm lWm2 = this.c; if (lWm2 != null) { lWm2.b(); } } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationCancel(Animator animator2) { this.b = true; } }); ArrayList arrayList = this.f8139o; if (arrayList != null) { Iterator it = arrayList.iterator(); while (it.hasNext()) { Jv_.addListener(it.next()); } } Jv_.start(); return; } this.E.c(z ? 8 : 4, z); if (lWm != null) { lWm.b(); } } public final void e(LWm lWm, boolean z) { AnimatorSet Jv_; if (c()) { return; } Animator animator = this.l; if (animator != null) { animator.cancel(); } boolean z2 = this.A == null; if (ViewCompat.G(this.E) && !this.E.isInEditMode()) { if (this.E.getVisibility() != 0) { FloatingActionButton floatingActionButton = this.E; float f = BitmapDescriptorFactory.HUE_RED; floatingActionButton.setAlpha(BitmapDescriptorFactory.HUE_RED); this.E.setScaleY(z2 ? 0.4f : 0.0f); this.E.setScaleX(z2 ? 0.4f : 0.0f); if (z2) { f = 0.4f; } this.s = f; Matrix matrix = this.C; Jt_(f, matrix); this.E.setImageMatrix(matrix); } qXa qxa = this.A; if (qxa != null) { Jv_ = Ju_(qxa, 1.0f, 1.0f, 1.0f); } else { Jv_ = Jv_(1.0f, 1.0f, 1.0f, F, N); } Jv_.addListener(new AnimatorListenerAdapter(this, z, lWm) { // from class: o.DuC.3 private DuC a; private boolean b; private LWm e; { this.a = this; this.b = z; this.e = lWm; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationStart(Animator animator2) { this.a.E.c(0, this.b); this.a.j = 2; this.a.l = animator2; } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public final void onAnimationEnd(Animator animator2) { this.a.j = 0; this.a.l = null; LWm lWm2 = this.e; if (lWm2 != null) { lWm2.c(); } } }); ArrayList arrayList = this.B; if (arrayList != null) { Iterator it = arrayList.iterator(); while (it.hasNext()) { Jv_.addListener(it.next()); } } Jv_.start(); return; } this.E.c(0, z); this.E.setAlpha(1.0f); this.E.setScaleY(1.0f); this.E.setScaleX(1.0f); this.s = 1.0f; Matrix matrix2 = this.C; Jt_(1.0f, matrix2); this.E.setImageMatrix(matrix2); if (lWm != null) { lWm.c(); } } private AnimatorSet Ju_(qXa qxa, float f, float f2, float f3) { ArrayList arrayList = new ArrayList(); ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.E, (Property) View.ALPHA, f); qxa.b("opacity").HH_(ofFloat); arrayList.add(ofFloat); ObjectAnimator ofFloat2 = ObjectAnimator.ofFloat(this.E, (Property) View.SCALE_X, f2); qxa.b("scale").HH_(ofFloat2); if (Build.VERSION.SDK_INT == 26) { ofFloat2.setEvaluator(new TypeEvaluator(this) { // from class: o.DuC.1 private DuC d; private FloatEvaluator e = new FloatEvaluator(); { this.d = this; } @Override // android.animation.TypeEvaluator public final /* synthetic */ Float evaluate(float f4, Float f5, Float f6) { float floatValue = this.e.evaluate(f4, (Number) f5, (Number) f6).floatValue(); if (floatValue < 0.1f) { floatValue = BitmapDescriptorFactory.HUE_RED; } return Float.valueOf(floatValue); } }); } arrayList.add(ofFloat2); ObjectAnimator ofFloat3 = ObjectAnimator.ofFloat(this.E, (Property) View.SCALE_Y, f2); qxa.b("scale").HH_(ofFloat3); if (Build.VERSION.SDK_INT == 26) { ofFloat3.setEvaluator(new TypeEvaluator(this) { // from class: o.DuC.1 private DuC d; private FloatEvaluator e = new FloatEvaluator(); { this.d = this; } @Override // android.animation.TypeEvaluator public final /* synthetic */ Float evaluate(float f4, Float f5, Float f6) { float floatValue = this.e.evaluate(f4, (Number) f5, (Number) f6).floatValue(); if (floatValue < 0.1f) { floatValue = BitmapDescriptorFactory.HUE_RED; } return Float.valueOf(floatValue); } }); } arrayList.add(ofFloat3); Jt_(f3, this.C); ObjectAnimator ofObject = ObjectAnimator.ofObject(this.E, new C16719qfG(), new Nzf(this) { // from class: o.DuC.5 private DuC e; { this.e = this; } @Override // o.Nzf, android.animation.TypeEvaluator public final /* synthetic */ Matrix evaluate(float f4, Matrix matrix, Matrix matrix2) { this.e.s = f4; return super.evaluate(f4, matrix, matrix2); } @Override // o.Nzf /* renamed from: JB_ */ public final Matrix evaluate(float f4, Matrix matrix, Matrix matrix2) { this.e.s = f4; return super.evaluate(f4, matrix, matrix2); } }, new Matrix(this.C)); qxa.b("iconScale").HH_(ofObject); arrayList.add(ofObject); AnimatorSet animatorSet = new AnimatorSet(); vnt.HC_(animatorSet, arrayList); return animatorSet; } private AnimatorSet Jv_(float f, float f2, float f3, int i2, int i3) { AnimatorSet animatorSet = new AnimatorSet(); ArrayList arrayList = new ArrayList(); ValueAnimator ofFloat = ValueAnimator.ofFloat(BitmapDescriptorFactory.HUE_RED, 1.0f); ofFloat.addUpdateListener(new ValueAnimator.AnimatorUpdateListener(this, this.E.getAlpha(), f, this.E.getScaleX(), f2, this.E.getScaleY(), this.s, f3, new Matrix(this.C)) { // from class: o.DuC.2 private float a; private float b; private DuC c; private float d; private Matrix e; private float f; private float h; private float i; private float j; { this.c = this; this.a = r2; this.h = f; this.d = r4; this.j = f2; this.f = r6; this.b = r7; this.i = f3; this.e = r9; } @Override // android.animation.ValueAnimator.AnimatorUpdateListener public final void onAnimationUpdate(ValueAnimator valueAnimator) { float floatValue = ((Float) valueAnimator.getAnimatedValue()).floatValue(); this.c.E.setAlpha(C6217cMa.b(this.a, this.h, BitmapDescriptorFactory.HUE_RED, 0.2f, floatValue)); FloatingActionButton floatingActionButton = this.c.E; float f4 = this.d; floatingActionButton.setScaleX(f4 + ((this.j - f4) * floatValue)); FloatingActionButton floatingActionButton2 = this.c.E; float f5 = this.f; floatingActionButton2.setScaleY(f5 + ((this.j - f5) * floatValue)); DuC duC = this.c; float f6 = this.b; duC.s = f6 + ((this.i - f6) * floatValue); DuC duC2 = this.c; float f7 = this.b; duC2.Jt_(f7 + (floatValue * (this.i - f7)), this.e); this.c.E.setImageMatrix(this.e); } }); arrayList.add(ofFloat); vnt.HC_(animatorSet, arrayList); Context context = this.E.getContext(); int integer = this.E.getContext().getResources().getInteger(C17052tZT.saX.material_motion_duration_long_1); TypedValue typedValue = new TypedValue(); if (!context.getTheme().resolveAttribute(i2, typedValue, true)) { typedValue = null; } if (typedValue != null && typedValue.type == 16) { integer = typedValue.data; } animatorSet.setDuration(integer); animatorSet.setInterpolator(DAZ.Kh_(this.E.getContext(), i3, C6217cMa.d)); return animatorSet; } public final void h() { ArrayList arrayList = this.G; if (arrayList != null) { Iterator it = arrayList.iterator(); while (it.hasNext()) { it.next().a(); } } } public final void i() { ArrayList arrayList = this.G; if (arrayList != null) { Iterator it = arrayList.iterator(); while (it.hasNext()) { it.next().c(); } } } public final void o() { Rect rect = this.K; JD_(rect); Jz_(rect); this.u.a(rect.left, rect.top, rect.right, rect.bottom); } /* JADX INFO: Access modifiers changed from: package-private */ public void JD_(Rect rect) { int i2; if (this.m) { int i3 = this.p; FloatingActionButton floatingActionButton = this.E; i2 = (i3 - floatingActionButton.a(floatingActionButton.j)) / 2; } else { i2 = 0; } int max = Math.max(i2, (int) Math.ceil(this.x ? d() + this.w : BitmapDescriptorFactory.HUE_RED)); int max2 = Math.max(i2, (int) Math.ceil(r1 * 1.5f)); rect.set(max, max2, max, max2); } private void Jz_(Rect rect) { if (this.g != null) { if (g()) { this.u.KW_(new InsetDrawable(this.g, rect.left, rect.top, rect.right, rect.bottom)); return; } else { this.u.KW_(this.g); return; } } throw new NullPointerException("Didn't initialize content background"); } C4363bXv a() { return new C4363bXv(this.D); } public final boolean c() { return this.E.getVisibility() != 0 ? this.j == 2 : this.j != 1; } public final boolean b() { return this.E.getVisibility() == 0 ? this.j == 1 : this.j != 2; } private static ValueAnimator Jw_(ojQ ojq) { ValueAnimator valueAnimator = new ValueAnimator(); valueAnimator.setInterpolator(a); valueAnimator.setDuration(100L); valueAnimator.addListener(ojq); valueAnimator.addUpdateListener(ojq); valueAnimator.setFloatValues(BitmapDescriptorFactory.HUE_RED, 1.0f); return valueAnimator; } /* loaded from: classes2.dex */ abstract class ojQ extends AnimatorListenerAdapter implements ValueAnimator.AnimatorUpdateListener { private boolean b; private DuC c; private float d; private float e; protected abstract float b(); private ojQ(DuC duC) { this.c = duC; } /* synthetic */ ojQ(DuC duC, byte b) { this(duC); } @Override // android.animation.ValueAnimator.AnimatorUpdateListener public void onAnimationUpdate(ValueAnimator valueAnimator) { if (!this.b) { this.e = this.c.z == null ? BitmapDescriptorFactory.HUE_RED : this.c.z.B.e; this.d = b(); this.b = true; } DuC duC = this.c; float f = this.e; float animatedFraction = (int) (f + ((this.d - f) * valueAnimator.getAnimatedFraction())); C4363bXv c4363bXv = duC.z; if (c4363bXv != null) { c4363bXv.n(animatedFraction); } } @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener public void onAnimationEnd(Animator animator) { DuC duC = this.c; float f = (int) this.d; C4363bXv c4363bXv = duC.z; if (c4363bXv != null) { c4363bXv.n(f); } this.b = false; } } /* loaded from: classes2.dex */ class saX extends ojQ { private DuC c; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ saX(DuC duC) { super(duC, (byte) 0); this.c = duC; } @Override // o.DuC.ojQ protected final float b() { return this.c.n; } } /* loaded from: classes2.dex */ class Sts extends ojQ { private DuC b; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ Sts(DuC duC) { super(duC, (byte) 0); this.b = duC; } @Override // o.DuC.ojQ protected final float b() { return this.b.n + this.b.r; } } /* loaded from: classes2.dex */ class IeS extends ojQ { private DuC e; /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ IeS(DuC duC) { super(duC, (byte) 0); this.e = duC; } @Override // o.DuC.ojQ protected final float b() { return this.e.n + this.e.w; } } /* loaded from: classes2.dex */ class HBt extends ojQ { private DuC e; @Override // o.DuC.ojQ protected final float b() { return BitmapDescriptorFactory.HUE_RED; } /* JADX WARN: 'super' call moved to the top of the method (can break code semantics) */ HBt(DuC duC) { super(duC, (byte) 0); this.e = duC; } } void l() { int i2; C4363bXv c4363bXv = this.z; if (c4363bXv == null || c4363bXv.B.n == (i2 = (int) this.v)) { return; } c4363bXv.B.n = i2; c4363bXv.a(); } float d() { return this.n; } }