package com.scwang.smartrefresh.header.fungame;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.text.TextPaint;
import android.util.AttributeSet;
import com.google.android.material.behavior.HideBottomViewOnScrollBehavior;
import com.scwang.smartrefresh.header.R$styleable;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1396;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1401;
import ඓ.㿎.K.ῲ.䀟.C1436;
import ῲ.ᨨ.ʬ.C1718;

public abstract class FunGameView extends FunGameHeader {

    /* renamed from: ᆯ  reason: contains not printable characters */
    public int f3175;

    /* renamed from: ሽ  reason: contains not printable characters */
    public int f3176;

    /* renamed from: ᑓ  reason: contains not printable characters */
    public Paint f3177;

    /* renamed from: ᑾ  reason: contains not printable characters */
    public int f3178;

    /* renamed from: ᓆ  reason: contains not printable characters */
    public String f3179;

    /* renamed from: ᝁ  reason: contains not printable characters */
    public int f3180;

    /* renamed from: ⶍ  reason: contains not printable characters */
    public int f3181;

    /* renamed from: ゎ  reason: contains not printable characters */
    public TextPaint f3182;

    /* renamed from: ト  reason: contains not printable characters */
    public float f3183;

    /* renamed from: 㮔  reason: contains not printable characters */
    public int f3184;

    /* renamed from: 㴪  reason: contains not printable characters */
    public String f3185;

    /* renamed from: 㶋  reason: contains not printable characters */
    public String f3186;

    /* renamed from: 䃖  reason: contains not printable characters */
    public int f3187;

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

    public void dispatchDraw(Canvas canvas) {
        int width = getWidth();
        int i = this.f3154;
        this.f3177.setColor(this.f3176);
        float f = (float) width;
        float f2 = (float) i;
        canvas.drawRect(0.0f, 0.0f, f, f2, this.f3177);
        this.f3177.setColor(this.f3178);
        canvas.drawLine(0.0f, 0.0f, f, 0.0f, this.f3177);
        float f3 = f2 - this.f3169;
        canvas.drawLine(0.0f, f3, f, f3, this.f3177);
        int i2 = this.f3187;
        if (i2 == 0 || i2 == 1) {
            this.f3182.setTextSize((float) C1436.m3649(25.0f));
            m1797(canvas, this.f3179, width, i);
        } else if (i2 == 2) {
            this.f3182.setTextSize((float) C1436.m3649(25.0f));
            m1797(canvas, this.f3186, width, i);
        } else if (i2 == 3) {
            this.f3182.setTextSize((float) C1436.m3649(20.0f));
            m1797(canvas, this.f3185, width, i);
        }
        m1796(canvas, width, i);
        super.dispatchDraw(canvas);
    }

    public int getCurrStatus() {
        return this.f3187;
    }

    public String getTextGameOver() {
        return this.f3186;
    }

    public String getTextLoading() {
        return this.f3179;
    }

