package o;

import android.R;
import android.app.PendingIntent;
import android.content.res.ColorStateList;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.view.View;
import android.view.animation.AnimationUtils;

/* compiled from: r8-map-id-3b7cc9102578c509342fa2f0fabed2bfc72239cd258d579fc679bfcbc198b048 */
/* renamed from: o.a30, reason: case insensitive filesystem */
/* loaded from: classes.dex */
public final class C0683a30 extends View {
    public static final int[] q = {R.attr.state_pressed, R.attr.state_enabled};
    public static final int[] r = new int[0];
    public Vh0 l;
    public Boolean m;
    public Long n;

    /* renamed from: o, reason: collision with root package name */
    public RunnableC2108p1 f445o;
    public C1164f5 p;

    private final void setRippleState(boolean z) {
        long jCurrentAnimationTimeMillis = AnimationUtils.currentAnimationTimeMillis();
        Runnable runnable = this.f445o;
        if (runnable != null) {
            removeCallbacks(runnable);
            runnable.run();
        }
        Long l = this.n;
        long jLongValue = jCurrentAnimationTimeMillis - (l != null ? l.longValue() : 0L);
        if (z || jLongValue >= 5) {
            int[] iArr = z ? q : r;
            Vh0 vh0 = this.l;
            if (vh0 != null) {
                vh0.setState(iArr);
            }
        } else {
            RunnableC2108p1 runnableC2108p1 = new RunnableC2108p1(18, this);
            this.f445o = runnableC2108p1;
            postDelayed(runnableC2108p1, 50L);
        }
        this.n = Long.valueOf(jCurrentAnimationTimeMillis);
    }

    /* JADX INFO: Access modifiers changed from: private */
    public static final void setRippleState$lambda$2(C0683a30 c0683a30) {
        Vh0 vh0 = c0683a30.l;
        if (vh0 != null) {
            vh0.setState(r);
        }
        c0683a30.f445o = null;
    }

    public final void b(AY ay, boolean z, long j, int i, long j2, C1164f5 c1164f5) {
        if (this.l == null || !Boolean.valueOf(z).equals(this.m)) {
            Vh0 vh0 = new Vh0(z);
            setBackground(vh0);
            this.l = vh0;
            this.m = Boolean.valueOf(z);
        }
        Vh0 vh02 = this.l;
        this.p = c1164f5;
        e(i, j, j2);
        if (z) {
            vh02.setHotspot(Float.intBitsToFloat((int) (ay.a >> 32)), Float.intBitsToFloat((int) (ay.a & 4294967295L)));
        } else {
            vh02.setHotspot(vh02.getBounds().centerX(), vh02.getBounds().centerY());
        }
        setRippleState(true);
    }

    public final void c() {
        this.p = null;
        RunnableC2108p1 runnableC2108p1 = this.f445o;
        if (runnableC2108p1 != null) {
            removeCallbacks(runnableC2108p1);
            this.f445o.run();
        } else {
            Vh0 vh0 = this.l;
            if (vh0 != null) {
                vh0.setState(r);
            }
        }
        Vh0 vh02 = this.l;
        if (vh02 == null) {
            return;
        }
        vh02.setVisible(false, false);
        unscheduleDrawable(vh02);
    }

    public final void d() {
        setRippleState(false);
    }

    @Override // android.view.View
    public final void draw(Canvas canvas) {
        if (isAttachedToWindow()) {
            super.draw(canvas);
        } else {
            c();
        }
    }

    public final void e(int i, long j, long j2) {
        Vh0 vh0 = this.l;
        if (vh0 == null) {
            return;
        }
        Integer num = vh0.n;
        if (num == null || num.intValue() != i) {
            vh0.n = Integer.valueOf(i);
            vh0.setRadius(i);
        }
        float f = Build.VERSION.SDK_INT < 28 ? 0.1f * 2 : 0.1f;
        if (f > 1.0f) {
            f = 1.0f;
        }
        long jB = C0190Hi.b(f, j2);
        C0190Hi c0190Hi = vh0.m;
        if (!(c0190Hi == null ? false : C0190Hi.c(c0190Hi.a, jB))) {
            vh0.m = new C0190Hi(jB);
            vh0.setColor(ColorStateList.valueOf(AbstractC0752ap.g0(jB)));
        }
        Rect rect = new Rect(0, 0, C2887xC.D(T80.d(j)), C2887xC.D(T80.b(j)));
        setLeft(rect.left);
        setTop(rect.top);
        setRight(rect.right);
        setBottom(rect.bottom);
        vh0.setBounds(rect);
    }

    @Override // android.view.View, android.graphics.drawable.Drawable.Callback
    public final void invalidateDrawable(Drawable drawable) throws PendingIntent.CanceledException {
        C1164f5 c1164f5 = this.p;
        if (c1164f5 != null) {
            c1164f5.a();
        }
    }

    @Override // android.view.View
    public final void onMeasure(int i, int i2) {
        setMeasuredDimension(0, 0);
    }

    @Override // android.view.View
    public final void refreshDrawableState() {
    }

    @Override // android.view.View
    public final void onLayout(boolean z, int i, int i2, int i3, int i4) {
    }
}
