package c.f.l;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.annotation.SuppressLint;
import android.os.Build;
import android.view.View;
import android.view.animation.Interpolator;
import java.lang.ref.WeakReference;

/* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
/* JADX INFO: loaded from: classes.dex */
public final class x {
    private WeakReference<View> a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    Runnable f1495b = null;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    Runnable f1496c = null;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    int f1497d = -1;

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    class a extends AnimatorListenerAdapter {
        final /* synthetic */ y a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ View f1498b;

        a(x xVar, y yVar, View view) {
            this.a = yVar;
            this.f1498b = view;
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationCancel(Animator animator) {
            this.a.a(this.f1498b);
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationEnd(Animator animator) {
            this.a.b(this.f1498b);
        }

        @Override // android.animation.AnimatorListenerAdapter, android.animation.Animator.AnimatorListener
        public void onAnimationStart(Animator animator) {
            this.a.c(this.f1498b);
        }
    }

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    class b implements ValueAnimator.AnimatorUpdateListener {
        final /* synthetic */ a0 a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        final /* synthetic */ View f1499b;

        b(x xVar, a0 a0Var, View view) {
            this.a = a0Var;
            this.f1499b = view;
        }

        @Override // android.animation.ValueAnimator.AnimatorUpdateListener
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            this.a.a(this.f1499b);
        }
    }

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    static class c implements y {
        x a;

        /* JADX INFO: renamed from: b, reason: collision with root package name */
        boolean f1500b;

        c(x xVar) {
            this.a = xVar;
        }

        @Override // c.f.l.y
        public void a(View view) {
            Object tag = view.getTag(2113929216);
            y yVar = tag instanceof y ? (y) tag : null;
            if (yVar != null) {
                yVar.a(view);
            }
        }

        @Override // c.f.l.y
        @SuppressLint({"WrongConstant"})
        public void b(View view) {
            int i2 = this.a.f1497d;
            if (i2 > -1) {
                view.setLayerType(i2, null);
                this.a.f1497d = -1;
            }
            if (Build.VERSION.SDK_INT >= 16 || !this.f1500b) {
                x xVar = this.a;
                Runnable runnable = xVar.f1496c;
                if (runnable != null) {
                    xVar.f1496c = null;
                    runnable.run();
                }
                Object tag = view.getTag(2113929216);
                y yVar = tag instanceof y ? (y) tag : null;
                if (yVar != null) {
                    yVar.b(view);
                }
                this.f1500b = true;
            }
        }

        @Override // c.f.l.y
        public void c(View view) {
            this.f1500b = false;
            if (this.a.f1497d > -1) {
                view.setLayerType(2, null);
            }
            x xVar = this.a;
            Runnable runnable = xVar.f1495b;
            if (runnable != null) {
                xVar.f1495b = null;
                runnable.run();
            }
            Object tag = view.getTag(2113929216);
            y yVar = tag instanceof y ? (y) tag : null;
            if (yVar != null) {
                yVar.c(view);
            }
        }
    }

    x(View view) {
        this.a = new WeakReference<>(view);
    }

    private void g(View view, y yVar) {
        if (yVar != null) {
            view.animate().setListener(new a(this, yVar, view));
        } else {
            view.animate().setListener(null);
        }
    }

    public x a(float f2) {
        View view = this.a.get();
        if (view != null) {
            view.animate().alpha(f2);
        }
        return this;
    }

    public void b() {
        View view = this.a.get();
        if (view != null) {
            view.animate().cancel();
        }
    }

    public long c() {
        View view = this.a.get();
        if (view != null) {
            return view.animate().getDuration();
        }
        return 0L;
    }

    public x d(long j2) {
        View view = this.a.get();
        if (view != null) {
            view.animate().setDuration(j2);
        }
        return this;
    }

    public x e(Interpolator interpolator) {
        View view = this.a.get();
        if (view != null) {
            view.animate().setInterpolator(interpolator);
        }
        return this;
    }

    public x f(y yVar) {
        View view = this.a.get();
        if (view != null) {
            if (Build.VERSION.SDK_INT >= 16) {
                g(view, yVar);
            } else {
                view.setTag(2113929216, yVar);
                g(view, new c(this));
            }
        }
        return this;
    }

    public x h(long j2) {
        View view = this.a.get();
        if (view != null) {
            view.animate().setStartDelay(j2);
        }
        return this;
    }

    public x i(a0 a0Var) {
        View view = this.a.get();
        if (view != null && Build.VERSION.SDK_INT >= 19) {
            view.animate().setUpdateListener(a0Var != null ? new b(this, a0Var, view) : null);
        }
        return this;
    }

    public void j() {
        View view = this.a.get();
        if (view != null) {
            view.animate().start();
        }
    }

    public x k(float f2) {
        View view = this.a.get();
        if (view != null) {
            view.animate().translationY(f2);
        }
        return this;
    }
}
