@Implements(value=android.content.res.Resources.class) public class ShadowResources extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowResources.ShadowLegacyTheme |
static class |
ShadowResources.ShadowNotFoundException |
static class |
ShadowResources.ShadowTheme |
Constructor and Description |
---|
ShadowResources() |
Modifier and Type | Method and Description |
---|---|
protected String |
getQuantityString(int resId,
int quantity) |
protected String |
getQuantityString(int id,
int quantity,
Object... formatArgs) |
protected static Resources |
getSystem() |
protected Drawable |
loadDrawable(TypedValue value,
int id) |
protected Drawable |
loadDrawable(TypedValue value,
int id,
Resources.Theme theme) |
protected XmlResourceParser |
loadXmlResourceParser(int resId,
String type) |
protected XmlResourceParser |
loadXmlResourceParser(String file,
int id,
int assetCookie,
String type) |
protected TypedArray |
obtainAttributes(AttributeSet set,
int[] attrs) |
protected TypedArray |
obtainTypedArray(int id) |
protected InputStream |
openRawResource(int id) |
protected AssetFileDescriptor |
openRawResourceFd(int id)
Since
AssetFileDescriptor s are not yet supported by Robolectric, null will be returned if the resource is found. |
static void |
reset() |
@Resetter public static void reset()
@Implementation protected static Resources getSystem()
@Implementation protected TypedArray obtainAttributes(AttributeSet set, int[] attrs)
@Implementation protected String getQuantityString(int id, int quantity, Object... formatArgs) throws Resources.NotFoundException
Resources.NotFoundException
@Implementation protected String getQuantityString(int resId, int quantity) throws Resources.NotFoundException
Resources.NotFoundException
@Implementation protected InputStream openRawResource(int id) throws Resources.NotFoundException
Resources.NotFoundException
@Implementation protected AssetFileDescriptor openRawResourceFd(int id) throws Resources.NotFoundException
Since AssetFileDescriptor
s 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.
Resources.NotFoundException
@Implementation protected TypedArray obtainTypedArray(int id) throws Resources.NotFoundException
Resources.NotFoundException
@HiddenApi @Implementation protected XmlResourceParser loadXmlResourceParser(int resId, String type) throws Resources.NotFoundException
Resources.NotFoundException
@HiddenApi @Implementation protected XmlResourceParser loadXmlResourceParser(String file, int id, int assetCookie, String type) throws Resources.NotFoundException
Resources.NotFoundException
@HiddenApi @Implementation(maxSdk=20) protected Drawable loadDrawable(TypedValue value, int id)
@Implementation(minSdk=21, maxSdk=25) protected Drawable loadDrawable(TypedValue value, int id, Resources.Theme theme) throws Resources.NotFoundException
Resources.NotFoundException