From 613989772f7d7f7317349568a4809bf08b942bd7 Mon Sep 17 00:00:00 2001 From: Dianne Hackborn Date: Mon, 9 Jan 2012 12:00:30 -0800 Subject: [PATCH] Unhide Resources APIs for getting resources at specific densities. This adds Resources.getDrawableForDensity() and Resources.getValueForDensity(). These are needed for applications to correctly retrieve larger icons such as in launcher when running on a tablet. We had already exposed the APIs to tell the application which density to use for app icons on the current device, but didn't unhide these APIs that allowed you to actually retrieve them. This is safe to do without introducing a new API level (as long as we do it soon) because we know these APIs already exist in Android 4.0, and there is no reason for anyone to be removing them when building a device. Change-Id: I5138e5dc908197b66a98d20af73c5374cb5d41d3 --- api/15.txt | 2 ++ api/current.txt | 2 ++ core/java/android/content/res/Resources.java | 2 -- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/api/15.txt b/api/15.txt index ddf5baf30ff9d..68fb4bc0e7d49 100644 --- a/api/15.txt +++ b/api/15.txt @@ -6611,6 +6611,7 @@ package android.content.res { method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException; method public android.util.DisplayMetrics getDisplayMetrics(); method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException; + method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException; method public float getFraction(int, int, int); method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String); method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException; @@ -6633,6 +6634,7 @@ package android.content.res { method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException; method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; + method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException; method public final android.content.res.Resources.Theme newTheme(); method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]); diff --git a/api/current.txt b/api/current.txt index ddf5baf30ff9d..68fb4bc0e7d49 100644 --- a/api/current.txt +++ b/api/current.txt @@ -6611,6 +6611,7 @@ package android.content.res { method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException; method public android.util.DisplayMetrics getDisplayMetrics(); method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException; + method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException; method public float getFraction(int, int, int); method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String); method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException; @@ -6633,6 +6634,7 @@ package android.content.res { method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException; method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; + method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException; method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException; method public final android.content.res.Resources.Theme newTheme(); method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]); diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java index 4f190108971cc..b6b6a8d8d1c10 100755 --- a/core/java/android/content/res/Resources.java +++ b/core/java/android/content/res/Resources.java @@ -683,7 +683,6 @@ public class Resources { * @throws NotFoundException Throws NotFoundException if the given ID does * not exist. * @return Drawable An object that can be used to draw this resource. - * @hide */ public Drawable getDrawableForDensity(int id, int density) throws NotFoundException { synchronized (mTmpValue) { @@ -1032,7 +1031,6 @@ public class Resources { * @throws NotFoundException Throws NotFoundException if the given ID does * not exist. * @see #getValue(String, TypedValue, boolean) - * @hide */ public void getValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs) throws NotFoundException {