package defpackage;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TypeConverter;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.Property;
import android.view.View;
import android.view.ViewGroup;
import java.util.HashMap;
import java.util.WeakHashMap;

/* JADX INFO: loaded from: classes.dex */
public class fu0 extends au9 {
    public static final String[] a = {"android:changeBounds:bounds", "android:changeBounds:clip", "android:changeBounds:parent", "android:changeBounds:windowX", "android:changeBounds:windowY"};
    public static final Property b;
    public static final Property c;
    public static final Property d;
    public static final Property e;
    public static final Property f;

    public class a extends Property<Drawable, PointF> {
        public Rect a;

        @Override // android.util.Property
        public final PointF get(Drawable drawable) {
            drawable.copyBounds(this.a);
            return new PointF(r0.left, r0.top);
        }

        @Override // android.util.Property
        public final void set(Drawable drawable, PointF pointF) {
            Drawable drawable2 = drawable;
            PointF pointF2 = pointF;
            Rect rect = this.a;
            drawable2.copyBounds(rect);
            rect.offsetTo(Math.round(pointF2.x), Math.round(pointF2.y));
            drawable2.setBounds(rect);
        }
    }

    public class b extends Property<g, PointF> {
        @Override // android.util.Property
        public final /* bridge */ /* synthetic */ PointF get(g gVar) {
            return null;
        }

        @Override // android.util.Property
        public final void set(g gVar, PointF pointF) {
            g gVar2 = gVar;
            PointF pointF2 = pointF;
            gVar2.getClass();
            gVar2.a = Math.round(pointF2.x);
            int iRound = Math.round(pointF2.y);
            gVar2.b = iRound;
            int i = gVar2.f + 1;
            gVar2.f = i;
            if (i == gVar2.g) {
                dma.a(gVar2.e, gVar2.a, iRound, gVar2.c, gVar2.d);
                gVar2.f = 0;
                gVar2.g = 0;
            }
        }
    }

    public class c extends Property<g, PointF> {
        @Override // android.util.Property
        public final /* bridge */ /* synthetic */ PointF get(g gVar) {
            return null;
        }

        @Override // android.util.Property
        public final void set(g gVar, PointF pointF) {
            g gVar2 = gVar;
            PointF pointF2 = pointF;
            gVar2.getClass();
            gVar2.c = Math.round(pointF2.x);
            int iRound = Math.round(pointF2.y);
            gVar2.d = iRound;
            int i = gVar2.g + 1;
            gVar2.g = i;
            if (gVar2.f == i) {
                dma.a(gVar2.e, gVar2.a, gVar2.b, gVar2.c, iRound);
                gVar2.f = 0;
                gVar2.g = 0;
            }
        }
    }

    public class d extends Property<View, PointF> {
        @Override // android.util.Property
        public final /* bridge */ /* synthetic */ PointF get(View view) {
            return null;
        }

        @Override // android.util.Property
        public final void set(View view, PointF pointF) {
            View view2 = view;
            PointF pointF2 = pointF;
            dma.a(view2, view2.getLeft(), view2.getTop(), Math.round(pointF2.x), Math.round(pointF2.y));
        }
    }

    public class e extends Property<View, PointF> {
        @Override // android.util.Property
        public final /* bridge */ /* synthetic */ PointF get(View view) {
            return null;
        }

        @Override // android.util.Property
        public final void set(View view, PointF pointF) {
            View view2 = view;
            PointF pointF2 = pointF;
            dma.a(view2, Math.round(pointF2.x), Math.round(pointF2.y), view2.getRight(), view2.getBottom());
        }
    }

    public class f extends Property<View, PointF> {
        @Override // android.util.Property
        public final /* bridge */ /* synthetic */ PointF get(View view) {
            return null;
        }

        @Override // android.util.Property
        public final void set(View view, PointF pointF) {
            View view2 = view;
            PointF pointF2 = pointF;
            int iRound = Math.round(pointF2.x);
            int iRound2 = Math.round(pointF2.y);
            dma.a(view2, iRound, iRound2, view2.getWidth() + iRound, view2.getHeight() + iRound2);
        }
    }

    public static class g {
        public int a;
        public int b;
        public int c;
        public int d;
        public View e;
        public int f;
        public int g;
    }

    static {
        new a(PointF.class, "boundsOrigin").a = new Rect();
        b = new b(PointF.class, "topLeft");
        c = new c(PointF.class, "bottomRight");
        d = new d(PointF.class, "bottomRight");
        e = new e(PointF.class, "topLeft");
        f = new f(PointF.class, "position");
    }

