package ῲ.㴪.K.K;

import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.content.res.XmlResourceParser;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import android.util.Xml;
import java.io.IOException;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;
import ῲ.ᨨ.㳳.C1841;
import ῲ.㴹.C2284;
import K.K.K.ʬ.C2369;

/* renamed from: ῲ.㴪.K.K.ʬ  reason: contains not printable characters */
/* compiled from: AnimatedVectorDrawableCompat */
public class C2253 extends AbstractC2272 implements AbstractC2258 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public C2255 f7760;

    /* renamed from: ඓ  reason: contains not printable characters */
    public ArgbEvaluator f7761;

    /* renamed from: 㴹  reason: contains not printable characters */
    public final Drawable.Callback f7762;

    /* renamed from: 㸾  reason: contains not printable characters */
    public Context f7763;

    /* renamed from: ῲ.㴪.K.K.ʬ$ῲ  reason: contains not printable characters */
    /* compiled from: AnimatedVectorDrawableCompat */
    public static class C2255 extends Drawable.ConstantState {

        /* renamed from: ʬ  reason: contains not printable characters */
        public AnimatorSet f7765;

        /* renamed from: ඓ  reason: contains not printable characters */
        public C2284<Animator, String> f7766;

        /* renamed from: ῲ  reason: contains not printable characters */
        public C2261 f7767;

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

        /* renamed from: 㸾  reason: contains not printable characters */
        public ArrayList<Animator> f7769;

        public C2255(C2255 r5, Drawable.Callback callback, Resources resources) {
            if (r5 != null) {
                this.f7768 = r5.f7768;
                C2261 r0 = r5.f7767;
                if (r0 != null) {
                    Drawable.ConstantState constantState = r0.getConstantState();
                    if (resources != null) {
                        this.f7767 = (C2261) constantState.newDrawable(resources);
                    } else {
                        this.f7767 = (C2261) constantState.newDrawable();
                    }
                    C2261 r7 = this.f7767;
                    r7.mutate();
                    this.f7767 = r7;
                    this.f7767.setCallback(callback);
                    this.f7767.setBounds(r5.f7767.getBounds());
                    this.f7767.f7777 = false;
                }
                ArrayList<Animator> arrayList = r5.f7769;
                if (arrayList != null) {
                    int size = arrayList.size();
                    this.f7769 = new ArrayList<>(size);
                    this.f7766 = new C2284<>(size);
                    for (int i = 0; i < size; i++) {
                        Animator animator = r5.f7769.get(i);
                        Animator clone = animator.clone();
                        String orDefault = r5.f7766.getOrDefault(animator, null);
                        clone.setTarget(this.f7767.f7774.f7833.f7798.getOrDefault(orDefault, null));
                        this.f7769.add(clone);
                        this.f7766.put(clone, orDefault);
                    }
                    if (this.f7765 == null) {
                        this.f7765 = new AnimatorSet();
                    }
                    this.f7765.playTogether(this.f7769);
                }
            }
        }

        public int getChangingConfigurations() {
            return this.f7768;
        }

        public Drawable newDrawable() {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }

        public Drawable newDrawable(Resources resources) {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }
    }

    /* renamed from: ῲ.㴪.K.K.ʬ$K  reason: contains not printable characters */
    /* compiled from: AnimatedVectorDrawableCompat */
    public class C2256 implements Drawable.Callback {
        public C2256() {
        }

        public void invalidateDrawable(Drawable drawable) {
            C2253.this.invalidateSelf();
        }

        public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
            C2253.this.scheduleSelf(runnable, j);
        }

        public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
            C2253.this.unscheduleSelf(runnable);
        }
    }

    public C2253() {
        this(null, null, null);
    }

    /* renamed from: K  reason: contains not printable characters */
    public static C2253 m5876(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
        C2253 r0 = new C2253(context, null, null);
        r0.inflate(resources, xmlPullParser, attributeSet, theme);
        return r0;
    }

    @Override // ῲ.㴪.K.K.AbstractC2272
    public void applyTheme(Resources.Theme theme) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            int i = Build.VERSION.SDK_INT;
            drawable.applyTheme(theme);
        }
    }

    public boolean canApplyTheme() {
        Drawable drawable = this.f7853;
        if (drawable == null) {
            return false;
        }
        int i = Build.VERSION.SDK_INT;
        return drawable.canApplyTheme();
    }

    public void draw(Canvas canvas) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            drawable.draw(canvas);
            return;
        }
        this.f7760.f7767.draw(canvas);
        if (this.f7760.f7765.isStarted()) {
            invalidateSelf();
        }
    }

    public int getAlpha() {
        Drawable drawable = this.f7853;
        if (drawable == null) {
            return this.f7760.f7767.getAlpha();
        }
        int i = Build.VERSION.SDK_INT;
        return drawable.getAlpha();
    }

    public int getChangingConfigurations() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.getChangingConfigurations();
        }
        return super.getChangingConfigurations() | this.f7760.f7768;
    }

    public ColorFilter getColorFilter() {
        Drawable drawable = this.f7853;
        if (drawable == null) {
            return this.f7760.f7767.getColorFilter();
        }
        int i = Build.VERSION.SDK_INT;
        return drawable.getColorFilter();
    }

    public Drawable.ConstantState getConstantState() {
        Drawable drawable = this.f7853;
        if (drawable == null || Build.VERSION.SDK_INT < 24) {
            return null;
        }
        return new C2254(drawable.getConstantState());
    }

    public int getIntrinsicHeight() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.getIntrinsicHeight();
        }
        return this.f7760.f7767.getIntrinsicHeight();
    }

    public int getIntrinsicWidth() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.getIntrinsicWidth();
        }
        return this.f7760.f7767.getIntrinsicWidth();
    }

    public int getOpacity() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.getOpacity();
        }
        return this.f7760.f7767.getOpacity();
    }

    /* JADX WARNING: Code restructure failed: missing block: B:43:0x00ef, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:44:0x00f1, code lost:
        r0 = e;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:45:0x00f3, code lost:
        r0 = th;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:46:0x00f4, code lost:
        r10 = r19;
     */
    /* JADX WARNING: Code restructure failed: missing block: B:63:0x0145, code lost:
        r10.close();
     */
    /* JADX WARNING: Failed to process nested try/catch */
    /* JADX WARNING: Removed duplicated region for block: B:45:0x00f3 A[ExcHandler: all (th java.lang.Throwable), Splitter:B:33:0x009a] */
    /* JADX WARNING: Removed duplicated region for block: B:63:0x0145  */
    @Override // android.graphics.drawable.Drawable
    public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) throws XmlPullParserException, IOException {
        Animator animator;
        XmlResourceParser xmlResourceParser;
        String str;
        XmlPullParserException e;
        IOException e2;
        Drawable drawable = this.f7853;
        if (drawable != null) {
            int i = Build.VERSION.SDK_INT;
            drawable.inflate(resources, xmlPullParser, attributeSet, theme);
            return;
        }
        int eventType = xmlPullParser.getEventType();
        int depth = xmlPullParser.getDepth() + 1;
        for (int i2 = 1; eventType != i2 && (xmlPullParser.getDepth() >= depth || eventType != 3); i2 = 1) {
            if (eventType == 2) {
                String name = xmlPullParser.getName();
                XmlResourceParser xmlResourceParser2 = null;
                if ("animated-vector".equals(name)) {
                    TypedArray r4 = C2369.m6305(resources, theme, attributeSet, C2271.f7842);
                    int resourceId = r4.getResourceId(0, 0);
                    if (resourceId != 0) {
                        C2261 r8 = C2261.m5879(resources, resourceId, theme);
                        r8.f7777 = false;
                        r8.setCallback(this.f7762);
                        C2261 r9 = this.f7760.f7767;
                        if (r9 != null) {
                            r9.setCallback(null);
                        }
                        this.f7760.f7767 = r8;
                    }
                    r4.recycle();
                } else if ("target".equals(name)) {
                    TypedArray obtainAttributes = resources.obtainAttributes(attributeSet, C2271.f7850);
                    String string = obtainAttributes.getString(0);
                    int resourceId2 = obtainAttributes.getResourceId(i2, 0);
                    if (resourceId2 != 0) {
                        Context context = this.f7763;
                        if (context != null) {
                            if (Build.VERSION.SDK_INT >= 24) {
                                animator = AnimatorInflater.loadAnimator(context, resourceId2);
                            } else {
                                Resources resources2 = context.getResources();
                                Resources.Theme theme2 = context.getTheme();
                                try {
                                    xmlResourceParser = resources2.getAnimation(resourceId2);
                                    try {
                                        str = "Can't load animation resource ID #0x";
                                        animator = C1841.m4773(context, resources2, theme2, xmlResourceParser, Xml.asAttributeSet(xmlResourceParser), null, 0, 1.0f);
                                        xmlResourceParser.close();
                                    } catch (XmlPullParserException e3) {
                                        e = e3;
                                        str = "Can't load animation resource ID #0x";
                                        Resources.NotFoundException notFoundException = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                        notFoundException.initCause(e);
                                        throw notFoundException;
                                    } catch (IOException e4) {
                                        e2 = e4;
                                        str = "Can't load animation resource ID #0x";
                                        xmlResourceParser2 = xmlResourceParser;
                                        Resources.NotFoundException notFoundException2 = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                        notFoundException2.initCause(e2);
                                        throw notFoundException2;
                                    } catch (Throwable th) {
                                    }
                                } catch (XmlPullParserException e5) {
                                    e = e5;
                                    str = "Can't load animation resource ID #0x";
                                    xmlResourceParser = null;
                                    Resources.NotFoundException notFoundException3 = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                    notFoundException3.initCause(e);
                                    throw notFoundException3;
                                } catch (IOException e6) {
                                    e2 = e6;
                                    str = "Can't load animation resource ID #0x";
                                    xmlResourceParser = null;
                                    xmlResourceParser2 = xmlResourceParser;
                                    Resources.NotFoundException notFoundException22 = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                    notFoundException22.initCause(e2);
                                    throw notFoundException22;
                                } catch (Throwable th2) {
                                    Throwable th3 = th2;
                                    if (xmlResourceParser2 != null) {
                                    }
                                    throw th3;
                                }
                            }
                            animator.setTarget(this.f7760.f7767.f7774.f7833.f7798.getOrDefault(string, null));
                            int i3 = Build.VERSION.SDK_INT;
                            C2255 r7 = this.f7760;
                            if (r7.f7769 == null) {
                                r7.f7769 = new ArrayList<>();
                                this.f7760.f7766 = new C2284<>();
                            }
                            this.f7760.f7769.add(animator);
                            this.f7760.f7766.put(animator, string);
                        } else {
                            obtainAttributes.recycle();
                            throw new IllegalStateException("Context can't be null when inflating animators");
                        }
                    }
                    obtainAttributes.recycle();
                } else {
                    continue;
                }
            }
            eventType = xmlPullParser.next();
        }
        C2255 r0 = this.f7760;
        if (r0.f7765 == null) {
            r0.f7765 = new AnimatorSet();
        }
        r0.f7765.playTogether(r0.f7769);
    }

    public boolean isAutoMirrored() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return C2369.m6271(drawable);
        }
        return this.f7760.f7767.isAutoMirrored();
    }

    public boolean isRunning() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return ((AnimatedVectorDrawable) drawable).isRunning();
        }
        return this.f7760.f7765.isRunning();
    }

    public boolean isStateful() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.isStateful();
        }
        return this.f7760.f7767.isStateful();
    }

    public Drawable mutate() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            drawable.mutate();
        }
        return this;
    }

    public void onBoundsChange(Rect rect) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            drawable.setBounds(rect);
        } else {
            this.f7760.f7767.setBounds(rect);
        }
    }

    @Override // ῲ.㴪.K.K.AbstractC2272
    public boolean onLevelChange(int i) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.setLevel(i);
        }
        return this.f7760.f7767.setLevel(i);
    }

    public boolean onStateChange(int[] iArr) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.setState(iArr);
        }
        return this.f7760.f7767.setState(iArr);
    }

    public void setAlpha(int i) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            drawable.setAlpha(i);
        } else {
            this.f7760.f7767.setAlpha(i);
        }
    }

    public void setAutoMirrored(boolean z) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            int i = Build.VERSION.SDK_INT;
            drawable.setAutoMirrored(z);
            return;
        }
        this.f7760.f7767.setAutoMirrored(z);
    }

    public void setColorFilter(ColorFilter colorFilter) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            drawable.setColorFilter(colorFilter);
            return;
        }
        C2261 r0 = this.f7760.f7767;
        Drawable drawable2 = r0.f7853;
        if (drawable2 != null) {
            drawable2.setColorFilter(colorFilter);
            return;
        }
        r0.f7775 = colorFilter;
        r0.invalidateSelf();
    }

    public void setTint(int i) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            C2369.m6284(drawable, i);
        } else {
            this.f7760.f7767.setTint(i);
        }
    }

    public void setTintList(ColorStateList colorStateList) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            C2369.m6329(drawable, colorStateList);
        } else {
            this.f7760.f7767.setTintList(colorStateList);
        }
    }

    public void setTintMode(PorterDuff.Mode mode) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            C2369.m6330(drawable, mode);
        } else {
            this.f7760.f7767.setTintMode(mode);
        }
    }

    public boolean setVisible(boolean z, boolean z2) {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            return drawable.setVisible(z, z2);
        }
        this.f7760.f7767.setVisible(z, z2);
        return super.setVisible(z, z2);
    }

    public void start() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).start();
        } else if (!this.f7760.f7765.isStarted()) {
            this.f7760.f7765.start();
            invalidateSelf();
        }
    }

    public void stop() {
        Drawable drawable = this.f7853;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).stop();
        } else {
            this.f7760.f7765.end();
        }
    }

    public C2253(Context context, C2255 r3, Resources resources) {
        this.f7761 = null;
        this.f7762 = new C2256();
        this.f7763 = context;
        if (r3 != null) {
            this.f7760 = r3;
        } else {
            this.f7760 = new C2255(r3, this.f7762, resources);
        }
    }

    /* renamed from: ῲ.㴪.K.K.ʬ$ʬ  reason: contains not printable characters */
    /* compiled from: AnimatedVectorDrawableCompat */
    public static class C2254 extends Drawable.ConstantState {

        /* renamed from: K  reason: contains not printable characters */
        public final Drawable.ConstantState f7764;

        public C2254(Drawable.ConstantState constantState) {
            this.f7764 = constantState;
        }

        public boolean canApplyTheme() {
            return this.f7764.canApplyTheme();
        }

        public int getChangingConfigurations() {
            return this.f7764.getChangingConfigurations();
        }

        public Drawable newDrawable() {
            C2253 r0 = new C2253(null, null, null);
            r0.f7853 = this.f7764.newDrawable();
            r0.f7853.setCallback(r0.f7762);
            return r0;
        }

        public Drawable newDrawable(Resources resources) {
            C2253 r0 = new C2253(null, null, null);
            r0.f7853 = this.f7764.newDrawable(resources);
            r0.f7853.setCallback(r0.f7762);
            return r0;
        }

        public Drawable newDrawable(Resources resources, Resources.Theme theme) {
            C2253 r0 = new C2253(null, null, null);
            r0.f7853 = this.f7764.newDrawable(resources, theme);
            r0.f7853.setCallback(r0.f7762);
            return r0;
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet) throws XmlPullParserException, IOException {
        inflate(resources, xmlPullParser, attributeSet, null);
    }
}
