package u5;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.util.Property;
import android.view.View;
import android.view.ViewGroup;
import androidx.core.view.s0;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;

/* loaded from: classes.dex */
public class d extends i0 {

    /* JADX INFO: Access modifiers changed from: package-private */
    /* loaded from: classes.dex */
    public class a extends o {

        /* renamed from: a, reason: collision with root package name */
        final /* synthetic */ View f36844a;

        a(View view) {
            this.f36844a = view;
        }

        @Override // u5.n.f
        public void c(n nVar) {
            b0.g(this.f36844a, 1.0f);
            b0.a(this.f36844a);
            nVar.W(this);
        }
    }

    /* JADX INFO: Access modifiers changed from: private */
    /* loaded from: classes.dex */
    public static class b extends AnimatorListenerAdapter {

        /* renamed from: a, reason: collision with root package name */
        private final View f36846a;

        /* renamed from: b, reason: collision with root package name */
        private boolean f36847b = false;

        b(View view) {
            this.f36846a = view;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            b0.g(this.f36846a, 1.0f);
            if (this.f36847b) {
                this.f36846a.setLayerType(0, null);
            }
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationStart(Animator animator) {
            if (s0.M(this.f36846a) && this.f36846a.getLayerType() == 0) {
                this.f36847b = true;
                this.f36846a.setLayerType(2, null);
            }
        }
    }

    public d(int i10) {
        q0(i10);
    }

    private Animator r0(View view, float f10, float f11) {
        if (f10 == f11) {
            return null;
        }
        b0.g(view, f10);
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(view, (Property<View, Float>) b0.f36807b, f11);
        ofFloat.addListener(new b(view));
        a(new a(view));
        return ofFloat;
    }

    private static float t0(t tVar, float f10) {
        Float f11;
        return (tVar == null || (f11 = (Float) tVar.f36935a.get("android:fade:transitionAlpha")) == null) ? f10 : f11.floatValue();
    }

    @Override // u5.i0, u5.n
    public void k(t tVar) {
        super.k(tVar);
        tVar.f36935a.put("android:fade:transitionAlpha", Float.valueOf(b0.c(tVar.f36936b)));
    }

    @Override // u5.i0
    public Animator m0(ViewGroup viewGroup, View view, t tVar, t tVar2) {
        float f10 = BitmapDescriptorFactory.HUE_RED;
        float t02 = t0(tVar, BitmapDescriptorFactory.HUE_RED);
        if (t02 != 1.0f) {
            f10 = t02;
        }
        return r0(view, f10, 1.0f);
    }

    @Override // u5.i0
    public Animator o0(ViewGroup viewGroup, View view, t tVar, t tVar2) {
        b0.e(view);
        return r0(view, t0(tVar, 1.0f), BitmapDescriptorFactory.HUE_RED);
    }

    public d() {
    }
}
