package com.mingle.widget;

import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import com.mingle.shapeloading.R$color;
import ඓ.㴹.K.C1361;

public class ShapeLoadingView extends View {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C1361 f2896;

    /* renamed from: ඓ  reason: contains not printable characters */
    public int f2897;

    /* renamed from: ᕣ  reason: contains not printable characters */
    public float f2898;

    /* renamed from: ᨨ  reason: contains not printable characters */
    public Paint f2899;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Shape f2900 = Shape.SHAPE_CIRCLE;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public float f2901;

    /* renamed from: 㑃  reason: contains not printable characters */
    public float f2902;

    /* renamed from: 㳳  reason: contains not printable characters */
    public float f2903;

    /* renamed from: 㴹  reason: contains not printable characters */
    public int f2904;

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

    /* renamed from: 㿎  reason: contains not printable characters */
    public boolean f2906;

    public enum Shape {
        SHAPE_TRIANGLE,
        SHAPE_RECT,
        SHAPE_CIRCLE
    }

    public ShapeLoadingView(Context context) {
        super(context);
        new DecelerateInterpolator();
        this.f2896 = new C1361();
        this.f2901 = 0.5522848f;
        this.f2906 = false;
        this.f2903 = 0.0f;
        this.f2898 = 0.0f;
        m1655();
    }

    public Shape getShape() {
        return this.f2900;
    }

