Loading core/java/android/content/Context.java +1 −1 Original line number Diff line number Diff line Loading @@ -621,7 +621,7 @@ public abstract class Context { * @throws android.content.res.Resources.NotFoundException if the given ID * does not exist. */ @NonNull @Nullable public final Drawable getDrawable(@DrawableRes int id) { return getResources().getDrawable(id, getTheme()); } Loading core/java/android/content/res/Resources.java +5 −3 Original line number Diff line number Diff line Loading @@ -847,6 +847,7 @@ public class Resources { * @see #getDrawableForDensity(int, int, Theme) * @deprecated Use {@link #getDrawableForDensity(int, int, Theme)} instead. */ @Nullable @Deprecated public Drawable getDrawableForDensity(@DrawableRes int id, int density) throws NotFoundException { Loading @@ -864,12 +865,13 @@ public class Resources { * found in {@link DisplayMetrics}. A value of 0 means to use the * density returned from {@link #getConfiguration()}. * This is equivalent to calling {@link #getDrawable(int, Theme)}. * @param theme The theme used to style the drawable attributes, may be {@code null}. * @param theme The theme used to style the drawable attributes, may be {@code null} if the * drawable cannot be decoded. * @return Drawable An object that can be used to draw this resource. * @throws NotFoundException Throws NotFoundException if the given ID does * not exist, or cannot be decoded. * not exist. */ @NonNull @Nullable public Drawable getDrawableForDensity(@DrawableRes int id, int density, @Nullable Theme theme) { final TypedValue value = obtainTempTypedValue(); try { Loading core/java/android/content/res/ResourcesImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -544,7 +544,7 @@ public class ResourcesImpl { } } @NonNull @Nullable Drawable loadDrawable(@NonNull Resources wrapper, @NonNull TypedValue value, int id, int density, @Nullable Resources.Theme theme) throws NotFoundException { Loading Loading @@ -757,6 +757,7 @@ public class ResourcesImpl { * * This call will handle closing ais. */ @Nullable private Drawable decodeImageDrawable(@NonNull AssetInputStream ais, @NonNull Resources wrapper, @NonNull TypedValue value) { ImageDecoder.Source src = new ImageDecoder.AssetInputStreamSource(ais, Loading @@ -774,8 +775,10 @@ public class ResourcesImpl { /** * Loads a drawable from XML or resources stream. * * @return Drawable, or null if Drawable cannot be decoded. */ @NonNull @Nullable private Drawable loadDrawableForCookie(@NonNull Resources wrapper, @NonNull TypedValue value, int id, int density) { if (value.string == null) { Loading Loading
core/java/android/content/Context.java +1 −1 Original line number Diff line number Diff line Loading @@ -621,7 +621,7 @@ public abstract class Context { * @throws android.content.res.Resources.NotFoundException if the given ID * does not exist. */ @NonNull @Nullable public final Drawable getDrawable(@DrawableRes int id) { return getResources().getDrawable(id, getTheme()); } Loading
core/java/android/content/res/Resources.java +5 −3 Original line number Diff line number Diff line Loading @@ -847,6 +847,7 @@ public class Resources { * @see #getDrawableForDensity(int, int, Theme) * @deprecated Use {@link #getDrawableForDensity(int, int, Theme)} instead. */ @Nullable @Deprecated public Drawable getDrawableForDensity(@DrawableRes int id, int density) throws NotFoundException { Loading @@ -864,12 +865,13 @@ public class Resources { * found in {@link DisplayMetrics}. A value of 0 means to use the * density returned from {@link #getConfiguration()}. * This is equivalent to calling {@link #getDrawable(int, Theme)}. * @param theme The theme used to style the drawable attributes, may be {@code null}. * @param theme The theme used to style the drawable attributes, may be {@code null} if the * drawable cannot be decoded. * @return Drawable An object that can be used to draw this resource. * @throws NotFoundException Throws NotFoundException if the given ID does * not exist, or cannot be decoded. * not exist. */ @NonNull @Nullable public Drawable getDrawableForDensity(@DrawableRes int id, int density, @Nullable Theme theme) { final TypedValue value = obtainTempTypedValue(); try { Loading
core/java/android/content/res/ResourcesImpl.java +5 −2 Original line number Diff line number Diff line Loading @@ -544,7 +544,7 @@ public class ResourcesImpl { } } @NonNull @Nullable Drawable loadDrawable(@NonNull Resources wrapper, @NonNull TypedValue value, int id, int density, @Nullable Resources.Theme theme) throws NotFoundException { Loading Loading @@ -757,6 +757,7 @@ public class ResourcesImpl { * * This call will handle closing ais. */ @Nullable private Drawable decodeImageDrawable(@NonNull AssetInputStream ais, @NonNull Resources wrapper, @NonNull TypedValue value) { ImageDecoder.Source src = new ImageDecoder.AssetInputStreamSource(ais, Loading @@ -774,8 +775,10 @@ public class ResourcesImpl { /** * Loads a drawable from XML or resources stream. * * @return Drawable, or null if Drawable cannot be decoded. */ @NonNull @Nullable private Drawable loadDrawableForCookie(@NonNull Resources wrapper, @NonNull TypedValue value, int id, int density) { if (value.string == null) { Loading