package ῲ.ῲ.㴹;

import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Shader;
import android.graphics.drawable.AnimationDrawable;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.ClipDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.LayerDrawable;
import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.RoundRectShape;
import android.util.AttributeSet;
import android.widget.ProgressBar;
import ῲ.ᨨ.ʬ.ᕣ.AbstractC1712;
import ῲ.ᨨ.ʬ.ᕣ.C1710;

/* renamed from: ῲ.ῲ.㴹.ᨨ  reason: contains not printable characters */
/* compiled from: AppCompatProgressBarHelper */
public class C2024 {

    /* renamed from: ʬ  reason: contains not printable characters */
    public static final int[] f6855 = {16843067, 16843068};

    /* renamed from: ῲ  reason: contains not printable characters */
    public Bitmap f6856;

    /* renamed from: K  reason: contains not printable characters */
    public final ProgressBar f6857;

    public C2024(ProgressBar progressBar) {
        this.f6857 = progressBar;
    }

    /* renamed from: K  reason: contains not printable characters */
    public void m5247(AttributeSet attributeSet, int i) {
        C2019 r9 = C2019.m5223(this.f6857.getContext(), attributeSet, f6855, i, 0);
        Drawable r10 = r9.m5225(0);
        if (r10 != null) {
            ProgressBar progressBar = this.f6857;
            if (r10 instanceof AnimationDrawable) {
                AnimationDrawable animationDrawable = (AnimationDrawable) r10;
                int numberOfFrames = animationDrawable.getNumberOfFrames();
                AnimationDrawable animationDrawable2 = new AnimationDrawable();
                animationDrawable2.setOneShot(animationDrawable.isOneShot());
                for (int i2 = 0; i2 < numberOfFrames; i2++) {
                    Drawable r7 = m5246(animationDrawable.getFrame(i2), true);
                    r7.setLevel(10000);
                    animationDrawable2.addFrame(r7, animationDrawable.getDuration(i2));
                }
                animationDrawable2.setLevel(10000);
                r10 = animationDrawable2;
            }
            progressBar.setIndeterminateDrawable(r10);
        }
        Drawable r102 = r9.m5225(1);
        if (r102 != null) {
            this.f6857.setProgressDrawable(m5246(r102, false));
        }
        r9.f6846.recycle();
    }

    /* renamed from: K  reason: contains not printable characters */
    public final Drawable m5246(Drawable drawable, boolean z) {
        if (drawable instanceof AbstractC1712) {
            C1710 r0 = (C1710) drawable;
            Drawable drawable2 = r0.f6010;
            if (drawable2 == null) {
                return drawable;
            }
            r0.m4385(m5246(drawable2, z));
            return drawable;
        } else if (drawable instanceof LayerDrawable) {
            LayerDrawable layerDrawable = (LayerDrawable) drawable;
            int numberOfLayers = layerDrawable.getNumberOfLayers();
            Drawable[] drawableArr = new Drawable[numberOfLayers];
            for (int i = 0; i < numberOfLayers; i++) {
                int id = layerDrawable.getId(i);
                drawableArr[i] = m5246(layerDrawable.getDrawable(i), id == 16908301 || id == 16908303);
            }
            LayerDrawable layerDrawable2 = new LayerDrawable(drawableArr);
            for (int i2 = 0; i2 < numberOfLayers; i2++) {
                layerDrawable2.setId(i2, layerDrawable.getId(i2));
            }
            return layerDrawable2;
        } else if (!(drawable instanceof BitmapDrawable)) {
            return drawable;
        } else {
            BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable;
            Bitmap bitmap = bitmapDrawable.getBitmap();
            if (this.f6856 == null) {
                this.f6856 = bitmap;
            }
            ShapeDrawable shapeDrawable = new ShapeDrawable(new RoundRectShape(new float[]{5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f}, null, null));
            shapeDrawable.getPaint().setShader(new BitmapShader(bitmap, Shader.TileMode.REPEAT, Shader.TileMode.CLAMP));
            shapeDrawable.getPaint().setColorFilter(bitmapDrawable.getPaint().getColorFilter());
            return z ? new ClipDrawable(shapeDrawable, 3, 1) : shapeDrawable;
        }
    }
}
