package com.scwang.smartrefresh.header;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Point;
import android.util.AttributeSet;
import com.google.android.material.progressindicator.BaseProgressIndicator;
import com.scwang.smartrefresh.header.fungame.FunGameView;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import ඓ.㿎.K.ῲ.䀟.C1436;
import ῲ.ᨨ.ʬ.C1718;

public class FunGameHitBlockHeader extends FunGameView {

    /* renamed from: В  reason: contains not printable characters */
    public float f3027;

    /* renamed from: ѷ  reason: contains not printable characters */
    public float f3028;

    /* renamed from: ࠋ  reason: contains not printable characters */
    public boolean f3029;

    /* renamed from: ಯ  reason: contains not printable characters */
    public float f3030;

    /* renamed from: ผ  reason: contains not printable characters */
    public int f3031;

    /* renamed from: ጒ  reason: contains not printable characters */
    public Paint f3032;

    /* renamed from: ᶲ  reason: contains not printable characters */
    public List<Point> f3033;

    /* renamed from: ピ  reason: contains not printable characters */
    public int f3034;

    /* renamed from: 㒁  reason: contains not printable characters */
    public float f3035;

    /* renamed from: 㮝  reason: contains not printable characters */
    public float f3036;

    /* renamed from: 㱶  reason: contains not printable characters */
    public int f3037;

    /* renamed from: 㷛  reason: contains not printable characters */
    public float f3038;

    /* renamed from: 㹎  reason: contains not printable characters */
    public float f3039;

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

    @Override // com.scwang.smartrefresh.header.fungame.FunGameView
    /* renamed from: ᨨ  reason: contains not printable characters */
    public void m1707() {
        this.f3038 = this.f3035 - (this.f3030 * 3.0f);
        this.f3028 = (float) ((int) (((float) this.f3154) * 0.5f));
        this.f3183 = 1.0f;
        this.f3031 = 30;
        this.f3029 = true;
        List<Point> list = this.f3033;
        if (list == null) {
            this.f3033 = new ArrayList();
        } else {
            list.clear();
        }
    }

    @Override // com.scwang.smartrefresh.header.fungame.FunGameView
    /* renamed from: K  reason: contains not printable characters */
    public void m1708(Canvas canvas, int i, int i2) {
        boolean z;
        boolean z2 = false;
        int i3 = 0;
        while (true) {
            int i4 = this.f3037;
            boolean z3 = true;
            if (i3 >= i4 * 5) {
                break;
            }
            int i5 = i3 / i4;
            int i6 = i3 % i4;
            Iterator<Point> it2 = this.f3033.iterator();
            while (true) {
                if (it2.hasNext()) {
                    if (it2.next().equals(i6, i5)) {
                        break;
                    }
                } else {
                    z3 = false;
                    break;
                }
            }
            if (!z3) {
                this.f3032.setColor(C1718.m4410(this.f3180, BaseProgressIndicator.MAX_ALPHA / (i6 + 1)));
                float f = this.f3039;
                float f2 = this.f3036;
                float f3 = ((f2 + 1.0f) * ((float) i6)) + f;
                float f4 = (float) i5;
                float f5 = this.f3027;
                float f6 = ((f5 + 1.0f) * f4) + 1.0f;
                canvas.drawRect(f3, f6, f3 + f2, f6 + f5, this.f3032);
            }
            i3++;
        }
        this.f3177.setColor(this.f3175);
        float f7 = this.f3035;
        float f8 = this.f3183;
        canvas.drawRect(f7, f8, f7 + this.f3036, f8 + ((float) this.f3184), this.f3177);
        int i7 = this.f3187;
        if (i7 == 1 || i7 == 3 || isInEditMode()) {
            this.f3177.setColor(this.f3181);
            float f9 = this.f3038;
            float f10 = this.f3039;
            int i8 = this.f3037;
            float f11 = this.f3036;
            float f12 = (((float) (i8 - 1)) * 1.0f) + (((float) i8) * f11) + f10;
            float f13 = this.f3030;
            if (f9 <= f12 + f13) {
                float f14 = this.f3028;
                int i9 = (int) ((((f9 - f10) - f13) - ((float) this.f3034)) / f11);
                if (i9 == i8) {
                    i9--;
                }
                int i10 = (int) (f14 / this.f3027);
                if (i10 == 5) {
                    i10--;
                }
                Point point = new Point();
                point.set(i9, i10);
                Iterator<Point> it3 = this.f3033.iterator();
                while (true) {
                    if (it3.hasNext()) {
                        if (it3.next().equals(point.x, point.y)) {
                            z = true;
                            break;
                        }
                    } else {
                        z = false;
                        break;
                    }
                }
                if (!z) {
                    this.f3033.add(point);
                }
                if (!z) {
                    this.f3029 = false;
                }
            }
            if (this.f3038 <= this.f3039 + this.f3030) {
                this.f3029 = false;
            }
            float f15 = this.f3038;
            float f16 = this.f3030;
            float f17 = this.f3035;
            if (f15 + f16 >= f17 && f15 - f16 < f17 + this.f3036) {
                float f18 = this.f3028 - this.f3183;
                if (f18 >= 0.0f && f18 <= ((float) this.f3184)) {
                    z2 = true;
                }
                if (z2) {
                    if (this.f3033.size() == this.f3037 * 5) {
                        this.f3187 = 2;
                        return;
                    }
                    this.f3029 = true;
                }
            } else if (this.f3038 > ((float) i)) {
                this.f3187 = 2;
            }
            float f19 = this.f3028;
            float f20 = this.f3030;
            if (f19 <= f20 + 1.0f) {
                this.f3031 = 150;
            } else if (f19 >= (((float) this.f3154) - f20) - 1.0f) {
                this.f3031 = 210;
            }
            if (this.f3029) {
                this.f3038 -= (float) this.f3034;
            } else {
                this.f3038 += (float) this.f3034;
            }
            this.f3028 -= ((float) Math.tan(Math.toRadians((double) this.f3031))) * ((float) this.f3034);
            canvas.drawCircle(this.f3038, this.f3028, this.f3030, this.f3177);
            invalidate();
        }
    }

    @Override // com.scwang.smartrefresh.header.fungame.FunGameView
    /* renamed from: 㿎  reason: contains not printable characters */
    public void m1709() {
        int measuredWidth = getMeasuredWidth();
        this.f3184 = (int) (this.f3027 * 1.6f);
        this.f3027 = ((float) (this.f3154 / 5)) - 1.0f;
        float f = (float) measuredWidth;
        this.f3036 = 0.01806f * f;
        this.f3039 = 0.08f * f;
        this.f3035 = f * 0.8f;
        this.f3184 = (int) (this.f3027 * 1.6f);
    }

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

    public FunGameHitBlockHeader(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.FunGameHitBlockHeader);
        this.f3037 = obtainStyledAttributes.getInt(R$styleable.FunGameHitBlockHeader_fgvBlockHorizontalNum, 3);
        this.f3034 = obtainStyledAttributes.getInt(R$styleable.FunGameHitBlockHeader_fgvBallSpeed, C1436.m3649(3.0f));
        obtainStyledAttributes.recycle();
        this.f3032 = new Paint(1);
        this.f3032.setStyle(Paint.Style.FILL);
        this.f3030 = (float) C1436.m3649(4.0f);
    }
}
