package com.google.android.material.floatingactionbutton;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.StateListAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.RippleDrawable;
import android.util.Property;
import android.view.View;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import java.util.ArrayList;
import lj.g;
import lj.k;
import s3.i;

/* loaded from: classes3.dex */
class c extends b {

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes3.dex */
    public static class a extends g {
        a(k kVar) {
            super(kVar);
        }

        @Override // lj.g, android.graphics.drawable.Drawable
        public boolean isStateful() {
            return true;
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public c(FloatingActionButton floatingActionButton, kj.b bVar) {
        super(floatingActionButton, bVar);
    }

    private Animator f0(float f10, float f11) {
        AnimatorSet animatorSet = new AnimatorSet();
        animatorSet.play(ObjectAnimator.ofFloat(this.f13256w, "elevation", f10).setDuration(0L)).with(ObjectAnimator.ofFloat(this.f13256w, (Property<FloatingActionButton, Float>) View.TRANSLATION_Z, f11).setDuration(100L));
        animatorSet.setInterpolator(b.D);
        return animatorSet;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void A(int[] iArr) {
    }

    @Override // com.google.android.material.floatingactionbutton.b
    void B(float f10, float f11, float f12) {
        StateListAnimator stateListAnimator = new StateListAnimator();
        stateListAnimator.addState(b.E, f0(f10, f12));
        stateListAnimator.addState(b.F, f0(f10, f11));
        stateListAnimator.addState(b.G, f0(f10, f11));
        stateListAnimator.addState(b.H, f0(f10, f11));
        AnimatorSet animatorSet = new AnimatorSet();
        ArrayList arrayList = new ArrayList();
        arrayList.add(ObjectAnimator.ofFloat(this.f13256w, "elevation", f10).setDuration(0L));
        arrayList.add(ObjectAnimator.ofFloat(this.f13256w, (Property<FloatingActionButton, Float>) View.TRANSLATION_Z, BitmapDescriptorFactory.HUE_RED).setDuration(100L));
        animatorSet.playSequentially((Animator[]) arrayList.toArray(new Animator[0]));
        animatorSet.setInterpolator(b.D);
        stateListAnimator.addState(b.I, animatorSet);
        stateListAnimator.addState(b.J, f0(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED));
        this.f13256w.setStateListAnimator(stateListAnimator);
        if (V()) {
            b0();
        }
    }

    @Override // com.google.android.material.floatingactionbutton.b
    boolean G() {
        return false;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void R(ColorStateList colorStateList) {
        Drawable drawable = this.f13236c;
        if (drawable instanceof RippleDrawable) {
            ((RippleDrawable) drawable).setColor(jj.b.d(colorStateList));
        } else {
            super.R(colorStateList);
        }
    }

    @Override // com.google.android.material.floatingactionbutton.b
    boolean V() {
        return this.f13257x.c() || !X();
    }

    @Override // com.google.android.material.floatingactionbutton.b
    void Z() {
    }

    com.google.android.material.floatingactionbutton.a e0(int i10, ColorStateList colorStateList) {
        Context context = this.f13256w.getContext();
        com.google.android.material.floatingactionbutton.a aVar = new com.google.android.material.floatingactionbutton.a((k) i.g(this.f13234a));
        aVar.e(androidx.core.content.a.getColor(context, vi.c.f39750f), androidx.core.content.a.getColor(context, vi.c.f39749e), androidx.core.content.a.getColor(context, vi.c.f39747c), androidx.core.content.a.getColor(context, vi.c.f39748d));
        aVar.d(i10);
        aVar.c(colorStateList);
        return aVar;
    }

    g g0() {
        return new a((k) i.g(this.f13234a));
    }

    @Override // com.google.android.material.floatingactionbutton.b
    public float j() {
        return this.f13256w.getElevation();
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void o(Rect rect) {
        if (this.f13257x.c()) {
            super.o(rect);
        } else if (X()) {
            rect.set(0, 0, 0, 0);
        } else {
            int sizeDimension = (this.f13244k - this.f13256w.getSizeDimension()) / 2;
            rect.set(sizeDimension, sizeDimension, sizeDimension, sizeDimension);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void t(ColorStateList colorStateList, PorterDuff.Mode mode, ColorStateList colorStateList2, int i10) {
        Drawable drawable;
        g g02 = g0();
        this.f13235b = g02;
        g02.setTintList(colorStateList);
        if (mode != null) {
            this.f13235b.setTintMode(mode);
        }
        this.f13235b.L(this.f13256w.getContext());
        if (i10 > 0) {
            this.f13237d = e0(i10, colorStateList);
            drawable = new LayerDrawable(new Drawable[]{(Drawable) i.g(this.f13237d), (Drawable) i.g(this.f13235b)});
        } else {
            this.f13237d = null;
            drawable = this.f13235b;
        }
        RippleDrawable rippleDrawable = new RippleDrawable(jj.b.d(colorStateList2), drawable, null);
        this.f13236c = rippleDrawable;
        this.f13238e = rippleDrawable;
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void w() {
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    @Override // com.google.android.material.floatingactionbutton.b
    public void y() {
        b0();
    }
}
