private static Drawable getDrawable(
Context ourContext, Context targetContext, @DrawableRes int id, @Nullable Theme theme) {
try {
if (shouldCallAppCompatResources) {
return loadDrawableV7(targetContext, id, theme);
}
} catch (NoClassDefFoundError error) {
shouldCallAppCompatResources = false;
} catch (IllegalStateException e) {
if (ourContext.getPackageName().equals(targetContext.getPackageName())) {
throw e;
}
return ContextCompat.getDrawable(targetContext, id);
} catch (Resources.NotFoundException e) {
}
return loadDrawableV4(targetContext, id, theme != null ? theme : targetContext.getTheme());
}