    public void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (getVisibility() != 8) {
            int ordinal = this.f2900.ordinal();
            if (ordinal != 0) {
                if (ordinal != 1) {
                    if (ordinal == 2) {
                        if (this.f2906) {
                            float f = this.f2901;
                            float f2 = this.f2902;
                            float f3 = f + f2;
                            this.f2902 = (float) (((double) f2) + 0.12d);
                            if (this.f2902 + f3 >= 1.9f) {
                                this.f2900 = Shape.SHAPE_RECT;
                                this.f2906 = false;
                            }
                            this.f2899.setColor(((Integer) this.f2896.evaluate(this.f2902, Integer.valueOf(this.f2897), Integer.valueOf(this.f2904))).intValue());
                            Path path = new Path();
                            path.moveTo(m1656(0.5f), m1654(0.0f));
                            float f4 = f3 / 2.0f;
                            float f5 = f4 + 0.5f;
                            float f6 = 0.5f - f4;
                            path.cubicTo(m1656(f5), m1654(0.0f), m1656(1.0f), m1654(f6), m1656(1.0f), m1654(0.5f));
                            path.cubicTo(m1656(1.0f), m1656(f5), m1656(f5), m1654(1.0f), m1656(0.5f), m1654(1.0f));
                            path.cubicTo(m1656(f6), m1656(1.0f), m1656(0.0f), m1654(f5), m1656(0.0f), m1654(0.5f));
                            path.cubicTo(m1656(0.0f), m1656(f6), m1656(f6), m1654(0.0f), m1656(0.5f), m1654(0.0f));
                            path.close();
                            canvas.drawPath(path, this.f2899);
                            invalidate();
                            return;
                        }
                        this.f2899.setColor(getResources().getColor(R$color.circle));
                        Path path2 = new Path();
                        float f7 = this.f2901;
                        path2.moveTo(m1656(0.5f), m1654(0.0f));
                        float f8 = f7 / 2.0f;
                        float f9 = f8 + 0.5f;
                        path2.cubicTo(m1656(f9), 0.0f, m1656(1.0f), m1654(f8), m1656(1.0f), m1654(0.5f));
                        path2.cubicTo(m1656(1.0f), m1656(f9), m1656(f9), m1654(1.0f), m1656(0.5f), m1654(1.0f));
                        float f10 = 0.5f - f8;
                        path2.cubicTo(m1656(f10), m1656(1.0f), m1656(0.0f), m1654(f9), m1656(0.0f), m1654(0.5f));
                        path2.cubicTo(m1656(0.0f), m1656(f10), m1656(f10), m1654(0.0f), m1656(0.5f), m1654(0.0f));
                        this.f2902 = 0.0f;
                        path2.close();
                        canvas.drawPath(path2, this.f2899);
                    }
                } else if (this.f2906) {
                    this.f2902 = (float) (((double) this.f2902) + 0.15d);
                    if (this.f2902 >= 1.0f) {
                        this.f2900 = Shape.SHAPE_TRIANGLE;
                        this.f2906 = false;
                        this.f2902 = 1.0f;
                    }
                    this.f2899.setColor(((Integer) this.f2896.evaluate(this.f2902, Integer.valueOf(this.f2904), Integer.valueOf(this.f2905))).intValue());
                    Path path3 = new Path();
                    path3.moveTo(m1656(this.f2902 * 0.5f), 0.0f);
                    path3.lineTo(m1654(1.0f - (this.f2902 * 0.5f)), 0.0f);
                    float f11 = this.f2903 * this.f2902;
                    float r4 = (m1654(1.0f) - this.f2898) * this.f2902;
                    path3.lineTo(m1656(1.0f) - f11, m1654(1.0f) - r4);
                    path3.lineTo(m1656(0.0f) + f11, m1654(1.0f) - r4);
                    path3.close();
                    canvas.drawPath(path3, this.f2899);
                    invalidate();
                } else {
                    this.f2899.setColor(getResources().getColor(R$color.rect));
                    this.f2903 = m1656(0.066987306f);
                    this.f2898 = m1654(0.75f);
                    Path path4 = new Path();
                    path4.moveTo(m1656(0.0f), m1654(0.0f));
                    path4.lineTo(m1656(1.0f), m1654(0.0f));
                    path4.lineTo(m1656(1.0f), m1654(1.0f));
                    path4.lineTo(m1656(0.0f), m1654(1.0f));
                    path4.close();
                    this.f2902 = 0.0f;
                    canvas.drawPath(path4, this.f2899);
                }
            } else if (this.f2906) {
                this.f2902 = (float) (((double) this.f2902) + 0.1611113d);
                this.f2899.setColor(((Integer) this.f2896.evaluate(this.f2902, Integer.valueOf(this.f2905), Integer.valueOf(this.f2897))).intValue());
                Path path5 = new Path();
                path5.moveTo(m1656(0.5f), m1654(0.0f));
                if (this.f2902 >= 1.0f) {
                    this.f2900 = Shape.SHAPE_CIRCLE;
                    this.f2906 = false;
                    this.f2902 = 1.0f;
                }
                float r42 = this.f2903 - (m1656(this.f2902 * 0.25555554f) * 1.7320508f);
                float r10 = this.f2898 - m1654(this.f2902 * 0.25555554f);
                path5.quadTo(m1656(1.0f) - r42, r10, m1656(0.9330127f), m1654(0.75f));
                path5.quadTo(m1656(0.5f), m1654((this.f2902 * 2.0f * 0.25555554f) + 0.75f), m1656(0.066987306f), m1654(0.75f));
                path5.quadTo(r42, r10, m1656(0.5f), m1654(0.0f));
                path5.close();
                canvas.drawPath(path5, this.f2899);
                invalidate();
            } else {
                Path path6 = new Path();
                this.f2899.setColor(getResources().getColor(R$color.triangle));
                path6.moveTo(m1656(0.5f), m1654(0.0f));
                path6.lineTo(m1656(1.0f), m1654(0.8660254f));
                path6.lineTo(m1656(0.0f), m1654(0.8660254f));
                this.f2903 = m1656(0.28349364f);
                this.f2898 = m1654(0.375f);
                this.f2902 = 0.0f;
                path6.close();
                canvas.drawPath(path6, this.f2899);
            }
        }
    }

    public void setVisibility(int i) {
        super.setVisibility(i);
        if (i == 0) {
            invalidate();
        }
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public final void m1655() {
        this.f2899 = new Paint();
        this.f2899.setColor(getResources().getColor(R$color.triangle));
        this.f2899.setAntiAlias(true);
        this.f2899.setStyle(Paint.Style.FILL_AND_STROKE);
        setBackgroundColor(getResources().getColor(R$color.view_bg));
        this.f2905 = getResources().getColor(R$color.triangle);
        this.f2897 = getResources().getColor(R$color.circle);
        this.f2904 = getResources().getColor(R$color.triangle);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final float m1656(float f) {
        return ((float) getWidth()) * f;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1657() {
        this.f2906 = true;
        invalidate();
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public final float m1654(float f) {
        return ((float) getHeight()) * f;
    }

    public ShapeLoadingView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        new DecelerateInterpolator();
        this.f2896 = new C1361();
        this.f2901 = 0.5522848f;
        this.f2906 = false;
        this.f2903 = 0.0f;
        this.f2898 = 0.0f;
        m1655();
    }

    public ShapeLoadingView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        new DecelerateInterpolator();
        this.f2896 = new C1361();
        this.f2901 = 0.5522848f;
        this.f2906 = false;
        this.f2903 = 0.0f;
        this.f2898 = 0.0f;
    }

    @TargetApi(21)
    public ShapeLoadingView(Context context, AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
        new DecelerateInterpolator();
        this.f2896 = new C1361();
        this.f2901 = 0.5522848f;
        this.f2906 = false;
        this.f2903 = 0.0f;
        this.f2898 = 0.0f;
        m1655();
    }
}
