@Implements(value=android.content.res.Resources.class)
public class ShadowResources
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
ShadowResources.ShadowNotFoundException |
static class |
ShadowResources.ShadowTheme |
| Constructor and Description |
|---|
ShadowResources() |
| Modifier and Type | Method and Description |
|---|---|
java.lang.String |
getQuantityString(int resId,
int quantity) |
java.lang.String |
getQuantityString(int id,
int quantity,
java.lang.Object... formatArgs) |
static android.content.res.Resources |
getSystem() |
android.graphics.drawable.Drawable |
loadDrawable(android.util.TypedValue value,
int id) |
android.graphics.drawable.Drawable |
loadDrawable(android.util.TypedValue value,
int id,
android.content.res.Resources.Theme theme) |
android.content.res.XmlResourceParser |
loadXmlResourceParser(int resId,
java.lang.String type) |
android.content.res.XmlResourceParser |
loadXmlResourceParser(java.lang.String file,
int id,
int assetCookie,
java.lang.String type) |
android.content.res.TypedArray |
obtainAttributes(android.util.AttributeSet set,
int[] attrs) |
android.content.res.TypedArray |
obtainTypedArray(int id) |
java.io.InputStream |
openRawResource(int id) |
android.content.res.AssetFileDescriptor |
openRawResourceFd(int id)
Since
AssetFileDescriptors are not yet supported by Robolectric, null will be returned if the resource is found. |
static void |
reset() |
void |
setDensity(float density)
Deprecated.
Set screen density using
Config.qualifiers() instead. |
void |
setDisplay(android.view.Display display)
Deprecated.
Set up display using
Config.qualifiers() instead. |
void |
setScaledDensity(float scaledDensity)
Deprecated.
Set screen density using
Config.qualifiers() instead. |
@Resetter public static void reset()
@Implementation public static android.content.res.Resources getSystem()
@Implementation
public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet set,
int[] attrs)
@Implementation
public java.lang.String getQuantityString(int id,
int quantity,
java.lang.Object... formatArgs)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@Implementation
public java.lang.String getQuantityString(int resId,
int quantity)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@Implementation
public java.io.InputStream openRawResource(int id)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@Implementation
public android.content.res.AssetFileDescriptor openRawResourceFd(int id)
throws android.content.res.Resources.NotFoundException
Since AssetFileDescriptors are not yet supported by Robolectric, null will be returned if the resource is found. If the resource cannot be found, Resources.NotFoundException will be thrown.
android.content.res.Resources.NotFoundException@Implementation
public android.content.res.TypedArray obtainTypedArray(int id)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@Deprecated public void setDensity(float density)
Config.qualifiers() instead.@Deprecated public void setScaledDensity(float scaledDensity)
Config.qualifiers() instead.@Deprecated public void setDisplay(android.view.Display display)
Config.qualifiers() instead.@HiddenApi
@Implementation
public android.content.res.XmlResourceParser loadXmlResourceParser(int resId,
java.lang.String type)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@HiddenApi
@Implementation
public android.content.res.XmlResourceParser loadXmlResourceParser(java.lang.String file,
int id,
int assetCookie,
java.lang.String type)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException@HiddenApi
@Implementation
public android.graphics.drawable.Drawable loadDrawable(android.util.TypedValue value,
int id)
@Implementation
public android.graphics.drawable.Drawable loadDrawable(android.util.TypedValue value,
int id,
android.content.res.Resources.Theme theme)
throws android.content.res.Resources.NotFoundException
android.content.res.Resources.NotFoundException