package p037.p119.p120.p121;

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 p037.p041.p042.LayoutInflaterFactory2C1494;
import p037.p057.C1714;

/* JADX INFO: renamed from: މ.ޕ.֏.֏.ހ, reason: contains not printable characters */
/* JADX INFO: loaded from: classes.dex */
public class C2523 extends AbstractC2529 implements InterfaceC2522 {

    /* JADX INFO: renamed from: ބ, reason: contains not printable characters */
    public C2525 f7913;

    /* JADX INFO: renamed from: ޅ, reason: contains not printable characters */
    public Context f7914;

    /* JADX INFO: renamed from: ކ, reason: contains not printable characters */
    public ArgbEvaluator f7915;

    /* JADX INFO: renamed from: އ, reason: contains not printable characters */
    public final Drawable.Callback f7916;

    /* JADX INFO: renamed from: މ.ޕ.֏.֏.ހ$֏, reason: contains not printable characters */
    public class C2524 implements Drawable.Callback {
        public C2524() {
        }

        @Override // android.graphics.drawable.Drawable.Callback
        public void invalidateDrawable(Drawable drawable) {
            C2523.this.invalidateSelf();
        }

        @Override // android.graphics.drawable.Drawable.Callback
        public void scheduleDrawable(Drawable drawable, Runnable runnable, long j) {
            C2523.this.scheduleSelf(runnable, j);
        }

        @Override // android.graphics.drawable.Drawable.Callback
        public void unscheduleDrawable(Drawable drawable, Runnable runnable) {
            C2523.this.unscheduleSelf(runnable);
        }
    }

    /* JADX INFO: renamed from: މ.ޕ.֏.֏.ހ$ؠ, reason: contains not printable characters */
    public static class C2525 extends Drawable.ConstantState {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public int f7918;

        /* JADX INFO: renamed from: ؠ, reason: contains not printable characters */
        public C2530 f7919;

        /* JADX INFO: renamed from: ހ, reason: contains not printable characters */
        public AnimatorSet f7920;

        /* JADX INFO: renamed from: ށ, reason: contains not printable characters */
        public ArrayList<Animator> f7921;

        /* JADX INFO: renamed from: ނ, reason: contains not printable characters */
        public C1714<Animator, String> f7922;

        public C2525(C2525 c2525, Drawable.Callback callback, Resources resources) {
            if (c2525 != null) {
                this.f7918 = c2525.f7918;
                C2530 c2530 = c2525.f7919;
                if (c2530 != null) {
                    Drawable.ConstantState constantState = c2530.getConstantState();
                    if (resources != null) {
                        this.f7919 = (C2530) constantState.newDrawable(resources);
                    } else {
                        this.f7919 = (C2530) constantState.newDrawable();
                    }
                    C2530 c25302 = this.f7919;
                    c25302.mutate();
                    this.f7919 = c25302;
                    c25302.setCallback(callback);
                    this.f7919.setBounds(c2525.f7919.getBounds());
                    this.f7919.f7932 = false;
                }
                ArrayList<Animator> arrayList = c2525.f7921;
                if (arrayList != null) {
                    int size = arrayList.size();
                    this.f7921 = new ArrayList<>(size);
                    this.f7922 = new C1714<>(size);
                    for (int i = 0; i < size; i++) {
                        Animator animator = c2525.f7921.get(i);
                        Animator animatorClone = animator.clone();
                        String orDefault = c2525.f7922.getOrDefault(animator, null);
                        animatorClone.setTarget(this.f7919.f7928.f7983.f7981.getOrDefault(orDefault, null));
                        this.f7921.add(animatorClone);
                        this.f7922.put(animatorClone, orDefault);
                    }
                    if (this.f7920 == null) {
                        this.f7920 = new AnimatorSet();
                    }
                    this.f7920.playTogether(this.f7921);
                }
            }
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public int getChangingConfigurations() {
            return this.f7918;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable() {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources) {
            throw new IllegalStateException("No constant state support for SDK < 24.");
        }
    }

    /* JADX INFO: renamed from: މ.ޕ.֏.֏.ހ$ހ, reason: contains not printable characters */
    public static class C2526 extends Drawable.ConstantState {

        /* JADX INFO: renamed from: ֏, reason: contains not printable characters */
        public final Drawable.ConstantState f7923;

        public C2526(Drawable.ConstantState constantState) {
            this.f7923 = constantState;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public boolean canApplyTheme() {
            return this.f7923.canApplyTheme();
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public int getChangingConfigurations() {
            return this.f7923.getChangingConfigurations();
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable() {
            C2523 c2523 = new C2523(null, null, null);
            Drawable drawableNewDrawable = this.f7923.newDrawable();
            c2523.f7926 = drawableNewDrawable;
            drawableNewDrawable.setCallback(c2523.f7916);
            return c2523;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources) {
            C2523 c2523 = new C2523(null, null, null);
            Drawable drawableNewDrawable = this.f7923.newDrawable(resources);
            c2523.f7926 = drawableNewDrawable;
            drawableNewDrawable.setCallback(c2523.f7916);
            return c2523;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources, Resources.Theme theme) {
            C2523 c2523 = new C2523(null, null, null);
            Drawable drawableNewDrawable = this.f7923.newDrawable(resources, theme);
            c2523.f7926 = drawableNewDrawable;
            drawableNewDrawable.setCallback(c2523.f7916);
            return c2523;
        }
    }

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

    public C2523(Context context, C2525 c2525, Resources resources) {
        this.f7915 = null;
        this.f7916 = new C2524();
        this.f7914 = context;
        if (c2525 != null) {
            this.f7913 = c2525;
        } else {
            this.f7913 = new C2525(c2525, this.f7916, resources);
        }
    }

    @Override // p037.p119.p120.p121.AbstractC2529, android.graphics.drawable.Drawable
    public void applyTheme(Resources.Theme theme) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.applyTheme(theme);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public boolean canApplyTheme() {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            return drawable.canApplyTheme();
        }
        return false;
    }

    @Override // android.graphics.drawable.Drawable
    public void draw(Canvas canvas) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.draw(canvas);
            return;
        }
        this.f7913.f7919.draw(canvas);
        if (this.f7913.f7920.isStarted()) {
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public int getAlpha() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getAlpha() : this.f7913.f7919.getAlpha();
    }

    @Override // android.graphics.drawable.Drawable
    public int getChangingConfigurations() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getChangingConfigurations() : super.getChangingConfigurations() | this.f7913.f7918;
    }

    @Override // android.graphics.drawable.Drawable
    public ColorFilter getColorFilter() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getColorFilter() : this.f7913.f7919.getColorFilter();
    }

