package o; import android.content.Context; 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.graphics.drawable.shapes.Shape; import android.util.AttributeSet; import android.widget.ProgressBar; import com.huawei.hms.android.HwBuildEx; /* loaded from: classes.dex */ public class Kvu { private static final int[] c = {android.R.attr.indeterminateDrawable, android.R.attr.progressDrawable}; private Bitmap a; private final ProgressBar d; public Kvu(ProgressBar progressBar) { this.d = progressBar; } public void gK_(AttributeSet attributeSet, int i) { Context context = this.d.getContext(); C0683McA c0683McA = new C0683McA(context, context.obtainStyledAttributes(attributeSet, c, i, 0)); Drawable jM_ = c0683McA.jM_(0); if (jM_ != null) { this.d.setIndeterminateDrawable(gy_(jM_)); } Drawable jM_2 = c0683McA.jM_(1); if (jM_2 != null) { this.d.setProgressDrawable(gB_(jM_2, false)); } c0683McA.d.recycle(); } /* JADX WARN: Multi-variable type inference failed */ Drawable gB_(Drawable drawable, boolean z) { if (drawable instanceof FWR) { Drawable qm_ = ((FWR) drawable).qm_(); if (qm_ != null) { gB_(qm_, z); } } 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] = gB_(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)); IeS.gC_(layerDrawable, layerDrawable2, i2); } return layerDrawable2; } if (drawable instanceof BitmapDrawable) { BitmapDrawable bitmapDrawable = (BitmapDrawable) drawable; Bitmap bitmap = bitmapDrawable.getBitmap(); if (this.a == null) { this.a = bitmap; } ShapeDrawable shapeDrawable = new ShapeDrawable(gx_()); 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; } } return drawable; } private Drawable gy_(Drawable drawable) { if (!(drawable instanceof AnimationDrawable)) { return drawable; } AnimationDrawable animationDrawable = (AnimationDrawable) drawable; int numberOfFrames = animationDrawable.getNumberOfFrames(); AnimationDrawable animationDrawable2 = new AnimationDrawable(); animationDrawable2.setOneShot(animationDrawable.isOneShot()); for (int i = 0; i < numberOfFrames; i++) { Drawable gB_ = gB_(animationDrawable.getFrame(i), true); gB_.setLevel(HwBuildEx.VersionCodes.CUR_DEVELOPMENT); animationDrawable2.addFrame(gB_, animationDrawable.getDuration(i)); } animationDrawable2.setLevel(HwBuildEx.VersionCodes.CUR_DEVELOPMENT); return animationDrawable2; } private Shape gx_() { return new RoundRectShape(new float[]{5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f, 5.0f}, null, null); } /* JADX INFO: Access modifiers changed from: package-private */ /* loaded from: classes.dex */ public static class IeS { public static void gC_(LayerDrawable layerDrawable, LayerDrawable layerDrawable2, int i) { layerDrawable2.setLayerGravity(i, layerDrawable.getLayerGravity(i)); layerDrawable2.setLayerWidth(i, layerDrawable.getLayerWidth(i)); layerDrawable2.setLayerHeight(i, layerDrawable.getLayerHeight(i)); layerDrawable2.setLayerInsetLeft(i, layerDrawable.getLayerInsetLeft(i)); layerDrawable2.setLayerInsetRight(i, layerDrawable.getLayerInsetRight(i)); layerDrawable2.setLayerInsetTop(i, layerDrawable.getLayerInsetTop(i)); layerDrawable2.setLayerInsetBottom(i, layerDrawable.getLayerInsetBottom(i)); layerDrawable2.setLayerInsetStart(i, layerDrawable.getLayerInsetStart(i)); layerDrawable2.setLayerInsetEnd(i, layerDrawable.getLayerInsetEnd(i)); } } public Bitmap gz_() { return this.a; } }