    public static void e(hv9 hv9Var) {
        View view = hv9Var.b;
        HashMap map = hv9Var.a;
        WeakHashMap weakHashMap = sia.a;
        if (!view.isLaidOut() && view.getWidth() == 0 && view.getHeight() == 0) {
            return;
        }
        map.put("android:changeBounds:bounds", new Rect(view.getLeft(), view.getTop(), view.getRight(), view.getBottom()));
        map.put("android:changeBounds:parent", hv9Var.b.getParent());
    }

    @Override // defpackage.au9
    public final void captureEndValues(hv9 hv9Var) {
        e(hv9Var);
    }

    @Override // defpackage.au9
    public final void captureStartValues(hv9 hv9Var) {
        e(hv9Var);
    }

    @Override // defpackage.au9
    public final Animator createAnimator(ViewGroup viewGroup, hv9 hv9Var, hv9 hv9Var2) {
        int i;
        Animator animatorOfObject;
        if (hv9Var != null) {
            HashMap map = hv9Var.a;
            if (hv9Var2 != null) {
                HashMap map2 = hv9Var2.a;
                ViewGroup viewGroup2 = (ViewGroup) map.get("android:changeBounds:parent");
                ViewGroup viewGroup3 = (ViewGroup) map2.get("android:changeBounds:parent");
                if (viewGroup2 != null && viewGroup3 != null) {
                    View view = hv9Var2.b;
                    Rect rect = (Rect) map.get("android:changeBounds:bounds");
                    Rect rect2 = (Rect) map2.get("android:changeBounds:bounds");
                    int i2 = rect.left;
                    int i3 = rect2.left;
                    int i4 = rect.top;
                    int i5 = rect2.top;
                    int i6 = rect.right;
                    int i7 = rect2.right;
                    int i8 = rect.bottom;
                    int i9 = rect2.bottom;
                    int i10 = i6 - i2;
                    int i11 = i8 - i4;
                    int i12 = i7 - i3;
                    int i13 = i9 - i5;
                    Rect rect3 = (Rect) map.get("android:changeBounds:clip");
                    Rect rect4 = (Rect) map2.get("android:changeBounds:clip");
                    if ((i10 == 0 || i11 == 0) && (i12 == 0 || i13 == 0)) {
                        i = 0;
                    } else {
                        i = (i2 == i3 && i4 == i5) ? 0 : 1;
                        if (i6 != i7 || i8 != i9) {
                            i++;
                        }
                    }
                    if ((rect3 != null && !rect3.equals(rect4)) || (rect3 == null && rect4 != null)) {
                        i++;
                    }
                    int i14 = i;
                    if (i14 > 0) {
                        dma.a(view, i2, i4, i6, i8);
                        if (i14 != 2) {
                            animatorOfObject = (i2 == i3 && i4 == i5) ? ObjectAnimator.ofObject(view, (Property<View, V>) d, (TypeConverter) null, getPathMotion().getPath(i6, i8, i7, i9)) : ObjectAnimator.ofObject(view, (Property<View, V>) e, (TypeConverter) null, getPathMotion().getPath(i2, i4, i3, i5));
                        } else if (i10 == i12 && i11 == i13) {
                            animatorOfObject = ObjectAnimator.ofObject(view, (Property<View, V>) f, (TypeConverter) null, getPathMotion().getPath(i2, i4, i3, i5));
                        } else {
                            g gVar = new g();
                            gVar.e = view;
                            ObjectAnimator objectAnimatorOfObject = ObjectAnimator.ofObject(gVar, (Property<g, V>) b, (TypeConverter) null, getPathMotion().getPath(i2, i4, i3, i5));
                            ObjectAnimator objectAnimatorOfObject2 = ObjectAnimator.ofObject(gVar, (Property<g, V>) c, (TypeConverter) null, getPathMotion().getPath(i6, i8, i7, i9));
                            AnimatorSet animatorSet = new AnimatorSet();
                            animatorSet.playTogether(objectAnimatorOfObject, objectAnimatorOfObject2);
                            animatorSet.addListener(new gu0(gVar));
                            animatorOfObject = animatorSet;
                        }
                        if (!(view.getParent() instanceof ViewGroup)) {
                            return animatorOfObject;
                        }
                        ViewGroup viewGroup4 = (ViewGroup) view.getParent();
                        eja.a(viewGroup4, true);
                        addListener(new iu0(viewGroup4));
                        return animatorOfObject;
                    }
                }
            }
        }
        return null;
    }

    @Override // defpackage.au9
    public final String[] getTransitionProperties() {
        return a;
    }
}
