Skip to content

Commit 6139897

Browse files
author
Dianne Hackborn
committed
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
1 parent 7944704 commit 6139897

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

api/15.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6611,6 +6611,7 @@ package android.content.res {
66116611
method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
66126612
method public android.util.DisplayMetrics getDisplayMetrics();
66136613
method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
6614+
method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
66146615
method public float getFraction(int, int, int);
66156616
method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
66166617
method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6633,6 +6634,7 @@ package android.content.res {
66336634
method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
66346635
method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
66356636
method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
6637+
method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
66366638
method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
66376639
method public final android.content.res.Resources.Theme newTheme();
66386640
method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);

api/current.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6611,6 +6611,7 @@ package android.content.res {
66116611
method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
66126612
method public android.util.DisplayMetrics getDisplayMetrics();
66136613
method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
6614+
method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
66146615
method public float getFraction(int, int, int);
66156616
method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
66166617
method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6633,6 +6634,7 @@ package android.content.res {
66336634
method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
66346635
method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
66356636
method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
6637+
method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
66366638
method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
66376639
method public final android.content.res.Resources.Theme newTheme();
66386640
method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);

core/java/android/content/res/Resources.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,6 @@ public Drawable getDrawable(int id) throws NotFoundException {
683683
* @throws NotFoundException Throws NotFoundException if the given ID does
684684
* not exist.
685685
* @return Drawable An object that can be used to draw this resource.
686-
* @hide
687686
*/
688687
public Drawable getDrawableForDensity(int id, int density) throws NotFoundException {
689688
synchronized (mTmpValue) {
@@ -1032,7 +1031,6 @@ public void getValue(int id, TypedValue outValue, boolean resolveRefs)
10321031
* @throws NotFoundException Throws NotFoundException if the given ID does
10331032
* not exist.
10341033
* @see #getValue(String, TypedValue, boolean)
1035-
* @hide
10361034
*/
10371035
public void getValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs)
10381036
throws NotFoundException {

0 commit comments

Comments
 (0)