package com.mingle.widget;

import android.annotation.TargetApi;
import android.content.Context;
import android.content.res.TypedArray;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.TextView;
import com.mingle.shapeloading.R$id;
import com.mingle.shapeloading.R$layout;
import com.mingle.shapeloading.R$styleable;
import ඓ.㴹.K.AbstractC1354;
import ඓ.㴹.K.C1320;
import ඓ.㴹.K.C1359;

public class LoadingView extends FrameLayout {

    /* renamed from: 㳳  reason: contains not printable characters */
    public static float f2884 = 200.0f;

    /* renamed from: ʬ  reason: contains not printable characters */
    public ImageView f2885;

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

    /* renamed from: ᨨ  reason: contains not printable characters */
    public float f2887 = 1.2f;

    /* renamed from: ῲ  reason: contains not printable characters */
    public ShapeLoadingView f2888;

    /* renamed from: ⁱ  reason: contains not printable characters */
    public C1320 f2889 = null;

    /* renamed from: 㴹  reason: contains not printable characters */
    public String f2890;

    /* renamed from: 㸾  reason: contains not printable characters */
    public TextView f2891;

    /* renamed from: 㿎  reason: contains not printable characters */
    public Runnable f2892 = new RunnableC0535();

    /* renamed from: com.mingle.widget.LoadingView$ʬ  reason: contains not printable characters */
    public class C0533 implements AbstractC1354.AbstractC1355 {
        public C0533() {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: ʬ  reason: contains not printable characters */
        public void m1646(AbstractC1354 k) {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m1647(AbstractC1354 k) {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: K  reason: contains not printable characters */
        public void m1648(AbstractC1354 k) {
            LoadingView.this.f2888.m1657();
            LoadingView.this.m1641();
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: 㸾  reason: contains not printable characters */
        public void m1649(AbstractC1354 k) {
        }
    }

    /* renamed from: com.mingle.widget.LoadingView$ῲ  reason: contains not printable characters */
    public class C0534 implements AbstractC1354.AbstractC1355 {
        public C0534() {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: ʬ  reason: contains not printable characters */
        public void m1650(AbstractC1354 k) {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: ῲ  reason: contains not printable characters */
        public void m1651(AbstractC1354 k) {
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: K  reason: contains not printable characters */
        public void m1652(AbstractC1354 k) {
            LoadingView.this.m1643();
        }

        @Override // ඓ.㴹.K.AbstractC1354.AbstractC1355
        /* renamed from: 㸾  reason: contains not printable characters */
        public void m1653(AbstractC1354 k) {
        }
    }

    /* renamed from: com.mingle.widget.LoadingView$K  reason: contains not printable characters */
    public class RunnableC0535 implements Runnable {
        public RunnableC0535() {
        }

        public void run() {
            LoadingView.this.m1643();
        }
    }

    public LoadingView(Context context) {
        super(context);
    }

    public void onFinishInflate() {
        super.onFinishInflate();
        View inflate = LayoutInflater.from(getContext()).inflate(R$layout.load_view, (ViewGroup) null);
        f2884 = (float) m1642(54.0f);
        FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(-2, -2);
        layoutParams.gravity = 17;
        this.f2888 = (ShapeLoadingView) inflate.findViewById(R$id.shapeLoadingView);
        this.f2885 = (ImageView) inflate.findViewById(R$id.indication);
        this.f2891 = (TextView) inflate.findViewById(R$id.promptTV);
        if (this.f2886 != -1) {
            this.f2891.setTextAppearance(getContext(), this.f2886);
        }
        setLoadingText(this.f2890);
        addView(inflate, layoutParams);
        m1644(900L);
    }

    public void setLoadingText(CharSequence charSequence) {
        if (TextUtils.isEmpty(charSequence)) {
            this.f2891.setVisibility(8);
        } else {
            this.f2891.setVisibility(0);
        }
        this.f2891.setText(charSequence);
    }

    public void setVisibility(int i) {
        super.setVisibility(i);
        if (i == 0) {
            m1644(200L);
            return;
        }
        C1320 r3 = this.f2889;
        if (r3 != null) {
            if (r3.m3458()) {
                this.f2889.cancel();
            }
            this.f2889 = null;
        }
        removeCallbacks(this.f2892);
    }

    /* renamed from: ῲ  reason: contains not printable characters */
    public void m1641() {
        C1359 r5;
        C1359 r0 = C1359.m3537(this.f2888, "translationY", f2884, 0.0f);
        C1359 r2 = C1359.m3537(this.f2885, "scaleX", 0.2f, 1.0f);
        int ordinal = this.f2888.getShape().ordinal();
        if (ordinal == 0) {
            r5 = C1359.m3537(this.f2888, "rotation", 0.0f, 180.0f);
        } else if (ordinal == 1) {
            r5 = C1359.m3537(this.f2888, "rotation", 0.0f, -120.0f);
        } else if (ordinal != 2) {
            r5 = null;
        } else {
            r5 = C1359.m3537(this.f2888, "rotation", 0.0f, 180.0f);
        }
        r0.m3541(500L);
        r5.m3541(500L);
        r0.m3478(new DecelerateInterpolator(this.f2887));
        r5.m3478(new DecelerateInterpolator(this.f2887));
        C1320 r8 = new C1320();
        r8.m3456(500L);
        r8.m3457(r0, r5, r2);
        r8.m3516(new C0534());
        r8.m3454();
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1645(Context context, AttributeSet attributeSet) {
        TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, R$styleable.LoadingView);
        this.f2890 = obtainStyledAttributes.getString(R$styleable.LoadingView_loadingText);
        this.f2886 = obtainStyledAttributes.getResourceId(R$styleable.LoadingView_loadingTextAppearance, -1);
        obtainStyledAttributes.recycle();
    }

    public LoadingView(Context context, AttributeSet attributeSet) {
        super(context, attributeSet, 0);
        m1645(context, attributeSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public int m1642(float f) {
        return (int) ((f * getContext().getResources().getDisplayMetrics().density) + 0.5f);
    }

    /* renamed from: K  reason: contains not printable characters */
    public final void m1644(long j) {
        C1320 r0 = this.f2889;
        if (r0 == null || !r0.m3458()) {
            removeCallbacks(this.f2892);
            if (j > 0) {
                postDelayed(this.f2892, j);
            } else {
                post(this.f2892);
            }
        }
    }

    public LoadingView(Context context, AttributeSet attributeSet, int i) {
        super(context, attributeSet, i);
        m1645(context, attributeSet);
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m1643() {
        C1359 r0 = C1359.m3537(this.f2888, "translationY", 0.0f, f2884);
        C1359 r2 = C1359.m3537(this.f2885, "scaleX", 1.0f, 0.2f);
        r0.m3541(500L);
        r0.m3478(new AccelerateInterpolator(this.f2887));
        C1320 r4 = new C1320();
        r4.m3456(500L);
        r4.m3457(r0, r2);
        r4.m3516(new C0533());
        r4.m3454();
    }

    @TargetApi(21)
    public LoadingView(Context context, AttributeSet attributeSet, int i, int i2) {
        super(context, attributeSet, i, i2);
        m1645(context, attributeSet);
    }
}
