package com.scwang.smartrefresh.header.flyrefresh;

import IMuAHx_6.Mqv2r_3.KQgRr5e_0.KQgRr5e_0.QxJ9d_1;
import X6FRs_4.IMuAHx_6.IFxWkV_5.KQgRr5e_0;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.RectF;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Interpolator;
/* loaded from: classes.dex */
public class MountainSceneView extends View {

    /* renamed from: FSaI4_7  reason: collision with root package name */
    public int f3654FSaI4_7;

    /* renamed from: IFxWkV_5  reason: collision with root package name */
    public int f3655IFxWkV_5;

    /* renamed from: IMuAHx_6  reason: collision with root package name */
    public int f3656IMuAHx_6;
    public float KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public int f2800KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Matrix f2801KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Paint f2802KQgRr5e_0;

    /* renamed from: KQgRr5e_0  reason: collision with other field name */
    public Path f2803KQgRr5e_0;

    /* renamed from: Mqv2r_3  reason: collision with root package name */
    public float f3657Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public int f2804Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public Paint f2805Mqv2r_3;

    /* renamed from: Mqv2r_3  reason: collision with other field name */
    public Path f2806Mqv2r_3;

    /* renamed from: Nm6q_10  reason: collision with root package name */
    public int f3658Nm6q_10;
    public float PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public int f2807PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Paint f2808PGPF6hQ_2;

    /* renamed from: PGPF6hQ_2  reason: collision with other field name */
    public Path f2809PGPF6hQ_2;
    public float QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public int f2810QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Paint f2811QxJ9d_1;

    /* renamed from: QxJ9d_1  reason: collision with other field name */
    public Path f2812QxJ9d_1;

    /* renamed from: X6FRs_4  reason: collision with root package name */
    public float f3659X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public int f2813X6FRs_4;

    /* renamed from: X6FRs_4  reason: collision with other field name */
    public Path f2814X6FRs_4;

    /* renamed from: Xgtqvk_8  reason: collision with root package name */
    public int f3660Xgtqvk_8;

    /* renamed from: XnFJ5_9  reason: collision with root package name */
    public int f3661XnFJ5_9;

