Class ShadowResources


  • @Implements(android.content.res.Resources.class)
    public class ShadowResources
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      ShadowResources()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String getQuantityString​(int resId, int quantity)  
      protected java.lang.String getQuantityString​(int id, int quantity, java.lang.Object... formatArgs)  
      protected static android.content.res.Resources getSystem()  
      protected android.graphics.drawable.Drawable loadDrawable​(android.util.TypedValue value, int id)  
      protected android.graphics.drawable.Drawable loadDrawable​(android.util.TypedValue value, int id, android.content.res.Resources.Theme theme)  
      protected android.content.res.XmlResourceParser loadXmlResourceParser​(int resId, java.lang.String type)  
      protected android.content.res.XmlResourceParser loadXmlResourceParser​(java.lang.String file, int id, int assetCookie, java.lang.String type)  
      protected android.content.res.TypedArray obtainAttributes​(android.util.AttributeSet set, int[] attrs)  
      protected android.content.res.TypedArray obtainTypedArray​(int id)  
      protected java.io.InputStream openRawResource​(int id)  
      protected 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()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ShadowResources

        public ShadowResources()
    • Method Detail

      • reset

        @Resetter
        public static void reset()
      • getSystem

        @Implementation
        protected static android.content.res.Resources getSystem()
      • obtainAttributes

        @Implementation
        protected android.content.res.TypedArray obtainAttributes​(android.util.AttributeSet set,
                                                                  int[] attrs)
      • getQuantityString

        @Implementation
        protected java.lang.String getQuantityString​(int id,
                                                     int quantity,
                                                     java.lang.Object... formatArgs)
                                              throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • getQuantityString

        @Implementation
        protected java.lang.String getQuantityString​(int resId,
                                                     int quantity)
                                              throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • openRawResource

        @Implementation
        protected java.io.InputStream openRawResource​(int id)
                                               throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • openRawResourceFd

        @Implementation
        protected 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.
        Throws:
        android.content.res.Resources.NotFoundException
      • obtainTypedArray

        @Implementation
        protected android.content.res.TypedArray obtainTypedArray​(int id)
                                                           throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • loadXmlResourceParser

        @HiddenApi
        @Implementation
        protected android.content.res.XmlResourceParser loadXmlResourceParser​(int resId,
                                                                              java.lang.String type)
                                                                       throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • loadXmlResourceParser

        @HiddenApi
        @Implementation
        protected android.content.res.XmlResourceParser loadXmlResourceParser​(java.lang.String file,
                                                                              int id,
                                                                              int assetCookie,
                                                                              java.lang.String type)
                                                                       throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException
      • loadDrawable

        @HiddenApi
        @Implementation(maxSdk=20)
        protected android.graphics.drawable.Drawable loadDrawable​(android.util.TypedValue value,
                                                                  int id)
      • loadDrawable

        @Implementation(minSdk=21,
                        maxSdk=25)
        protected android.graphics.drawable.Drawable loadDrawable​(android.util.TypedValue value,
                                                                  int id,
                                                                  android.content.res.Resources.Theme theme)
                                                           throws android.content.res.Resources.NotFoundException
        Throws:
        android.content.res.Resources.NotFoundException