package p072y0;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.ColorStateList;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.PorterDuff;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.drawable.Animatable;
import android.graphics.drawable.AnimatedVectorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.util.AttributeSet;
import java.util.ArrayList;
import org.xmlpull.v1.XmlPullParser;
import p001a0.C0012f;
import p037m.C1444a;
import p071y.C1838q;

/* renamed from: y0.e */
/* loaded from: classes.dex */
public class C1844e extends AbstractC1854k implements Animatable {

    /* renamed from: e */
    public C1846b f4591e;

    /* renamed from: f */
    public Context f4592f;

    /* renamed from: g */
    public ArgbEvaluator f4593g;

    /* renamed from: h */
    public Animator.AnimatorListener f4594h;

    /* renamed from: i */
    public ArrayList<Object> f4595i;

    /* renamed from: j */
    public final Drawable.Callback f4596j;

    /* renamed from: y0.e$a */
    /* loaded from: classes.dex */
    public class C1845a implements Drawable.Callback {
        public C1845a() {
        }

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

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

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

    /* renamed from: y0.e$b */
    /* loaded from: classes.dex */
    public static class C1846b extends Drawable.ConstantState {

        /* renamed from: a */
        public int f4598a;

        /* renamed from: b */
        public C1855l f4599b;

        /* renamed from: c */
        public AnimatorSet f4600c;

        /* renamed from: d */
        public ArrayList<Animator> f4601d;

        /* renamed from: e */
        public C1444a<Animator, String> f4602e;

        public C1846b(Context context, C1846b c1846b, Drawable.Callback callback, Resources resources) {
            if (c1846b != null) {
                this.f4598a = c1846b.f4598a;
                C1855l c1855l = c1846b.f4599b;
                if (c1855l != null) {
                    Drawable.ConstantState constantState = c1855l.getConstantState();
                    this.f4599b = (C1855l) (resources != null ? constantState.newDrawable(resources) : constantState.newDrawable());
                    C1855l c1855l2 = (C1855l) this.f4599b.mutate();
                    this.f4599b = c1855l2;
                    c1855l2.setCallback(callback);
                    this.f4599b.setBounds(c1846b.f4599b.getBounds());
                    this.f4599b.m193h(false);
                }
                ArrayList<Animator> arrayList = c1846b.f4601d;
                if (arrayList != null) {
                    int size = arrayList.size();
                    this.f4601d = new ArrayList<>(size);
                    this.f4602e = new C1444a<>(size);
                    for (int i = 0; i < size; i++) {
                        Animator animator = c1846b.f4601d.get(i);
                        Animator clone = animator.clone();
                        String str = c1846b.f4602e.get(animator);
                        clone.setTarget(this.f4599b.m197d(str));
                        this.f4601d.add(clone);
                        this.f4602e.put(clone, str);
                    }
                    m229a();
                }
            }
        }

        /* renamed from: a */
        public void m229a() {
            if (this.f4600c == null) {
                this.f4600c = new AnimatorSet();
            }
            this.f4600c.playTogether(this.f4601d);
        }

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

        @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.");
        }
    }

    /* renamed from: y0.e$c */
    /* loaded from: classes.dex */
    public static class C1847c extends Drawable.ConstantState {

        /* renamed from: a */
        public final Drawable.ConstantState f4603a;

        public C1847c(Drawable.ConstantState constantState) {
            this.f4603a = constantState;
        }

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

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

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable() {
            C1844e c1844e = new C1844e();
            Drawable newDrawable = this.f4603a.newDrawable();
            c1844e.f4608d = newDrawable;
            newDrawable.setCallback(c1844e.f4596j);
            return c1844e;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources) {
            C1844e c1844e = new C1844e();
            Drawable newDrawable = this.f4603a.newDrawable(resources);
            c1844e.f4608d = newDrawable;
            newDrawable.setCallback(c1844e.f4596j);
            return c1844e;
        }

        @Override // android.graphics.drawable.Drawable.ConstantState
        public Drawable newDrawable(Resources resources, Resources.Theme theme) {
            Drawable newDrawable;
            C1844e c1844e = new C1844e();
            newDrawable = this.f4603a.newDrawable(resources, theme);
            c1844e.f4608d = newDrawable;
            newDrawable.setCallback(c1844e.f4596j);
            return c1844e;
        }
    }

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

    public C1844e(Context context) {
        this(context, null, null);
    }

