Package com.my.target.common.models
Class ImageData
- java.lang.Object
-
- MediaData<android.graphics.Bitmap>
-
- com.my.target.common.models.ImageData
-
public final class ImageData extends MediaData<android.graphics.Bitmap>Data class for image content
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearCache()Clears in-memory cachebooleanequals(java.lang.Object object)android.graphics.BitmapgetBitmap()Image bitmap, null if not loaded yetandroid.graphics.BitmapgetData()booleanisUseCache()Memory cache is disabled by default, bitmaps saves with strong link, but it is possible to turn in on withuseCache(boolean)methodstatic ImageDatanewImageData(java.lang.String url)static ImageDatanewImageData(java.lang.String url, int width, int height)voidsetBitmap(android.graphics.Bitmap bitmap)static voidsetCacheSize(int sizeInBytes)Maximum in-memory cache size for images.voidsetData(android.graphics.Bitmap data)java.lang.StringtoString()voiduseCache(boolean use)By default, memory cache for images is disabled and bitmaps keeps by strong link.
-
-
-
Method Detail
-
setCacheSize
@AnyThread 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
@AnyThread public static void clearCache()
Clears in-memory cache
-
newImageData
@NonNull public static ImageData newImageData(@NonNull java.lang.String url)
-
newImageData
@NonNull public static ImageData newImageData(@NonNull java.lang.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 withuseCache(boolean)method- Returns:
- is image using memory cache or not
-
getBitmap
@Nullable public android.graphics.Bitmap getBitmap()
Image bitmap, null if not loaded yet- Returns:
- image bitmap
-
setBitmap
public void setBitmap(@Nullable android.graphics.Bitmap bitmap)
-
setData
public void setData(@Nullable android.graphics.Bitmap data)
-
getData
@Nullable public android.graphics.Bitmap getData()
-
equals
public boolean equals(@Nullable java.lang.Object 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 withsetCacheSize(int)- Parameters:
use- should this ImageData use memory cache or not
-
toString
@NonNull public java.lang.String toString()
-
-