package com.scwang.smartrefresh.header.flyrefresh;

import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Color;
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;
import com.scwang.smartrefresh.header.R$styleable;
import ῲ.ᨨ.ʬ.C1718;
import K.K.K.ʬ.C2369;

public class MountanScenceView extends View {

    /* renamed from: ʬ  reason: contains not printable characters */
    public int f3128 = Color.parseColor("#86DAD7");

    /* renamed from: Ԕ  reason: contains not printable characters */
    public Paint f3129 = new Paint();

    /* renamed from: Ԛ  reason: contains not printable characters */
    public Matrix f3130 = new Matrix();

    /* renamed from: ؿ  reason: contains not printable characters */
    public Path f3131 = new Path();

    /* renamed from: ݜ  reason: contains not printable characters */
    public Path f3132 = new Path();

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f3133 = Color.parseColor("#3E5F73");

    /* renamed from: ᑓ  reason: contains not printable characters */
    public float f3134 = 1.0f;

    /* renamed from: ᓆ  reason: contains not printable characters */
    public float f3135 = 5.0f;

    /* renamed from: ᓣ  reason: contains not printable characters */
    public Path f3136 = new Path();

    /* renamed from: ᕣ  reason: contains not printable characters */
    public int f3137 = Color.parseColor("#62A4AD");

    /* renamed from: ᨨ  reason: contains not printable characters */
    public int f3138 = Color.parseColor("#1B6169");

    /* renamed from: ῲ  reason: contains not printable characters */
    public int f3139 = Color.parseColor("#7ECEC9");

    /* renamed from: ⁱ  reason: contains not printable characters */
    public int f3140 = Color.parseColor("#0C3E48");

    /* renamed from: ゎ  reason: contains not printable characters */
    public float f3141 = Float.MAX_VALUE;

    /* renamed from: ト  reason: contains not printable characters */
    public int f3142 = 0;

    /* renamed from: 㑃  reason: contains not printable characters */
    public Paint f3143 = new Paint();

    /* renamed from: 㗗  reason: contains not printable characters */
    public Paint f3144 = new Paint();

    /* renamed from: 㗽  reason: contains not printable characters */
    public Path f3145 = new Path();

    /* renamed from: 㳳  reason: contains not printable characters */
    public int f3146 = Color.parseColor("#57B1AE");

    /* renamed from: 㴪  reason: contains not printable characters */
    public float f3147 = 0.0f;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int f3148 = Color.parseColor("#1F7177");

    /* renamed from: 㶋  reason: contains not printable characters */
    public float f3149 = 5.0f;

    /* renamed from: 㸾  reason: contains not printable characters */
    public int f3150 = Color.parseColor("#3C929C");

    /* renamed from: 㿎  reason: contains not printable characters */
    public int f3151 = Color.parseColor("#34888F");

    /* renamed from: 䀟  reason: contains not printable characters */
    public Path f3152 = new Path();

    /* renamed from: 䁗  reason: contains not printable characters */
    public Paint f3153 = new Paint();

