package com.seewo.libvui;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/* JADX INFO: loaded from: classes.dex */
public class LoadingAnimatorView extends View {

    /* JADX INFO: renamed from: a, reason: collision with root package name */
    private Paint f3348a;

    /* JADX INFO: renamed from: b, reason: collision with root package name */
    private int f3349b;

    /* JADX INFO: renamed from: c, reason: collision with root package name */
    private int f3350c;

    /* JADX INFO: renamed from: d, reason: collision with root package name */
    private int f3351d;

    /* JADX INFO: renamed from: e, reason: collision with root package name */
    private float[] f3352e;

    /* JADX INFO: renamed from: f, reason: collision with root package name */
    private int f3353f;

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private int f3354g;

    /* JADX INFO: renamed from: h, reason: collision with root package name */
    private int f3355h;

    /* JADX INFO: renamed from: i, reason: collision with root package name */
    private float[] f3356i;

    public LoadingAnimatorView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f3349b = 5;
        this.f3350c = 14;
        this.f3351d = 8;
        this.f3353f = 48;
        this.f3354g = 68;
        this.f3355h = 0;
        this.f3356i = new float[]{0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.4f, -1.8f, -4.0f, -7.0f, -10.8f, -15.2f, -20.1f, -25.3f, -30.5f, -35.2f, -38.7f, -40.0f, -38.6f, -34.7f, -28.7f, -21.5f, -14.1f, -7.2f, -1.2f, 3.7f, 7.5f, 10.0f, 11.5f, 12.0f, 12.9f, 12.5f, 10.5f, 8.4f, 6.5f, 4.8f, 3.4f, 2.2f, 1.2f, 0.5f, 0.1f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
        b();
    }

    private float a(int i2) {
        float[] fArr = this.f3356i;
        int length = fArr.length;
        return fArr[((this.f3355h + length) - (i2 * 5)) % length];
    }

    private void b() {
        setLayerType(1, null);
        Paint paint = new Paint();
        this.f3348a = paint;
        paint.setColor(-1);
        this.f3348a.setStyle(Paint.Style.FILL);
        this.f3348a.setAntiAlias(true);
        this.f3352e = new float[this.f3349b];
        int i2 = this.f3351d * 2;
        for (int i3 = 0; i3 < this.f3349b; i3++) {
            this.f3352e[i3] = (float) (((double) (this.f3350c * i3)) + ((((double) i3) + 0.5d) * ((double) i2)));
        }
    }

    public int getFrame() {
        return this.f3355h;
    }

    @Override // android.view.View
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        for (int i2 = 0; i2 < this.f3349b; i2++) {
            canvas.drawCircle(this.f3352e[i2], this.f3353f + a(i2), this.f3351d, this.f3348a);
        }
    }

    @Override // android.view.View
    protected void onMeasure(int i2, int i3) {
        super.onMeasure(i2, i3);
        setMeasuredDimension(((int) this.f3352e[this.f3349b - 1]) + this.f3351d, this.f3354g);
    }

    public void setColor(int i2) {
        this.f3348a.setColor(i2);
    }

    public void setFrame(int i2) {
        this.f3355h = i2;
        invalidate();
    }
}
