package g.e.j;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
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 s {
    private WeakReference<View> a;
    Runnable b = null;
    Runnable c = null;
    int d = -1;

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

        a(s sVar, t tVar, View view) {
            this.a = tVar;
            this.b = view;
        }

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

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

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

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

        b(s sVar, v vVar, View view) {
            this.a = vVar;
            this.b = view;
        }

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

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    static class c implements t {
        s a;
        boolean b;

        c(s sVar) {
            this.a = sVar;
        }

        @Override // g.e.j.t
        public void a(View view) {
            Object tag = view.getTag(2113929216);
            t tVar = tag instanceof t ? (t) tag : null;
            if (tVar != null) {
                tVar.a(view);
            }
        }

        @Override // g.e.j.t
        public void b(View view) {
            int i2 = this.a.d;
            if (i2 > -1) {
                view.setLayerType(i2, null);
                this.a.d = -1;
            }
            if (Build.VERSION.SDK_INT >= 16 || !this.b) {
                s sVar = this.a;
                Runnable runnable = sVar.c;
                if (runnable != null) {
                    sVar.c = null;
                    runnable.run();
                }
                Object tag = view.getTag(2113929216);
                t tVar = tag instanceof t ? (t) tag : null;
                if (tVar != null) {
                    tVar.b(view);
                }
                this.b = true;
            }
        }

        @Override // g.e.j.t
        public void c(View view) {
            this.b = false;
            if (this.a.d > -1) {
                view.setLayerType(2, null);
            }
            s sVar = this.a;
            Runnable runnable = sVar.b;
            if (runnable != null) {
                sVar.b = null;
                runnable.run();
            }
            Object tag = view.getTag(2113929216);
            t tVar = tag instanceof t ? (t) tag : null;
            if (tVar != null) {
                tVar.c(view);
            }
        }
    }

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

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

    public s a(float f) {
        View view = this.a.get();
        if (view != null) {
            view.animate().alpha(f);
        }
        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 s d(long j2) {
        View view = this.a.get();
        if (view != null) {
            view.animate().setDuration(j2);
        }
        return this;
    }

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

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

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

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

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

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