Class ImageData

java.lang.Object
com.my.target.common.models.ImageData

public final class ImageData extends Object
Data class for image content
  • Method Details

    • setCacheSize

      public static void setCacheSize(int sizeInBytes)
      Maximum in-memory cache size for images. Minimum size is 5 MiB, values less will be ignored. Default cache size is 30 MiB
      Parameters:
      sizeInBytes - cache size in bytes
    • clearCache

      public static void clearCache()
      Clears in-memory cache
    • newImageData

      public static ImageData newImageData(String url)
    • newImageData

      public static ImageData newImageData(String url, int width, int height)
    • isUseCache

      public boolean isUseCache()
      Memory cache is disabled by default, bitmaps saves with strong link, but it is possible to turn in on with ImageData#useCache(boolean) method
      Returns:
      is image using memory cache or not
    • getBitmap

      public android.graphics.Bitmap getBitmap()
      Image bitmap, null if not loaded yet
      Returns:
      image bitmap
    • setBitmap

      public void setBitmap(android.graphics.Bitmap bitmap)
    • getData

      public android.graphics.Bitmap getData()
    • setData

      public void setData(android.graphics.Bitmap data)
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • useCache

      public void useCache(boolean use)
      By default, memory cache for images is disabled and bitmaps keeps by strong link. It is possible to turn on memory cache for image, regulated by system. Size of cache can be defined with ImageData#setCacheSize(int)
      Parameters:
      use - should this ImageData use memory cache or not
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getUrl

      public String getUrl()
    • getHeight

      public int getHeight()
    • getWidth

      public int getWidth()
    • setWidth

      public void setWidth(int width)
    • setHeight

      public void setHeight(int height)