package com.scwang.smartrefresh.layout.footer.ballpulse;

import android.animation.ValueAnimator;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import ඓ.㿎.K.ῲ.㗗.ῲ.C1426;
import ඓ.㿎.K.ῲ.䀟.C1436;

public class BallPulseView extends View {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f3287;

    /* renamed from: ඓ  reason: contains not printable characters */
    public float f3288;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public Map<ValueAnimator, ValueAnimator.AnimatorUpdateListener> f3289;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Paint f3290;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public boolean f3291;

    /* renamed from: 㴹  reason: contains not printable characters */
    public float[] f3292;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f3293;

    /* renamed from: 㿎  reason: contains not printable characters */
    public ArrayList<ValueAnimator> f3294;

    public BallPulseView(Context context) {
        this(context, null);
    }

    public void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (this.f3294 != null) {
            for (int i = 0; i < this.f3294.size(); i++) {
                this.f3294.get(i).cancel();
            }
        }
    }

    public void onDraw(Canvas canvas) {
        float min = (((float) Math.min(getWidth(), getHeight())) - (this.f3288 * 2.0f)) / 6.0f;
        float f = 2.0f * min;
        float width = ((float) (getWidth() / 2)) - (this.f3288 + f);
        float height = (float) (getHeight() / 2);
        for (int i = 0; i < 3; i++) {
            canvas.save();
            float f2 = (float) i;
            canvas.translate((this.f3288 * f2) + (f * f2) + width, height);
            float[] fArr = this.f3292;
            canvas.scale(fArr[i], fArr[i]);
            canvas.drawCircle(0.0f, 0.0f, min, this.f3290);
            canvas.restore();
        }
    }

    public void onMeasure(int i, int i2) {
        int r0 = C1436.m3649(50.0f);
        setMeasuredDimension(View.resolveSize(r0, i), View.resolveSize(r0, i2));
    }

    public void setAnimatingColor(int i) {
        this.f3293 = i;
    }

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

    public void setNormalColor(int i) {
        this.f3287 = i;
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m1870() {
        ArrayList<ValueAnimator> arrayList = this.f3294;
        if (arrayList != null && this.f3291) {
            this.f3291 = false;
            Iterator<ValueAnimator> it2 = arrayList.iterator();
            while (it2.hasNext()) {
                ValueAnimator next = it2.next();
                if (next != null) {
                    next.removeAllUpdateListeners();
                    next.end();
                }
            }
            this.f3292 = new float[]{1.0f, 1.0f, 1.0f};
        }
        setIndicatorColor(this.f3287);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1871() {
        if (this.f3294 == null) {
            this.f3294 = new ArrayList<>();
            int[] iArr = {120, 240, 360};
            for (int i = 0; i < 3; i++) {
                ValueAnimator ofFloat = ValueAnimator.ofFloat(1.0f, 0.3f, 1.0f);
                ofFloat.setDuration(750L);
                ofFloat.setRepeatCount(-1);
                ofFloat.setStartDelay((long) iArr[i]);
                this.f3289.put(ofFloat, new C1426(this, i));
                this.f3294.add(ofFloat);
            }
        }
        if (this.f3294 != null && !this.f3291) {
            for (int i2 = 0; i2 < this.f3294.size(); i2++) {
                ValueAnimator valueAnimator = this.f3294.get(i2);
                ValueAnimator.AnimatorUpdateListener animatorUpdateListener = this.f3289.get(valueAnimator);
                if (animatorUpdateListener != null) {
                    valueAnimator.addUpdateListener(animatorUpdateListener);
                }
                valueAnimator.start();
            }
            this.f3291 = true;
            setIndicatorColor(this.f3293);
        }
    }

    public BallPulseView(Context context, AttributeSet attributeSet) {
        this(context, attributeSet, 0);
    }

    public BallPulseView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f3287 = -1118482;
        this.f3293 = -1615546;
        this.f3292 = new float[]{1.0f, 1.0f, 1.0f};
        this.f3291 = false;
        this.f3289 = new HashMap();
        this.f3288 = (float) C1436.m3649(4.0f);
        this.f3290 = new Paint();
        this.f3290.setColor(-1);
        this.f3290.setStyle(Paint.Style.FILL);
        this.f3290.setAntiAlias(true);
    }
}
