package a.b.c.g;

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 t {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private WeakReference<View> f251a;

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

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

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

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    class a extends AnimatorListenerAdapter {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final /* synthetic */ u f255a;

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

        a(t tVar, u uVar, View view) {
            this.f255a = uVar;
            this.f256b = view;
        }

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

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

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

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    class b implements ValueAnimator.AnimatorUpdateListener {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        final /* synthetic */ w f257a;

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

        b(t tVar, w wVar, View view) {
            this.f257a = wVar;
            this.f258b = view;
        }

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

    /* JADX INFO: compiled from: ViewPropertyAnimatorCompat.java */
    static class c implements u {

        /* JADX INFO: renamed from: a, reason: collision with root package name */
        t f259a;

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

        c(t tVar) {
            this.f259a = tVar;
        }

        @Override // a.b.c.g.u
        public void a(View view) {
            int i = this.f259a.f254d;
            if (i > -1) {
                view.setLayerType(i, null);
                this.f259a.f254d = -1;
            }
            if (Build.VERSION.SDK_INT >= 16 || !this.f260b) {
                t tVar = this.f259a;
                Runnable runnable = tVar.f253c;
                if (runnable != null) {
                    tVar.f253c = null;
                    runnable.run();
                }
                Object tag = view.getTag(2113929216);
                u uVar = tag instanceof u ? (u) tag : null;
                if (uVar != null) {
                    uVar.a(view);
                }
                this.f260b = true;
            }
        }

        @Override // a.b.c.g.u
        public void b(View view) {
            this.f260b = false;
            if (this.f259a.f254d > -1) {
                view.setLayerType(2, null);
            }
            t tVar = this.f259a;
            Runnable runnable = tVar.f252b;
            if (runnable != null) {
                tVar.f252b = null;
                runnable.run();
            }
            Object tag = view.getTag(2113929216);
            u uVar = tag instanceof u ? (u) tag : null;
            if (uVar != null) {
                uVar.b(view);
            }
        }

        @Override // a.b.c.g.u
        public void c(View view) {
            Object tag = view.getTag(2113929216);
            u uVar = tag instanceof u ? (u) tag : null;
            if (uVar != null) {
                uVar.c(view);
            }
        }
    }

    t(View view) {
        this.f251a = new WeakReference<>(view);
    }

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

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

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

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

    public t d(long j) {
        View view = this.f251a.get();
        if (view != null) {
            view.animate().setDuration(j);
        }
        return this;
    }

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

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

    public t h(long j) {
        View view = this.f251a.get();
        if (view != null) {
            view.animate().setStartDelay(j);
        }
        return this;
    }

    public t i(w wVar) {
        View view = this.f251a.get();
        if (view != null && Build.VERSION.SDK_INT >= 19) {
            view.animate().setUpdateListener(wVar != null ? new b(this, wVar, view) : null);
        }
        return this;
    }

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

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