package u5;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.util.Property;
import android.view.View;
import u5.n;

/* loaded from: classes.dex */
abstract class v {

    /* loaded from: classes.dex */
    private static class a extends AnimatorListenerAdapter implements n.f {

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

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

        /* renamed from: c, reason: collision with root package name */
        private final int f36944c;

        /* renamed from: d, reason: collision with root package name */
        private final int f36945d;

        /* renamed from: e, reason: collision with root package name */
        private int[] f36946e;

        /* renamed from: f, reason: collision with root package name */
        private float f36947f;

        /* renamed from: g, reason: collision with root package name */
        private float f36948g;

        /* renamed from: h, reason: collision with root package name */
        private final float f36949h;

        /* renamed from: i, reason: collision with root package name */
        private final float f36950i;

        a(View view, View view2, int i10, int i11, float f10, float f11) {
            this.f36943b = view;
            this.f36942a = view2;
            this.f36944c = i10 - Math.round(view.getTranslationX());
            this.f36945d = i11 - Math.round(view.getTranslationY());
            this.f36949h = f10;
            this.f36950i = f11;
            int i12 = i.f36868c;
            int[] iArr = (int[]) view2.getTag(i12);
            this.f36946e = iArr;
            if (iArr != null) {
                view2.setTag(i12, null);
            }
        }

        @Override // u5.n.f
        public void a(n nVar) {
        }

        @Override // u5.n.f
        public void b(n nVar) {
        }

        @Override // u5.n.f
        public void c(n nVar) {
            this.f36943b.setTranslationX(this.f36949h);
            this.f36943b.setTranslationY(this.f36950i);
            nVar.W(this);
        }

        @Override // u5.n.f
        public void d(n nVar) {
        }

        @Override // u5.n.f
        public void e(n nVar) {
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationCancel(Animator animator) {
            if (this.f36946e == null) {
                this.f36946e = new int[2];
            }
            this.f36946e[0] = Math.round(this.f36944c + this.f36943b.getTranslationX());
            this.f36946e[1] = Math.round(this.f36945d + this.f36943b.getTranslationY());
            this.f36942a.setTag(i.f36868c, this.f36946e);
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorPauseListener
        public void onAnimationPause(Animator animator) {
            this.f36947f = this.f36943b.getTranslationX();
            this.f36948g = this.f36943b.getTranslationY();
            this.f36943b.setTranslationX(this.f36949h);
            this.f36943b.setTranslationY(this.f36950i);
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorPauseListener
        public void onAnimationResume(Animator animator) {
            this.f36943b.setTranslationX(this.f36947f);
            this.f36943b.setTranslationY(this.f36948g);
        }
    }

    /* JADX INFO: Access modifiers changed from: package-private */
    public static Animator a(View view, t tVar, int i10, int i11, float f10, float f11, float f12, float f13, TimeInterpolator timeInterpolator, n nVar) {
        float f14;
        float f15;
        float translationX = view.getTranslationX();
        float translationY = view.getTranslationY();
        if (((int[]) tVar.f36936b.getTag(i.f36868c)) != null) {
            f14 = (r4[0] - i10) + translationX;
            f15 = (r4[1] - i11) + translationY;
        } else {
            f14 = f10;
            f15 = f11;
        }
        int round = Math.round(f14 - translationX) + i10;
        int round2 = i11 + Math.round(f15 - translationY);
        view.setTranslationX(f14);
        view.setTranslationY(f15);
        if (f14 == f12 && f15 == f13) {
            return null;
        }
        ObjectAnimator ofPropertyValuesHolder = ObjectAnimator.ofPropertyValuesHolder(view, PropertyValuesHolder.ofFloat((Property<?, Float>) View.TRANSLATION_X, f14, f12), PropertyValuesHolder.ofFloat((Property<?, Float>) View.TRANSLATION_Y, f15, f13));
        a aVar = new a(view, tVar.f36936b, round, round2, translationX, translationY);
        nVar.a(aVar);
        ofPropertyValuesHolder.addListener(aVar);
        u5.a.a(ofPropertyValuesHolder, aVar);
        ofPropertyValuesHolder.setInterpolator(timeInterpolator);
        return ofPropertyValuesHolder;
    }
}