    public String getTextLoadingFinished() {
        return this.f3185;
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399, com.scwang.smartrefresh.header.fungame.FunGameBase, com.scwang.smartrefresh.header.fungame.FunGameHeader
    public void setPrimaryColors(int... iArr) {
        super.setPrimaryColors(iArr);
        if (iArr.length > 0) {
            int i = iArr[0];
            this.f3176 = i;
            this.f3178 = i;
            int i2 = this.f3176;
            if (i2 == 0 || i2 == -1) {
                this.f3178 = -10461088;
            }
            if (iArr.length > 1) {
                this.f3181 = iArr[1];
                this.f3180 = C1718.m4410(iArr[1], HideBottomViewOnScrollBehavior.ENTER_ANIMATION_DURATION);
                this.f3175 = C1718.m4410(iArr[1], 200);
                this.f3182.setColor(C1718.m4410(iArr[1], 150));
            }
        }
    }

    public void setTextGameOver(String str) {
        this.f3186 = str;
    }

    public void setTextLoading(String str) {
        this.f3179 = str;
    }

    public void setTextLoadingFinished(String str) {
        this.f3185 = str;
    }

    @Override // com.scwang.smartrefresh.header.fungame.FunGameHeader
    /* renamed from: ʬ  reason: contains not printable characters */
    public void m1790() {
        m1795(1);
    }

    /* renamed from: ᨨ  reason: contains not printable characters */
    public abstract void m1792();

    /* renamed from: ⁱ  reason: contains not printable characters */
    public void m1793() {
        this.f3182 = new TextPaint(1);
        this.f3182.setColor(Color.parseColor("#C1C2C2"));
        this.f3177 = new Paint(1);
        this.f3177.setStrokeWidth(this.f3169);
    }

    /* renamed from: K  reason: contains not printable characters */
    public abstract void m1796(Canvas canvas, int i, int i2);

    /* renamed from: K  reason: contains not printable characters */
    public final void m1797(Canvas canvas, String str, int i, int i2) {
        canvas.drawText(str, (((float) i) - this.f3182.measureText(str)) * 0.5f, (((float) i2) * 0.5f) - ((this.f3182.descent() + this.f3182.ascent()) * 0.5f), this.f3182);
    }

    /* renamed from: 㴹  reason: contains not printable characters */
    public void m1800() {
        this.f3183 = this.f3169;
    }

    /* renamed from: 㿎  reason: contains not printable characters */
    public abstract void m1801();

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

    @Override // com.scwang.smartrefresh.header.fungame.FunGameBase
    /* renamed from: ʬ  reason: contains not printable characters */
    public void m1791(float f, int i, int i2, int i3) {
        m1794((float) Math.max(i, 0));
    }

    public FunGameView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        this.f3186 = "游戏结束";
        this.f3179 = "玩个游戏解解闷";
        this.f3185 = "加载完成";
        this.f3187 = 0;
        this.f3178 = -10461088;
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.FunGameView);
        this.f3176 = obtainStyledAttributes.getColor(R$styleable.FunGameView_fgvBackColor, 0);
        this.f3180 = obtainStyledAttributes.getColor(R$styleable.FunGameView_fgvLeftColor, Color.rgb(0, 0, 0));
        this.f3181 = obtainStyledAttributes.getColor(R$styleable.FunGameView_fgvMiddleColor, -16777216);
        this.f3175 = obtainStyledAttributes.getColor(R$styleable.FunGameView_fgvRightColor, Color.parseColor("#A5A5A5"));
        if (obtainStyledAttributes.hasValue(R$styleable.FunGameView_fgvTextGameOver)) {
            this.f3186 = obtainStyledAttributes.getString(R$styleable.FunGameView_fgvTextGameOver);
        }
        if (obtainStyledAttributes.hasValue(R$styleable.FunGameView_fgvTextGameOver)) {
            this.f3179 = obtainStyledAttributes.getString(R$styleable.FunGameView_fgvTextLoading);
        }
        if (obtainStyledAttributes.hasValue(R$styleable.FunGameView_fgvTextGameOver)) {
            this.f3185 = obtainStyledAttributes.getString(R$styleable.FunGameView_fgvTextLoadingFinished);
        }
        obtainStyledAttributes.recycle();
        m1793();
        m1800();
        m1801();
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399, com.scwang.smartrefresh.header.fungame.FunGameBase, com.scwang.smartrefresh.header.fungame.FunGameHeader
    /* renamed from: K  reason: contains not printable characters */
    public void m1799(AbstractC1401 r1) {
        if (!this.f3155) {
            m1789();
        }
        if (this.f3155) {
            m1795(3);
        } else {
            m1795(0);
        }
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1794(float f) {
        float f2 = (((float) this.f3154) - (this.f3169 * 2.0f)) - ((float) this.f3184);
        if (f > f2) {
            f = f2;
        }
        this.f3183 = f;
        postInvalidate();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1795(int i) {
        this.f3187 = i;
        if (i == 0) {
            m1792();
        }
        postInvalidate();
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399, com.scwang.smartrefresh.header.fungame.FunGameBase, com.scwang.smartrefresh.header.fungame.FunGameHeader
    /* renamed from: K  reason: contains not printable characters */
    public void m1798(AbstractC1396 r1, int i, int i2) {
        super.m1786(r1, i, i2);
        m1801();
        m1795(0);
    }
}