    @Override // android.graphics.drawable.Drawable
    public Drawable.ConstantState getConstantState() {
        if (this.f7926 == null || Build.VERSION.SDK_INT < 24) {
            return null;
        }
        return new C2526(this.f7926.getConstantState());
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicHeight() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getIntrinsicHeight() : this.f7913.f7919.getIntrinsicHeight();
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicWidth() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getIntrinsicWidth() : this.f7913.f7919.getIntrinsicWidth();
    }

    @Override // android.graphics.drawable.Drawable
    public int getOpacity() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.getOpacity() : this.f7913.f7919.getOpacity();
    }

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

    @Override // android.graphics.drawable.Drawable
    public void inflate(Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
        String str;
        XmlResourceParser animation;
        Animator animatorM2884;
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.inflate(resources, xmlPullParser, attributeSet, theme);
            return;
        }
        int eventType = xmlPullParser.getEventType();
        int depth = xmlPullParser.getDepth() + 1;
        for (int i = 1; eventType != i && (xmlPullParser.getDepth() >= depth || eventType != 3); i = 1) {
            if (eventType == 2) {
                String name = xmlPullParser.getName();
                if ("animated-vector".equals(name)) {
                    TypedArray typedArrayM2894 = LayoutInflaterFactory2C1494.C1505.m2894(resources, theme, attributeSet, C2521.f7905);
                    int resourceId = typedArrayM2894.getResourceId(0, 0);
                    if (resourceId != 0) {
                        C2530 c2530M4597 = C2530.m4597(resources, resourceId, theme);
                        c2530M4597.f7932 = false;
                        c2530M4597.setCallback(this.f7916);
                        C2530 c2530 = this.f7913.f7919;
                        if (c2530 != null) {
                            c2530.setCallback(null);
                        }
                        this.f7913.f7919 = c2530M4597;
                    }
                    typedArrayM2894.recycle();
                } else if ("target".equals(name)) {
                    TypedArray typedArrayObtainAttributes = resources.obtainAttributes(attributeSet, C2521.f7906);
                    String string = typedArrayObtainAttributes.getString(0);
                    int resourceId2 = typedArrayObtainAttributes.getResourceId(i, 0);
                    if (resourceId2 != 0) {
                        Context context = this.f7914;
                        if (context == null) {
                            typedArrayObtainAttributes.recycle();
                            throw new IllegalStateException("Context can't be null when inflating animators");
                        }
                        if (Build.VERSION.SDK_INT >= 24) {
                            animatorM2884 = AnimatorInflater.loadAnimator(context, resourceId2);
                        } else {
                            Resources resources2 = context.getResources();
                            Resources.Theme theme2 = context.getTheme();
                            try {
                                try {
                                    animation = resources2.getAnimation(resourceId2);
                                    try {
                                        try {
                                            str = "Can't load animation resource ID #0x";
                                            try {
                                                animatorM2884 = LayoutInflaterFactory2C1494.C1505.m2884(context, resources2, theme2, animation, Xml.asAttributeSet(animation), (AnimatorSet) null, 0, 1.0f);
                                                animation.close();
                                            } catch (IOException e) {
                                                e = e;
                                                Resources.NotFoundException notFoundException = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                                notFoundException.initCause(e);
                                                throw notFoundException;
                                            } catch (XmlPullParserException e2) {
                                                e = e2;
                                                Resources.NotFoundException notFoundException2 = new Resources.NotFoundException(str + Integer.toHexString(resourceId2));
                                                notFoundException2.initCause(e);
                                                throw notFoundException2;
                                            }
                                        } catch (Throwable th) {
                                            th = th;
                                            if (animation != null) {
                                                animation.close();
                                            }
                                            throw th;
                                        }
                                    } catch (IOException e3) {
                                        e = e3;
                                        str = "Can't load animation resource ID #0x";
                                    } catch (XmlPullParserException e4) {
                                        e = e4;
                                        str = "Can't load animation resource ID #0x";
                                    }
                                } catch (Throwable th2) {
                                    th = th2;
                                    animation = null;
                                }
                            } catch (IOException e5) {
                                e = e5;
                                str = "Can't load animation resource ID #0x";
                            } catch (XmlPullParserException e6) {
                                e = e6;
                                str = "Can't load animation resource ID #0x";
                            }
                        }
                        animatorM2884.setTarget(this.f7913.f7919.f7928.f7983.f7981.getOrDefault(string, null));
                        C2525 c2525 = this.f7913;
                        if (c2525.f7921 == null) {
                            c2525.f7921 = new ArrayList<>();
                            this.f7913.f7922 = new C1714<>();
                        }
                        this.f7913.f7921.add(animatorM2884);
                        this.f7913.f7922.put(animatorM2884, string);
                    }
                    typedArrayObtainAttributes.recycle();
                } else {
                    continue;
                }
            }
            eventType = xmlPullParser.next();
        }
        C2525 c25252 = this.f7913;
        if (c25252.f7920 == null) {
            c25252.f7920 = new AnimatorSet();
        }
        c25252.f7920.playTogether(c25252.f7921);
    }

    @Override // android.graphics.drawable.Drawable
    public boolean isAutoMirrored() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.isAutoMirrored() : this.f7913.f7919.isAutoMirrored();
    }

    @Override // android.graphics.drawable.Animatable
    public boolean isRunning() {
        Drawable drawable = this.f7926;
        return drawable != null ? ((AnimatedVectorDrawable) drawable).isRunning() : this.f7913.f7920.isRunning();
    }

    @Override // android.graphics.drawable.Drawable
    public boolean isStateful() {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.isStateful() : this.f7913.f7919.isStateful();
    }

    @Override // android.graphics.drawable.Drawable
    public Drawable mutate() {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.mutate();
        }
        return this;
    }

    @Override // android.graphics.drawable.Drawable
    public void onBoundsChange(Rect rect) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.setBounds(rect);
        } else {
            this.f7913.f7919.setBounds(rect);
        }
    }

    @Override // p037.p119.p120.p121.AbstractC2529, android.graphics.drawable.Drawable
    public boolean onLevelChange(int i) {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.setLevel(i) : this.f7913.f7919.setLevel(i);
    }

    @Override // android.graphics.drawable.Drawable
    public boolean onStateChange(int[] iArr) {
        Drawable drawable = this.f7926;
        return drawable != null ? drawable.setState(iArr) : this.f7913.f7919.setState(iArr);
    }

    @Override // android.graphics.drawable.Drawable
    public void setAlpha(int i) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.setAlpha(i);
        } else {
            this.f7913.f7919.setAlpha(i);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void setAutoMirrored(boolean z) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.setAutoMirrored(z);
            return;
        }
        C2530 c2530 = this.f7913.f7919;
        Drawable drawable2 = c2530.f7926;
        if (drawable2 != null) {
            drawable2.setAutoMirrored(z);
        } else {
            c2530.f7928.f7986 = z;
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void setColorFilter(ColorFilter colorFilter) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            drawable.setColorFilter(colorFilter);
            return;
        }
        C2530 c2530 = this.f7913.f7919;
        Drawable drawable2 = c2530.f7926;
        if (drawable2 != null) {
            drawable2.setColorFilter(colorFilter);
        } else {
            c2530.f7930 = colorFilter;
            c2530.invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void setTint(int i) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            LayoutInflaterFactory2C1494.C1505.m2939(drawable, i);
        } else {
            this.f7913.f7919.setTint(i);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void setTintList(ColorStateList colorStateList) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            LayoutInflaterFactory2C1494.C1505.m2940(drawable, colorStateList);
        } else {
            this.f7913.f7919.setTintList(colorStateList);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public void setTintMode(PorterDuff.Mode mode) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            LayoutInflaterFactory2C1494.C1505.m2941(drawable, mode);
        } else {
            this.f7913.f7919.setTintMode(mode);
        }
    }

    @Override // android.graphics.drawable.Drawable
    public boolean setVisible(boolean z, boolean z2) {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            return drawable.setVisible(z, z2);
        }
        this.f7913.f7919.setVisible(z, z2);
        return super.setVisible(z, z2);
    }

    @Override // android.graphics.drawable.Animatable
    public void start() {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).start();
        } else {
            if (this.f7913.f7920.isStarted()) {
                return;
            }
            this.f7913.f7920.start();
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Animatable
    public void stop() {
        Drawable drawable = this.f7926;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).stop();
        } else {
            this.f7913.f7920.end();
        }
    }
}
