Package org.robolectric.shadows
Class ShadowResources
java.lang.Object
org.robolectric.shadows.ShadowResources
Shadow of
Resources
.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Listener callback that's called when the configuration is updated for a resources.static class
Shadow forResources.NotFoundException
. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Add a listener to observe resource configuration changes.static int
Returns the layout resource id the attribute set was inflated from.protected static Resources
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) void
Remove a listener to observe resource configuration changes.static void
reset()
protected void
updateConfiguration
(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat)
-
Constructor Details
-
ShadowResources
public ShadowResources()
-
-
Method Details
-
reset
-
getSystem
-
loadXmlResourceParser
@HiddenApi @Implementation protected XmlResourceParser loadXmlResourceParser(int resId, String type) throws Resources.NotFoundException - Throws:
Resources.NotFoundException
-
loadXmlResourceParser
@HiddenApi @Implementation protected XmlResourceParser loadXmlResourceParser(String file, int id, int assetCookie, String type) throws Resources.NotFoundException - Throws:
Resources.NotFoundException
-
loadDrawable
@Implementation(maxSdk=25) protected Drawable loadDrawable(TypedValue value, int id, Resources.Theme theme) throws Resources.NotFoundException - Throws:
Resources.NotFoundException
-
getAttributeSetSourceResId
Returns the layout resource id the attribute set was inflated from. Backwards compatible version ofResources.getAttributeSetSourceResId(AttributeSet)
, passes through to the underlying implementation on API levels where it is supported. -
addConfigurationChangeListener
Add a listener to observe resource configuration changes. SeeShadowResources.OnConfigurationChangeListener
. -
removeConfigurationChangeListener
public void removeConfigurationChangeListener(ShadowResources.OnConfigurationChangeListener listener) Remove a listener to observe resource configuration changes. SeeShadowResources.OnConfigurationChangeListener
. -
updateConfiguration
@Implementation protected void updateConfiguration(Configuration config, DisplayMetrics metrics, CompatibilityInfo compat)
-