    public C1844e(Context context, C1846b c1846b, Resources resources) {
        this.f4593g = null;
        this.f4594h = null;
        this.f4595i = null;
        C1845a c1845a = new C1845a();
        this.f4596j = c1845a;
        this.f4592f = context;
        if (c1846b != null) {
            this.f4591e = c1846b;
        } else {
            this.f4591e = new C1846b(context, c1846b, c1845a, resources);
        }
    }

    /* renamed from: a */
    public static C1844e m232a(Context context, Resources resources, XmlPullParser xmlPullParser, AttributeSet attributeSet, Resources.Theme theme) {
        C1844e c1844e = new C1844e(context);
        c1844e.inflate(resources, xmlPullParser, attributeSet, theme);
        return c1844e;
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public void applyTheme(Resources.Theme theme) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5098a(drawable, theme);
        }
    }

    /* renamed from: b */
    public final void m231b(String str, Animator animator) {
        animator.setTarget(this.f4591e.f4599b.m197d(str));
        if (Build.VERSION.SDK_INT < 21) {
            m230c(animator);
        }
        C1846b c1846b = this.f4591e;
        if (c1846b.f4601d == null) {
            c1846b.f4601d = new ArrayList<>();
            this.f4591e.f4602e = new C1444a<>();
        }
        this.f4591e.f4601d.add(animator);
        this.f4591e.f4602e.put(animator, str);
    }

    /* renamed from: c */
    public final void m230c(Animator animator) {
        ArrayList<Animator> childAnimations;
        if ((animator instanceof AnimatorSet) && (childAnimations = ((AnimatorSet) animator).getChildAnimations()) != null) {
            for (int i = 0; i < childAnimations.size(); i++) {
                m230c(childAnimations.get(i));
            }
        }
        if (animator instanceof ObjectAnimator) {
            ObjectAnimator objectAnimator = (ObjectAnimator) animator;
            String propertyName = objectAnimator.getPropertyName();
            if ("fillColor".equals(propertyName) || "strokeColor".equals(propertyName)) {
                if (this.f4593g == null) {
                    this.f4593g = new ArgbEvaluator();
                }
                objectAnimator.setEvaluator(this.f4593g);
            }
        }
    }

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

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void clearColorFilter() {
        super.clearColorFilter();
    }

    @Override // android.graphics.drawable.Drawable
    public void draw(Canvas canvas) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            drawable.draw(canvas);
            return;
        }
        this.f4591e.f4599b.draw(canvas);
        if (this.f4591e.f4600c.isStarted()) {
            invalidateSelf();
        }
    }

    @Override // android.graphics.drawable.Drawable
    public int getAlpha() {
        Drawable drawable = this.f4608d;
        return drawable != null ? C0012f.m5096c(drawable) : this.f4591e.f4599b.getAlpha();
    }

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

    @Override // android.graphics.drawable.Drawable
    public ColorFilter getColorFilter() {
        Drawable drawable = this.f4608d;
        return drawable != null ? C0012f.m5095d(drawable) : this.f4591e.f4599b.getColorFilter();
    }

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

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ Drawable getCurrent() {
        return super.getCurrent();
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicHeight() {
        Drawable drawable = this.f4608d;
        return drawable != null ? drawable.getIntrinsicHeight() : this.f4591e.f4599b.getIntrinsicHeight();
    }

    @Override // android.graphics.drawable.Drawable
    public int getIntrinsicWidth() {
        Drawable drawable = this.f4608d;
        return drawable != null ? drawable.getIntrinsicWidth() : this.f4591e.f4599b.getIntrinsicWidth();
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ int getMinimumHeight() {
        return super.getMinimumHeight();
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ int getMinimumWidth() {
        return super.getMinimumWidth();
    }

    @Override // android.graphics.drawable.Drawable
    public int getOpacity() {
        Drawable drawable = this.f4608d;
        return drawable != null ? drawable.getOpacity() : this.f4591e.f4599b.getOpacity();
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ boolean getPadding(Rect rect) {
        return super.getPadding(rect);
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ int[] getState() {
        return super.getState();
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ Region getTransparentRegion() {
        return super.getTransparentRegion();
    }

    @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) {
        TypedArray obtainAttributes;
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5093f(drawable, resources, xmlPullParser, attributeSet, theme);
            return;
        }
        int eventType = xmlPullParser.getEventType();
        int depth = xmlPullParser.getDepth() + 1;
        while (eventType != 1 && (xmlPullParser.getDepth() >= depth || eventType != 3)) {
            if (eventType == 2) {
                String name = xmlPullParser.getName();
                if ("animated-vector".equals(name)) {
                    obtainAttributes = C1838q.m248k(resources, theme, attributeSet, C1840a.f4583e);
                    int resourceId = obtainAttributes.getResourceId(0, 0);
                    if (resourceId != 0) {
                        C1855l m199b = C1855l.m199b(resources, resourceId, theme);
                        m199b.m193h(false);
                        m199b.setCallback(this.f4596j);
                        C1855l c1855l = this.f4591e.f4599b;
                        if (c1855l != null) {
                            c1855l.setCallback(null);
                        }
                        this.f4591e.f4599b = m199b;
                    }
                } else if ("target".equals(name)) {
                    obtainAttributes = resources.obtainAttributes(attributeSet, C1840a.f4584f);
                    String string = obtainAttributes.getString(0);
                    int resourceId2 = obtainAttributes.getResourceId(1, 0);
                    if (resourceId2 != 0) {
                        Context context = this.f4592f;
                        if (context == null) {
                            obtainAttributes.recycle();
                            throw new IllegalStateException("Context can't be null when inflating animators");
                        }
                        m231b(string, C1850h.m217i(context, resourceId2));
                    }
                } else {
                    continue;
                }
                obtainAttributes.recycle();
            }
            eventType = xmlPullParser.next();
        }
        this.f4591e.m229a();
    }

    @Override // android.graphics.drawable.Drawable
    public boolean isAutoMirrored() {
        Drawable drawable = this.f4608d;
        return drawable != null ? C0012f.m5092g(drawable) : this.f4591e.f4599b.isAutoMirrored();
    }

    @Override // android.graphics.drawable.Animatable
    public boolean isRunning() {
        boolean isRunning;
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            isRunning = ((AnimatedVectorDrawable) drawable).isRunning();
            return isRunning;
        }
        return this.f4591e.f4600c.isRunning();
    }

    @Override // android.graphics.drawable.Drawable
    public boolean isStateful() {
        Drawable drawable = this.f4608d;
        return drawable != null ? drawable.isStateful() : this.f4591e.f4599b.isStateful();
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void jumpToCurrentState() {
        super.jumpToCurrentState();
    }

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

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

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public boolean onLevelChange(int i) {
        Drawable drawable = this.f4608d;
        return drawable != null ? drawable.setLevel(i) : this.f4591e.f4599b.setLevel(i);
    }

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

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

    @Override // android.graphics.drawable.Drawable
    public void setAutoMirrored(boolean z) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5090i(drawable, z);
        } else {
            this.f4591e.f4599b.setAutoMirrored(z);
        }
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void setChangingConfigurations(int i) {
        super.setChangingConfigurations(i);
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void setColorFilter(int i, PorterDuff.Mode mode) {
        super.setColorFilter(i, mode);
    }

    @Override // android.graphics.drawable.Drawable
    public void setColorFilter(ColorFilter colorFilter) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            drawable.setColorFilter(colorFilter);
        } else {
            this.f4591e.f4599b.setColorFilter(colorFilter);
        }
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void setFilterBitmap(boolean z) {
        super.setFilterBitmap(z);
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void setHotspot(float f, float f2) {
        super.setHotspot(f, f2);
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ void setHotspotBounds(int i, int i2, int i3, int i4) {
        super.setHotspotBounds(i, i2, i3, i4);
    }

    @Override // p072y0.AbstractC1854k, android.graphics.drawable.Drawable
    public /* bridge */ /* synthetic */ boolean setState(int[] iArr) {
        return super.setState(iArr);
    }

    @Override // android.graphics.drawable.Drawable, p001a0.InterfaceC0009d0
    public void setTint(int i) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5086m(drawable, i);
        } else {
            this.f4591e.f4599b.setTint(i);
        }
    }

    @Override // android.graphics.drawable.Drawable, p001a0.InterfaceC0009d0
    public void setTintList(ColorStateList colorStateList) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5085n(drawable, colorStateList);
        } else {
            this.f4591e.f4599b.setTintList(colorStateList);
        }
    }

    @Override // android.graphics.drawable.Drawable, p001a0.InterfaceC0009d0
    public void setTintMode(PorterDuff.Mode mode) {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            C0012f.m5084o(drawable, mode);
        } else {
            this.f4591e.f4599b.setTintMode(mode);
        }
    }

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

    @Override // android.graphics.drawable.Animatable
    public void start() {
        Drawable drawable = this.f4608d;
        if (drawable != null) {
            ((AnimatedVectorDrawable) drawable).start();
        } else if (this.f4591e.f4600c.isStarted()) {
        } else {
            this.f4591e.f4600c.start();
            invalidateSelf();
        }
    }

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