    public MountanScenceView(Context context) {
        super(context);
        m1770(context, (AttributeSet) null);
    }

    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        canvas.drawColor(this.f3139);
        this.f3143.setColor(this.f3128);
        canvas.drawPath(this.f3131, this.f3143);
        canvas.save();
        canvas.scale(-1.0f, 1.0f, (float) (getWidth() / 2), 0.0f);
        float f = this.f3149;
        m1771(canvas, f * 0.12f, f * 180.0f, ((this.f3147 * 20.0f) + 93.0f) * this.f3135, this.f3137, this.f3146);
        float f2 = this.f3149;
        m1771(canvas, f2 * 0.1f, f2 * 200.0f, ((this.f3147 * 20.0f) + 96.0f) * this.f3135, this.f3137, this.f3146);
        canvas.restore();
        this.f3143.setColor(this.f3150);
        canvas.drawPath(this.f3136, this.f3143);
        float f3 = this.f3149;
        m1771(canvas, f3 * 0.2f, f3 * 160.0f, ((this.f3147 * 30.0f) + 105.0f) * this.f3135, this.f3140, this.f3148);
        float f4 = this.f3149;
        m1771(canvas, f4 * 0.14f, f4 * 180.0f, ((this.f3147 * 30.0f) + 105.0f) * this.f3135, this.f3138, this.f3151);
        float f5 = this.f3149;
        m1771(canvas, f5 * 0.16f, f5 * 140.0f, ((this.f3147 * 30.0f) + 105.0f) * this.f3135, this.f3138, this.f3151);
        this.f3143.setColor(this.f3133);
        canvas.drawPath(this.f3145, this.f3143);
    }

    public void onMeasure(int i, int i2) {
        super.onMeasure(i, i2);
        int measuredWidth = getMeasuredWidth();
        int measuredHeight = getMeasuredHeight();
        this.f3149 = (((float) measuredWidth) * 1.0f) / 240.0f;
        int i3 = this.f3142;
        if (i3 <= 0) {
            i3 = measuredHeight;
        }
        this.f3135 = (((float) i3) * 1.0f) / 180.0f;
        m1768(this.f3147, measuredHeight);
        m1769(this.f3147, true);
    }

    public void setPrimaryColor(int i) {
        this.f3139 = i;
        this.f3128 = C1718.m4411(-1711276033, i);
        this.f3150 = C1718.m4411(-1724083556, i);
        this.f3133 = C1718.m4411(-868327565, i);
        this.f3148 = C1718.m4411(1428124023, i);
        this.f3140 = C1718.m4411(-871612856, i);
        this.f3151 = C1718.m4411(1429506191, i);
        this.f3138 = C1718.m4411(-870620823, i);
        this.f3146 = C1718.m4411(1431810478, i);
        this.f3137 = C1718.m4411(-865950547, i);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1770(Context context, AttributeSet attributeSet) {
        this.f3143.setAntiAlias(true);
        this.f3143.setStyle(Paint.Style.FILL);
        this.f3153.setAntiAlias(true);
        this.f3129.setAntiAlias(true);
        this.f3144.setAntiAlias(true);
        this.f3144.setStyle(Paint.Style.STROKE);
        this.f3144.setStrokeWidth(2.0f);
        this.f3144.setStrokeJoin(Paint.Join.ROUND);
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.MountanScenceView);
        if (obtainStyledAttributes.hasValue(R$styleable.MountanScenceView_msvPrimaryColor)) {
            setPrimaryColor(obtainStyledAttributes.getColor(R$styleable.MountanScenceView_msvPrimaryColor, -16777216));
        }
        this.f3142 = obtainStyledAttributes.getDimensionPixelOffset(R$styleable.MountanScenceView_msvViewportHeight, 0);
        obtainStyledAttributes.recycle();
        m1768(this.f3147, 180);
        m1769(this.f3147, true);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1768(float f, int i) {
        this.f3130.reset();
        this.f3130.setScale(this.f3149, this.f3135);
        int i2 = (int) (10.0f * f);
        this.f3131.reset();
        this.f3131.moveTo(0.0f, (float) (i2 + 95));
        this.f3131.lineTo(55.0f, (float) (i2 + 74));
        this.f3131.lineTo(146.0f, (float) (i2 + 104));
        this.f3131.lineTo(227.0f, (float) (i2 + 72));
        this.f3131.lineTo(240.0f, (float) (i2 + 80));
        this.f3131.lineTo(240.0f, 180.0f);
        this.f3131.lineTo(0.0f, 180.0f);
        this.f3131.close();
        this.f3131.transform(this.f3130);
        int i3 = (int) (20.0f * f);
        this.f3136.reset();
        this.f3136.moveTo(0.0f, (float) (i3 + 103));
        this.f3136.lineTo(67.0f, (float) (i3 + 90));
        this.f3136.lineTo(165.0f, (float) (i3 + 115));
        this.f3136.lineTo(221.0f, (float) (i3 + 87));
        this.f3136.lineTo(240.0f, (float) (i3 + 100));
        this.f3136.lineTo(240.0f, 180.0f);
        this.f3136.lineTo(0.0f, 180.0f);
        this.f3136.close();
        this.f3136.transform(this.f3130);
        int i4 = (int) (f * 30.0f);
        this.f3145.reset();
        this.f3145.moveTo(0.0f, (float) (i4 + 114));
        this.f3145.cubicTo(30.0f, (float) (i4 + 106), 196.0f, (float) (i4 + 97), 240.0f, (float) (i4 + 104));
        float f2 = (float) i;
        this.f3145.lineTo(240.0f, f2 / this.f3135);
        this.f3145.lineTo(0.0f, f2 / this.f3135);
        this.f3145.close();
        this.f3145.transform(this.f3130);
    }

    public MountanScenceView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        m1770(context, attributeSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1769(float f, boolean z) {
        int i;
        if (f != this.f3141 || z) {
            Interpolator r13 = C2369.m6309(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] = (r13.getInterpolation(f3) * f2) + 50.0f;
                fArr2[i2] = f4;
                f4 -= 0.5f;
                f3 += 0.04f;
                i2++;
            }
            this.f3132.reset();
            this.f3132.moveTo(45.0f, 200.0f);
            int i3 = (int) (((float) 17) * 0.5f);
            float f5 = (float) (17 - i3);
            for (int i4 = 0; i4 < 17; i4++) {
                if (i4 < i3) {
                    this.f3132.lineTo(fArr[i4] - 5.0f, fArr2[i4]);
                } else {
                    this.f3132.lineTo(fArr[i4] - ((((float) (17 - i4)) * 5.0f) / f5), fArr2[i4]);
                }
            }
            for (int i5 = 16; i5 >= 0; i5--) {
                if (i5 < i3) {
                    this.f3132.lineTo(fArr[i5] + 5.0f, fArr2[i5]);
                } else {
                    this.f3132.lineTo(((((float) (17 - i5)) * 5.0f) / f5) + fArr[i5], fArr2[i5]);
                }
            }
            this.f3132.close();
            this.f3152.reset();
            float f6 = (float) 15;
            this.f3152.moveTo(fArr[10] - 20.0f, fArr2[10]);
            this.f3152.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 = ((float) (i6 - 10)) / f6;
                this.f3152.lineTo((f7 * f7 * 20.0f) + (fArr[i6] - 20.0f), fArr2[i6]);
            }
            for (i = 25; i >= 10; i--) {
                float f8 = ((float) (i - 10)) / f6;
                this.f3152.lineTo((fArr[i] + 20.0f) - ((f8 * f8) * 20.0f), fArr2[i]);
            }
        }
    }

    public MountanScenceView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        m1770(context, attributeSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1771(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.f3129.setColor(i2);
        canvas.drawPath(this.f3152, this.f3129);
        this.f3153.setColor(i);
        canvas.drawPath(this.f3132, this.f3153);
        this.f3144.setColor(i);
        canvas.drawPath(this.f3152, this.f3144);
        canvas.restore();
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1767(float f) {
        this.f3134 = f;
        float max = Math.max(0.0f, f);
        this.f3147 = Math.max(0.0f, this.f3134);
        int measuredHeight = getMeasuredHeight();
        float f2 = this.f3147;
        if (measuredHeight <= 0) {
            measuredHeight = 180;
        }
        m1768(f2, measuredHeight);
        m1769(max, false);
    }
}
