package com.bumptech.glide.load.resource.drawable; import android.content.Context; import android.content.res.Resources; import android.graphics.drawable.Drawable; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.view.ContextThemeWrapper; import androidx.core.content.ContextCompat; import androidx.core.content.res.ResourcesCompat; /* loaded from: classes.dex */ public final class DrawableDecoderCompat { private static volatile boolean a = true; public static Drawable a(Context context, Context context2, int i) { return a(context, context2, i, null); } private static Drawable b(Context context, int i, Resources.Theme theme) { return ResourcesCompat.a(context.getResources(), i, theme); } private static Drawable c(Context context, int i, Resources.Theme theme) { if (theme != null) { context = new ContextThemeWrapper(context, theme); } return AppCompatResources.c(context, i); } public static Drawable a(Context context, int i, Resources.Theme theme) { return a(context, context, i, theme); } private static Drawable a(Context context, Context context2, int i, Resources.Theme theme) { try { if (a) { return c(context2, i, theme); } } catch (Resources.NotFoundException unused) { } catch (IllegalStateException e) { if (!context.getPackageName().equals(context2.getPackageName())) { return ContextCompat.c(context2, i); } throw e; } catch (NoClassDefFoundError unused2) { a = false; } if (theme == null) { theme = context2.getTheme(); } return b(context2, i, theme); } }