    public MountainSceneView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        this.f2800KQgRr5e_0 = -8466743;
        this.f2810QxJ9d_1 = -7939369;
        this.f2807PGPF6hQ_2 = -12807524;
        this.f2804Mqv2r_3 = -12689549;
        this.f2813X6FRs_4 = -14716553;
        this.f3655IFxWkV_5 = -15974840;
        this.f3656IMuAHx_6 = -13334385;
        this.f3654FSaI4_7 = -14982807;
        this.f3660Xgtqvk_8 = -11030098;
        this.f3661XnFJ5_9 = -10312531;
        this.f2802KQgRr5e_0 = new Paint();
        this.f2811QxJ9d_1 = new Paint();
        this.f2808PGPF6hQ_2 = new Paint();
        this.f2805Mqv2r_3 = new Paint();
        this.f2803KQgRr5e_0 = new Path();
        this.f2812QxJ9d_1 = new Path();
        this.f2809PGPF6hQ_2 = new Path();
        this.f2806Mqv2r_3 = new Path();
        this.f2814X6FRs_4 = new Path();
        this.f2801KQgRr5e_0 = new Matrix();
        this.KQgRr5e_0 = 5.0f;
        this.QxJ9d_1 = 5.0f;
        this.PGPF6hQ_2 = 0.0f;
        this.f3657Mqv2r_3 = 1.0f;
        this.f3659X6FRs_4 = Float.MAX_VALUE;
        this.f3658Nm6q_10 = 0;
        this.f2802KQgRr5e_0.setAntiAlias(true);
        this.f2802KQgRr5e_0.setStyle(Paint.Style.FILL);
        this.f2811QxJ9d_1.setAntiAlias(true);
        this.f2808PGPF6hQ_2.setAntiAlias(true);
        this.f2805Mqv2r_3.setAntiAlias(true);
        this.f2805Mqv2r_3.setStyle(Paint.Style.STROKE);
        this.f2805Mqv2r_3.setStrokeWidth(2.0f);
        this.f2805Mqv2r_3.setStrokeJoin(Paint.Join.ROUND);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, QxJ9d_1.MountainSceneView);
        if (obtainStyledAttributes.hasValue(QxJ9d_1.MountainSceneView_msvPrimaryColor)) {
            setPrimaryColor(obtainStyledAttributes.getColor(QxJ9d_1.MountainSceneView_msvPrimaryColor, -16777216));
        }
        this.f3658Nm6q_10 = obtainStyledAttributes.getDimensionPixelOffset(QxJ9d_1.MountainSceneView_msvViewportHeight, 0);
        obtainStyledAttributes.recycle();
        KQgRr5e_0(this.PGPF6hQ_2, 180);
        KQgRr5e_0(this.PGPF6hQ_2, true);
    }

    public final void KQgRr5e_0(float f, int i) {
        this.f2801KQgRr5e_0.reset();
        this.f2801KQgRr5e_0.setScale(this.KQgRr5e_0, this.QxJ9d_1);
        float f2 = 10.0f * f;
        this.f2803KQgRr5e_0.reset();
        this.f2803KQgRr5e_0.moveTo(0.0f, 95.0f + f2);
        this.f2803KQgRr5e_0.lineTo(55.0f, 74.0f + f2);
        this.f2803KQgRr5e_0.lineTo(146.0f, f2 + 104.0f);
        this.f2803KQgRr5e_0.lineTo(227.0f, 72.0f + f2);
        this.f2803KQgRr5e_0.lineTo(240.0f, f2 + 80.0f);
        this.f2803KQgRr5e_0.lineTo(240.0f, 180.0f);
        this.f2803KQgRr5e_0.lineTo(0.0f, 180.0f);
        this.f2803KQgRr5e_0.close();
        this.f2803KQgRr5e_0.transform(this.f2801KQgRr5e_0);
        float f3 = 20.0f * f;
        this.f2812QxJ9d_1.reset();
        this.f2812QxJ9d_1.moveTo(0.0f, 103.0f + f3);
        this.f2812QxJ9d_1.lineTo(67.0f, 90.0f + f3);
        this.f2812QxJ9d_1.lineTo(165.0f, 115.0f + f3);
        this.f2812QxJ9d_1.lineTo(221.0f, 87.0f + f3);
        this.f2812QxJ9d_1.lineTo(240.0f, f3 + 100.0f);
        this.f2812QxJ9d_1.lineTo(240.0f, 180.0f);
        this.f2812QxJ9d_1.lineTo(0.0f, 180.0f);
        this.f2812QxJ9d_1.close();
        this.f2812QxJ9d_1.transform(this.f2801KQgRr5e_0);
        float f4 = f * 30.0f;
        this.f2809PGPF6hQ_2.reset();
        this.f2809PGPF6hQ_2.moveTo(0.0f, 114.0f + f4);
        this.f2809PGPF6hQ_2.cubicTo(30.0f, f4 + 106.0f, 196.0f, f4 + 97.0f, 240.0f, f4 + 104.0f);
        float f5 = i;
        this.f2809PGPF6hQ_2.lineTo(240.0f, f5 / this.QxJ9d_1);
        this.f2809PGPF6hQ_2.lineTo(0.0f, f5 / this.QxJ9d_1);
        this.f2809PGPF6hQ_2.close();
        this.f2809PGPF6hQ_2.transform(this.f2801KQgRr5e_0);
    }

    @Override // android.view.View
    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(this.f2800KQgRr5e_0);
        this.f2802KQgRr5e_0.setColor(this.f2810QxJ9d_1);
        canvas.drawPath(this.f2803KQgRr5e_0, this.f2802KQgRr5e_0);
        canvas.save();
        canvas.scale(-1.0f, 1.0f, getWidth() / 2.0f, 0.0f);
        float f = this.KQgRr5e_0;
        KQgRr5e_0(canvas, f * 0.12f, f * 180.0f, ((this.PGPF6hQ_2 * 20.0f) + 93.0f) * this.QxJ9d_1, this.f3661XnFJ5_9, this.f3660Xgtqvk_8);
        float f2 = this.KQgRr5e_0;
        KQgRr5e_0(canvas, f2 * 0.1f, f2 * 200.0f, ((this.PGPF6hQ_2 * 20.0f) + 96.0f) * this.QxJ9d_1, this.f3661XnFJ5_9, this.f3660Xgtqvk_8);
        canvas.restore();
        this.f2802KQgRr5e_0.setColor(this.f2807PGPF6hQ_2);
        canvas.drawPath(this.f2812QxJ9d_1, this.f2802KQgRr5e_0);
        float f3 = this.KQgRr5e_0;
        KQgRr5e_0(canvas, f3 * 0.2f, f3 * 160.0f, ((this.PGPF6hQ_2 * 30.0f) + 105.0f) * this.QxJ9d_1, this.f3655IFxWkV_5, this.f2813X6FRs_4);
        float f4 = this.KQgRr5e_0;
        KQgRr5e_0(canvas, f4 * 0.14f, f4 * 180.0f, ((this.PGPF6hQ_2 * 30.0f) + 105.0f) * this.QxJ9d_1, this.f3654FSaI4_7, this.f3656IMuAHx_6);
        float f5 = this.KQgRr5e_0;
        KQgRr5e_0(canvas, f5 * 0.16f, f5 * 140.0f, ((this.PGPF6hQ_2 * 30.0f) + 105.0f) * this.QxJ9d_1, this.f3654FSaI4_7, this.f3656IMuAHx_6);
        this.f2802KQgRr5e_0.setColor(this.f2804Mqv2r_3);
        canvas.drawPath(this.f2809PGPF6hQ_2, this.f2802KQgRr5e_0);
    }

    @Override // android.view.View
    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        int measuredWidth = getMeasuredWidth();
        int measuredHeight = getMeasuredHeight();
        this.KQgRr5e_0 = (measuredWidth * 1.0f) / 240.0f;
        int i3 = this.f3658Nm6q_10;
        if (i3 <= 0) {
            i3 = measuredHeight;
        }
        this.QxJ9d_1 = (i3 * 1.0f) / 180.0f;
        KQgRr5e_0(this.PGPF6hQ_2, measuredHeight);
        KQgRr5e_0(this.PGPF6hQ_2, true);
    }

    public void setPrimaryColor(int i) {
        this.f2800KQgRr5e_0 = i;
        this.f2810QxJ9d_1 = KQgRr5e_0.QxJ9d_1(-1711276033, i);
        this.f2807PGPF6hQ_2 = KQgRr5e_0.QxJ9d_1(-1724083556, i);
        this.f2804Mqv2r_3 = KQgRr5e_0.QxJ9d_1(-868327565, i);
        this.f2813X6FRs_4 = KQgRr5e_0.QxJ9d_1(1428124023, i);
        this.f3655IFxWkV_5 = KQgRr5e_0.QxJ9d_1(-871612856, i);
        this.f3656IMuAHx_6 = KQgRr5e_0.QxJ9d_1(1429506191, i);
        this.f3654FSaI4_7 = KQgRr5e_0.QxJ9d_1(-870620823, i);
        this.f3660Xgtqvk_8 = KQgRr5e_0.QxJ9d_1(1431810478, i);
        this.f3661XnFJ5_9 = KQgRr5e_0.QxJ9d_1(-865950547, i);
    }

    public final void KQgRr5e_0(float f, boolean z) {
        int i;
        if (f != this.f3659X6FRs_4 || z) {
            Interpolator KQgRr5e_0 = X6FRs_4.IMuAHx_6.EuDEkJe_12.EANXC_30.QxJ9d_1.KQgRr5e_0(0.8f, (-0.5f) * f);
            float f2 = f * 30.000002f;
            float[] fArr = new float[26];
            float[] fArr2 = new float[26];
            int i2 = 0;
            float f3 = 0.0f;
            float f4 = 200.0f;
            while (true) {
                if (i2 > 25) {
                    break;
                }
                fArr[i2] = (KQgRr5e_0.getInterpolation(f3) * f2) + 50.0f;
                fArr2[i2] = f4;
                f4 -= 8.0f;
                f3 += 0.04f;
                i2++;
            }
            this.f2806Mqv2r_3.reset();
            this.f2806Mqv2r_3.moveTo(45.0f, 200.0f);
            int i3 = (int) (17 * 0.5f);
            float f5 = 17 - i3;
            for (int i4 = 0; i4 < 17; i4++) {
                if (i4 < i3) {
                    this.f2806Mqv2r_3.lineTo(fArr[i4] - 5.0f, fArr2[i4]);
                } else {
                    this.f2806Mqv2r_3.lineTo(fArr[i4] - (((17 - i4) * 5.0f) / f5), fArr2[i4]);
                }
            }
            for (int i5 = 16; i5 >= 0; i5--) {
                if (i5 < i3) {
                    this.f2806Mqv2r_3.lineTo(fArr[i5] + 5.0f, fArr2[i5]);
                } else {
                    this.f2806Mqv2r_3.lineTo(fArr[i5] + (((17 - i5) * 5.0f) / f5), fArr2[i5]);
                }
            }
            this.f2806Mqv2r_3.close();
            this.f2814X6FRs_4.reset();
            float f6 = 15;
            this.f2814X6FRs_4.moveTo(fArr[10] - 20.0f, fArr2[10]);
            this.f2814X6FRs_4.addArc(new RectF(fArr[10] - 20.0f, fArr2[10] - 20.0f, fArr[10] + 20.0f, fArr2[10] + 20.0f), 0.0f, 180.0f);
            for (int i6 = 10; i6 <= 25; i6++) {
                float f7 = (i6 - 10) / f6;
                this.f2814X6FRs_4.lineTo((fArr[i6] - 20.0f) + (f7 * f7 * 20.0f), fArr2[i6]);
            }
            for (i = 25; i >= 10; i--) {
                float f8 = (i - 10) / f6;
                this.f2814X6FRs_4.lineTo((fArr[i] + 20.0f) - ((f8 * f8) * 20.0f), fArr2[i]);
            }
        }
    }

    public final void KQgRr5e_0(Canvas canvas, float f, float f2, float f3, int i, int i2) {
        canvas.save();
        canvas.translate(f2 - ((100.0f * f) / 2.0f), f3 - (200.0f * f));
        canvas.scale(f, f);
        this.f2808PGPF6hQ_2.setColor(i2);
        canvas.drawPath(this.f2814X6FRs_4, this.f2808PGPF6hQ_2);
        this.f2811QxJ9d_1.setColor(i);
        canvas.drawPath(this.f2806Mqv2r_3, this.f2811QxJ9d_1);
        this.f2805Mqv2r_3.setColor(i);
        canvas.drawPath(this.f2814X6FRs_4, this.f2805Mqv2r_3);
        canvas.restore();
    }

    public void KQgRr5e_0(float f) {
        this.f3657Mqv2r_3 = f;
        float max = Math.max(0.0f, f);
        this.PGPF6hQ_2 = Math.max(0.0f, this.f3657Mqv2r_3);
        int measuredHeight = getMeasuredHeight();
        float f2 = this.PGPF6hQ_2;
        if (measuredHeight <= 0) {
            measuredHeight = 180;
        }
        KQgRr5e_0(f2, measuredHeight);
        KQgRr5e_0(max, false);
    }
}
