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: c, reason: collision with root package name */
    private Paint f2468c;

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

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

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

    /* JADX INFO: renamed from: g, reason: collision with root package name */
    private float[] f2472g;
    private int h;
    private int i;
    private int j;
    private float[] k;

    public LoadingAnimatorView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f2469d = 5;
        this.f2470e = 14;
        this.f2471f = 8;
        this.h = 48;
        this.i = 68;
        this.j = 0;
        this.k = 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 i) {
        float[] fArr = this.k;
        int length = fArr.length;
        return fArr[((this.j + length) - (i * 5)) % length];
    }

    private void b() {
        setLayerType(1, null);
        Paint paint = new Paint();
        this.f2468c = paint;
        paint.setColor(-1);
        this.f2468c.setStyle(Paint.Style.FILL);
        this.f2468c.setAntiAlias(true);
        this.f2472g = new float[this.f2469d];
        int i = this.f2471f * 2;
        for (int i2 = 0; i2 < this.f2469d; i2++) {
            this.f2472g[i2] = (float) (((double) (this.f2470e * i2)) + ((((double) i2) + 0.5d) * ((double) i)));
        }
    }

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

    @Override // android.view.View
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        for (int i = 0; i < this.f2469d; i++) {
            canvas.drawCircle(this.f2472g[i], this.h + a(i), this.f2471f, this.f2468c);
        }
    }

    @Override // android.view.View
    protected void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        setMeasuredDimension(((int) this.f2472g[this.f2469d - 1]) + this.f2471f, this.i);
    }

    public void setColor(int i) {
        this.f2468c.setColor(i);
    }

    public void setFrame(int i) {
        this.j = i;
        invalidate();
    }
}
