package com.scwang.smartrefresh.header;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ValueAnimator;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
import com.scwang.smartrefresh.layout.constant.RefreshState;
import com.scwang.smartrefresh.layout.constant.SpinnerStyle;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1391;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1396;
import ඓ.㿎.K.ῲ.Ԕ.AbstractC1401;
import ඓ.㿎.K.ῲ.㗽.ʬ.C1428;
import ඓ.㿎.K.ῲ.䀟.C1436;
import ඓ.㿎.K.K.C1438;
import ඓ.㿎.K.K.C1455;
import ῲ.ᨨ.ʬ.C1718;

public class DropboxHeader extends View implements AbstractC1391 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public Paint f2974;

    /* renamed from: Ԕ  reason: contains not printable characters */
    public ValueAnimator f2975;

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

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

    /* renamed from: ᨨ  reason: contains not printable characters */
    public Drawable f2978;

    /* renamed from: ῲ  reason: contains not printable characters */
    public Path f2979;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public boolean f2980;

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

    /* renamed from: 㗗  reason: contains not printable characters */
    public RefreshState f2982;

    /* renamed from: 㳳  reason: contains not printable characters */
    public Drawable f2983;

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

    /* renamed from: 㸾  reason: contains not printable characters */
    public C0541 f2985;

    /* renamed from: 㿎  reason: contains not printable characters */
    public Drawable f2986;

    /* renamed from: 䁗  reason: contains not printable characters */
    public ValueAnimator f2987;

    /* renamed from: com.scwang.smartrefresh.header.DropboxHeader$ʬ  reason: contains not printable characters */
    public class C0541 {

        /* renamed from: ʬ  reason: contains not printable characters */
        public int f2988;

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

        /* renamed from: ᨨ  reason: contains not printable characters */
        public int f2990;

        /* renamed from: ῲ  reason: contains not printable characters */
        public int f2991;

        /* renamed from: ⁱ  reason: contains not printable characters */
        public int f2992;

        /* renamed from: K  reason: contains not printable characters */
        public int f2993;

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

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

        /* renamed from: 㿎  reason: contains not printable characters */
        public int f2996;

        public /* synthetic */ C0541(DropboxHeader dropboxHeader, C0543 k) {
        }
    }

    /* renamed from: com.scwang.smartrefresh.header.DropboxHeader$ῲ  reason: contains not printable characters */
    public class C0542 extends AnimatorListenerAdapter {
        public C0542() {
        }

        public void onAnimationEnd(Animator animator) {
            DropboxHeader.this.f2987.start();
        }
    }

    /* renamed from: com.scwang.smartrefresh.header.DropboxHeader$K  reason: contains not printable characters */
    public class C0543 extends AnimatorListenerAdapter {
        public C0543() {
        }

        public void onAnimationEnd(Animator animator) {
            DropboxHeader dropboxHeader = DropboxHeader.this;
            if (dropboxHeader.f2982 == RefreshState.Refreshing) {
                dropboxHeader.f2975.start();
            }
        }
    }

    public DropboxHeader(Context context) {
        super(context);
        m1689(context, (AttributeSet) null);
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    public SpinnerStyle getSpinnerStyle() {
        return SpinnerStyle.Scale;
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    public View getView() {
        return this;
    }

    public void onDraw(Canvas canvas) {
        int width = getWidth();
        int height = getHeight();
        int i = this.f2984 / 5;
        int i2 = i / 2;
        C0541 r6 = this.f2985;
        r6.f2990 = i;
        int i3 = width / 2;
        r6.f2993 = i3;
        r6.f2988 = height - i2;
        r6.f2995 = r6.f2988 - (i * 2);
        r6.f2989 = r6.f2993 - ((int) (Math.sin(1.0471975511965976d) * ((double) i)));
        r6.f2994 = r6.f2995 + i2;
        int i4 = r6.f2988;
        r6.f2992 = i4 - i2;
        r6.f2996 = width - r6.f2989;
        r6.f2991 = i4 - i;
        this.f2974.setColor(C1718.m4410(this.f2976, 150));
        this.f2979.reset();
        this.f2979.moveTo((float) r6.f2989, (float) r6.f2992);
        this.f2979.lineTo((float) r6.f2993, (float) r6.f2988);
        this.f2979.lineTo((float) r6.f2996, (float) r6.f2992);
        Path path = this.f2979;
        int i5 = r6.f2996;
        path.quadTo((((float) (r6.f2990 / 2)) * this.f2981) + ((float) i5), (float) r6.f2991, (float) i5, (float) r6.f2994);
        this.f2979.lineTo((float) r6.f2993, (float) r6.f2995);
        this.f2979.lineTo((float) r6.f2989, (float) r6.f2994);
        Path path2 = this.f2979;
        int i6 = r6.f2989;
        path2.quadTo(((float) i6) - (((float) (r6.f2990 / 2)) * this.f2981), (float) r6.f2991, (float) i6, (float) r6.f2992);
        this.f2979.close();
        canvas.drawPath(this.f2979, this.f2974);
        this.f2974.setColor(this.f2976);
        this.f2979.reset();
        double d = ((double) this.f2981) * 1.2566370614359172d;
        float f = (float) (((r6.f2993 - r6.f2989) * 4) / 5);
        double d2 = 1.0471975511965976d - (d / 2.0d);
        float sin = ((float) Math.sin(d2)) * f;
        float cos = ((float) Math.cos(d2)) * f;
        this.f2979.moveTo((float) r6.f2989, (float) r6.f2994);
        this.f2979.lineTo((float) r6.f2993, (float) r6.f2995);
        this.f2979.lineTo(((float) r6.f2993) - sin, ((float) r6.f2995) - cos);
        this.f2979.lineTo(((float) r6.f2989) - sin, ((float) r6.f2994) - cos);
        this.f2979.close();
        double d3 = d + 1.0471975511965976d;
        float sin2 = ((float) Math.sin(d3)) * f;
        float cos2 = ((float) Math.cos(d3)) * f;
        this.f2979.moveTo((float) r6.f2989, (float) r6.f2994);
        this.f2979.lineTo((float) r6.f2993, (float) ((r6.f2988 + r6.f2995) / 2));
        this.f2979.lineTo(((float) r6.f2993) - sin2, ((float) ((r6.f2988 + r6.f2995) / 2)) + cos2);
        this.f2979.lineTo(((float) r6.f2989) - sin2, ((float) r6.f2994) + cos2);
        this.f2979.close();
        float sin3 = ((float) Math.sin(d2)) * f;
        float cos3 = ((float) Math.cos(d2)) * f;
        this.f2979.moveTo((float) r6.f2996, (float) r6.f2994);
        this.f2979.lineTo((float) r6.f2993, (float) r6.f2995);
        this.f2979.lineTo(((float) r6.f2993) + sin3, ((float) r6.f2995) - cos3);
        this.f2979.lineTo(((float) r6.f2996) + sin3, ((float) r6.f2994) - cos3);
        this.f2979.close();
        float sin4 = ((float) Math.sin(d3)) * f;
        float cos4 = f * ((float) Math.cos(d3));
        this.f2979.moveTo((float) r6.f2996, (float) r6.f2994);
        this.f2979.lineTo((float) r6.f2993, (float) ((r6.f2988 + r6.f2995) / 2));
        this.f2979.lineTo(((float) r6.f2993) + sin4, ((float) ((r6.f2988 + r6.f2995) / 2)) + cos4);
        this.f2979.lineTo(((float) r6.f2996) + sin4, ((float) r6.f2994) + cos4);
        this.f2979.close();
        canvas.drawPath(this.f2979, this.f2974);
        if (isInEditMode()) {
            this.f2977 = 2.5f;
        }
        if (this.f2977 > 0.0f) {
            this.f2979.reset();
            this.f2979.lineTo(0.0f, (float) r6.f2994);
            this.f2979.lineTo((float) r6.f2989, (float) r6.f2994);
            this.f2979.lineTo((float) r6.f2993, (float) r6.f2991);
            this.f2979.lineTo((float) r6.f2996, (float) r6.f2994);
            float f2 = (float) width;
            this.f2979.lineTo(f2, (float) r6.f2994);
            this.f2979.lineTo(f2, 0.0f);
            this.f2979.close();
            canvas.clipPath(this.f2979);
            float min = Math.min(this.f2977, 1.0f);
            Rect bounds = this.f2986.getBounds();
            bounds.offsetTo(i3 - (bounds.width() / 2), ((int) (((float) (bounds.height() + (r6.f2991 - (bounds.height() / 2)))) * min)) - bounds.height());
            this.f2986.draw(canvas);
            float min2 = Math.min(Math.max(this.f2977 - 1.0f, 0.0f), 1.0f);
            Rect bounds2 = this.f2978.getBounds();
            bounds2.offsetTo(i3 - (bounds2.width() / 2), ((int) (((float) (bounds2.height() + (r6.f2991 - (bounds2.height() / 2)))) * min2)) - bounds2.height());
            this.f2978.draw(canvas);
            float min3 = Math.min(Math.max(this.f2977 - 2.0f, 0.0f), 1.0f);
            Rect bounds3 = this.f2983.getBounds();
            bounds3.offsetTo(i3 - (bounds3.width() / 2), ((int) (((float) (bounds3.height() + (r6.f2991 - (bounds3.height() / 2)))) * min3)) - bounds3.height());
            this.f2983.draw(canvas);
            if (this.f2980) {
                bounds.offsetTo(i3 - (bounds.width() / 2), r6.f2991 - (bounds.height() / 2));
                this.f2986.draw(canvas);
                bounds2.offsetTo(i3 - (bounds2.width() / 2), r6.f2991 - (bounds2.height() / 2));
                this.f2978.draw(canvas);
                bounds3.offsetTo(i3 - (bounds3.width() / 2), r6.f2991 - (bounds3.height() / 2));
                this.f2983.draw(canvas);
            }
        }
    }

    public void onMeasure(int i, int i2) {
        setMeasuredDimension(View.resolveSize(getSuggestedMinimumWidth(), i), View.resolveSize(getSuggestedMinimumHeight(), i2));
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    public void setPrimaryColors(int... iArr) {
        if (iArr.length > 0) {
            setBackgroundColor(iArr[0]);
            if (iArr.length > 1) {
                this.f2976 = iArr[1];
            }
        }
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1391
    /* renamed from: ῲ  reason: contains not printable characters */
    public void m1687(float f, int i, int i2, int i3) {
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1391
    /* renamed from: K  reason: contains not printable characters */
    public void m1688(float f, int i, int i2, int i3) {
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1689(Context context, AttributeSet attributeSet) {
        this.f2979 = new Path();
        this.f2974 = new Paint();
        this.f2985 = new C0541(this, null);
        this.f2974.setAntiAlias(true);
        this.f2976 = -9524737;
        setBackgroundColor(-14141883);
        setMinimumHeight(C1436.m3649(150.0f));
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.DropboxHeader);
        if (obtainStyledAttributes.hasValue(R$styleable.DropboxHeader_dhDrawable1)) {
            this.f2986 = obtainStyledAttributes.getDrawable(R$styleable.DropboxHeader_dhDrawable1);
        } else {
            C1428 r11 = new C1428();
            r11.m3644("M3 2h18v20h-18z", "m4,1c-1.105,0 -2,0.895 -2,2v3,11 3,1c0,1.105 0.895,2 2,2h2,12 2c1.105,0 2,-0.895 2,-2v-1,-3 -11,-3c0,-1.105 -0.895,-2 -2,-2h-2,-12 -2zM3.5,3h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,3h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM3.5,6h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,6h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM3.5,9h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,9h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM3.5,12h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,12h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM3.5,15h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,15h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM3.5,18h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5zM19.5,18h1c0.276,0 0.5,0.224 0.5,0.5v1c0,0.276 -0.224,0.5 -0.5,0.5h-1c-0.276,0 -0.5,-0.224 -0.5,-0.5v-1c0,-0.276 0.224,-0.5 0.5,-0.5z");
            r11.m3643(-1249039, -245496);
            this.f2986 = r11;
        }
        if (obtainStyledAttributes.hasValue(R$styleable.DropboxHeader_dhDrawable2)) {
            this.f2978 = obtainStyledAttributes.getDrawable(R$styleable.DropboxHeader_dhDrawable2);
        } else {
            C1428 r112 = new C1428();
            r112.m3644("M49,16.5l-14,-14l-27,0l0,53l41,0z", "m16,23.5h25c0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1L16,21.5c-0.55,0 -1,0.45 -1,1 0,0.55 0.45,1 1,1z", "m16,15.5h10c0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1L16,13.5c-0.55,0 -1,0.45 -1,1 0,0.55 0.45,1 1,1z", "M41,29.5L16,29.5c-0.55,0 -1,0.45 -1,1 0,0.55 0.45,1 1,1h25c0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1z", "M41,37.5L16,37.5c-0.55,0 -1,0.45 -1,1 0,0.55 0.45,1 1,1h25c0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1z", "M41,45.5L16,45.5c-0.55,0 -1,0.45 -1,1 0,0.55 0.45,1 1,1h25c0.55,0 1,-0.45 1,-1 0,-0.55 -0.45,-1 -1,-1z", "M49,16.5l-14,-14l0,14z");
            r112.m3643(-76695, -2773417);
            this.f2978 = r112;
        }
        if (obtainStyledAttributes.hasValue(R$styleable.DropboxHeader_dhDrawable3)) {
            this.f2983 = obtainStyledAttributes.getDrawable(R$styleable.DropboxHeader_dhDrawable3);
        } else {
            C1428 r113 = new C1428();
            r113.m3644("M6.021,2.188L6.021,11.362C5.46,11.327 4.843,11.414 4.229,11.663C2.624,12.312 1.696,13.729 2.155,14.825C2.62,15.924 4.294,16.284 5.898,15.634C7.131,15.134 7.856,14.184 7.965,13.272L7.958,4.387L15.02,3.028L15.02,9.406C14.422,9.343 13.746,9.432 13.076,9.703C11.471,10.353 10.544,11.77 11.004,12.866C11.467,13.964 13.141,14.325 14.746,13.675C15.979,13.174 16.836,12.224 16.947,11.313L16.958,0.002L6.021,2.188L6.021,2.188Z");
            r113.m3643(-6760607);
            this.f2983 = r113;
        }
        obtainStyledAttributes.recycle();
        AccelerateInterpolator accelerateInterpolator = new AccelerateInterpolator();
        this.f2987 = ValueAnimator.ofFloat(0.0f, 1.0f, 0.0f);
        this.f2987.setInterpolator(accelerateInterpolator);
        this.f2987.setDuration(300L);
        this.f2987.addUpdateListener(new C1438(this));
        this.f2987.addListener(new C0543());
        this.f2975 = ValueAnimator.ofFloat(0.0f, 1.0f);
        this.f2975.setInterpolator(accelerateInterpolator);
        this.f2975.setDuration(300L);
        this.f2975.addUpdateListener(new C1455(this));
        this.f2975.addListener(new C0542());
    }

    public DropboxHeader(Context context, AttributeSet attributeSet) {
        super(context, attributeSet);
        m1689(context, attributeSet);
    }

    public DropboxHeader(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        m1689(context, attributeSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static /* synthetic */ void m1686(DropboxHeader dropboxHeader, ValueAnimator valueAnimator) {
        dropboxHeader.f2981 = ((Float) valueAnimator.getAnimatedValue()).floatValue();
        dropboxHeader.invalidate();
    }

    @Override // ඓ.㿎.K.ῲ.ݜ.AbstractC1408
    /* renamed from: K  reason: contains not printable characters */
    public void m1693(AbstractC1401 r1, RefreshState refreshState, RefreshState refreshState2) {
        this.f2982 = refreshState2;
        if (refreshState2 == RefreshState.None) {
            this.f2980 = false;
        }
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    /* renamed from: K  reason: contains not printable characters */
    public void m1690(AbstractC1396 r1, int i, int i2) {
        this.f2984 = i;
        int i3 = this.f2984 / 5;
        this.f2986.setBounds(0, 0, i3, i3);
        this.f2978.setBounds(0, 0, i3, i3);
        this.f2983.setBounds(0, 0, i3, i3);
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    /* renamed from: K  reason: contains not printable characters */
    public void m1692(AbstractC1401 r1, int i, int i2) {
        this.f2975.start();
    }

    @Override // ඓ.㿎.K.ῲ.Ԕ.AbstractC1399
    /* renamed from: K  reason: contains not printable characters */
    public void m1691(AbstractC1401 r1) {
        this.f2977 = 0.0f;
    }
}
