package androidx.leanback.widget;

import android.animation.TimeAnimator;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.view.View;
import android.view.animation.AccelerateDecelerateInterpolator;
import com.martsnew.tv.R;
import l0.C1119a;

/* JADX INFO: renamed from: androidx.leanback.widget.o, reason: case insensitive filesystem */
/* JADX INFO: loaded from: classes.dex */
public class C0481o implements TimeAnimator.TimeListener {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    public final View f8675a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    public final int f8676b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    public final y0 f8677c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    public final float f8678d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    public float f8679e = 0.0f;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    public float f8680f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    public float f8681g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    public final TimeAnimator f8682h;
    public final AccelerateDecelerateInterpolator i;

    /* JADX INFO: renamed from: j, reason: collision with root package name */
    public final C1119a f8683j;

    public C0481o(View view, float f3, int i) {
        TimeAnimator timeAnimator = new TimeAnimator();
        this.f8682h = timeAnimator;
        this.i = new AccelerateDecelerateInterpolator();
        this.f8675a = view;
        this.f8676b = i;
        this.f8678d = f3 - 1.0f;
        if (view instanceof y0) {
            this.f8677c = (y0) view;
        } else {
            this.f8677c = null;
        }
        timeAnimator.setTimeListener(this);
        this.f8683j = null;
    }

    public final void a(boolean z8, boolean z9) {
        TimeAnimator timeAnimator = this.f8682h;
        timeAnimator.end();
        float f3 = z8 ? 1.0f : 0.0f;
        if (z9) {
            b(f3);
            return;
        }
        float f7 = this.f8679e;
        if (f7 != f3) {
            this.f8680f = f7;
            this.f8681g = f3 - f7;
            timeAnimator.start();
        }
    }

    public void b(float f3) {
        this.f8679e = f3;
        float f7 = (this.f8678d * f3) + 1.0f;
        View view = this.f8675a;
        view.setScaleX(f7);
        view.setScaleY(f7);
        y0 y0Var = this.f8677c;
        if (y0Var != null) {
            y0Var.setShadowFocusLevel(f3);
        } else {
            B0.b(view.getTag(R.id.lb_shadow_impl), 3, f3);
        }
        C1119a c1119a = this.f8683j;
        if (c1119a != null) {
            c1119a.a(f3);
            int color = c1119a.f14254c.getColor();
            if (y0Var != null) {
                y0Var.setOverlayColor(color);
                return;
            }
            Drawable foreground = view.getForeground();
            if (foreground instanceof ColorDrawable) {
                ((ColorDrawable) foreground).setColor(color);
            } else {
                view.setForeground(new ColorDrawable(color));
            }
        }
    }

    @Override // android.animation.TimeAnimator.TimeListener
    public final void onTimeUpdate(TimeAnimator timeAnimator, long j8, long j9) {
        float interpolation;
        int i = this.f8676b;
        if (j8 >= i) {
            this.f8682h.end();
            interpolation = 1.0f;
        } else {
            interpolation = (float) (j8 / ((double) i));
        }
        AccelerateDecelerateInterpolator accelerateDecelerateInterpolator = this.i;
        if (accelerateDecelerateInterpolator != null) {
            interpolation = accelerateDecelerateInterpolator.getInterpolation(interpolation);
        }
        b((interpolation * this.f8681g) + this.f8680f);
    }
}
