package r3;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.graphics.PointF;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import java.util.HashMap;
import l.j3;

/* JADX INFO: loaded from: classes.dex */
public final class e extends z {

    /* JADX INFO: renamed from: k0, reason: collision with root package name */
    public static final String[] f32372k0 = {"android:changeBounds:bounds", "android:changeBounds:clip", "android:changeBounds:parent", "android:changeBounds:windowX", "android:changeBounds:windowY"};

    /* JADX INFO: renamed from: l0, reason: collision with root package name */
    public static final j3 f32373l0;

    /* JADX INFO: renamed from: m0, reason: collision with root package name */
    public static final j3 f32374m0;

    /* JADX INFO: renamed from: n0, reason: collision with root package name */
    public static final j3 f32375n0;

    /* JADX INFO: renamed from: o0, reason: collision with root package name */
    public static final j3 f32376o0;

    /* JADX INFO: renamed from: p0, reason: collision with root package name */
    public static final j3 f32377p0;

    static {
        Class<PointF> cls = PointF.class;
        String str = "topLeft";
        f32373l0 = new j3(1, cls, str);
        String str2 = "bottomRight";
        f32374m0 = new j3(2, cls, str2);
        f32375n0 = new j3(3, cls, str2);
        f32376o0 = new j3(4, cls, str);
        f32377p0 = new j3(5, cls, "position");
    }

    public static void H(k0 k0Var) {
        View view = k0Var.f32401b;
        if (!view.isLaidOut() && view.getWidth() == 0 && view.getHeight() == 0) {
            return;
        }
        HashMap map = k0Var.f32400a;
        map.put("android:changeBounds:bounds", new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()));
        map.put("android:changeBounds:parent", k0Var.f32401b.getParent());
    }

    @Override // r3.z
    @Nullable
    public Animator createAnimator(@NonNull ViewGroup viewGroup, @Nullable k0 k0Var, @Nullable k0 k0Var2) {
        int i10;
        Animator animatorA;
        if (k0Var == null || k0Var2 == null) {
            return null;
        }
        HashMap map = k0Var.f32400a;
        HashMap map2 = k0Var2.f32400a;
        ViewGroup viewGroup2 = (ViewGroup) map.get("android:changeBounds:parent");
        ViewGroup viewGroup3 = (ViewGroup) map2.get("android:changeBounds:parent");
        if (viewGroup2 == null || viewGroup3 == null) {
            return null;
        }
        Rect rect = (Rect) map.get("android:changeBounds:bounds");
        Rect rect2 = (Rect) map2.get("android:changeBounds:bounds");
        int i11 = rect.left;
        int i12 = rect2.left;
        int i13 = rect.top;
        int i14 = rect2.top;
        int i15 = rect.right;
        int i16 = rect2.right;
        int i17 = rect.bottom;
        int i18 = rect2.bottom;
        int i19 = i15 - i11;
        int i20 = i17 - i13;
        int i21 = i16 - i12;
        int i22 = i18 - i14;
        Rect rect3 = (Rect) map.get("android:changeBounds:clip");
        Rect rect4 = (Rect) map2.get("android:changeBounds:clip");
        if ((i19 == 0 || i20 == 0) && (i21 == 0 || i22 == 0)) {
            i10 = 0;
        } else {
            i10 = (i11 == i12 && i13 == i14) ? 0 : 1;
            if (i15 != i16 || i17 != i18) {
                i10++;
            }
        }
        if ((rect3 != null && !rect3.equals(rect4)) || (rect3 == null && rect4 != null)) {
            i10++;
        }
        int i23 = i10;
        if (i23 <= 0) {
            return null;
        }
        View view = k0Var2.f32401b;
        m0.a(view, i11, i13, i15, i17);
        if (i23 != 2) {
            animatorA = (i11 == i12 && i13 == i14) ? m.a(view, f32375n0, this.f32453c0.a(i15, i17, i16, i18)) : m.a(view, f32376o0, this.f32453c0.a(i11, i13, i12, i14));
        } else if (i19 == i21 && i20 == i22) {
            animatorA = m.a(view, f32377p0, this.f32453c0.a(i11, i13, i12, i14));
        } else {
            d dVar = new d(view);
            ObjectAnimator objectAnimatorA = m.a(dVar, f32373l0, this.f32453c0.a(i11, i13, i12, i14));
            ObjectAnimator objectAnimatorA2 = m.a(dVar, f32374m0, this.f32453c0.a(i15, i17, i16, i18));
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.playTogether(objectAnimatorA, objectAnimatorA2);
            animatorSet.addListener(new b(dVar));
            animatorA = animatorSet;
        }
        if (view.getParent() instanceof ViewGroup) {
            ViewGroup viewGroup4 = (ViewGroup) view.getParent();
            com.bumptech.glide.i.e(viewGroup4, true);
            q().a(new c(viewGroup4));
        }
        return animatorA;
    }

    @Override // r3.z
    public final void d(k0 k0Var) {
        H(k0Var);
    }

    @Override // r3.z
    public final void g(k0 k0Var) {
        H(k0Var);
    }

    @Override // r3.z
    public final String[] getTransitionProperties() {
        return f32372k0;
    }
}
