Package com.my.target.common.models
Class ImageData
-
- All Implemented Interfaces:
public final class ImageDataData class for image content
-
-
Method Summary
Modifier and Type Method Description static voidclearCache()Clears in-memory cache booleanequals(@Nullable() Object object)BitmapgetBitmap()Image bitmap, null if not loaded yet BitmapgetData()intgetHeight()StringgetUrl()intgetWidth()inthashCode()booleanisUseCache()Memory cache is disabled by default, bitmaps saves with strong link, but it is possible to turn in on with ImageData.useCache(boolean) method static ImageDatanewImageData(@NonNull() String url)static ImageDatanewImageData(@NonNull() String url, int width, int height)voidsetBitmap(@Nullable() Bitmap bitmap)static voidsetCacheSize(int sizeInBytes)Maximum in-memory cache size for images. voidsetData(@Nullable() Bitmap data)voidsetHeight(int height)voidsetWidth(int width)StringtoString()voiduseCache(boolean use)By default, memory cache for images is disabled and bitmaps keeps by strong link. -
-
Method Detail
-
clearCache
@AnyThread() static void clearCache()
Clears in-memory cache
-
getBitmap
@Nullable() Bitmap getBitmap()
Image bitmap, null if not loaded yet
- Returns:
image bitmap
-
getData
@Nullable() Bitmap getData()
-
getHeight
int getHeight()
-
getWidth
int getWidth()
-
hashCode
int hashCode()
-
isUseCache
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
-
newImageData
@NonNull() static ImageData newImageData(@NonNull() String url)
-
newImageData
@NonNull() static ImageData newImageData(@NonNull() String url, int width, int height)
-
setBitmap
void setBitmap(@Nullable() Bitmap bitmap)
-
setCacheSize
@AnyThread() 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
-
setData
void setData(@Nullable() Bitmap data)
-
setHeight
void setHeight(int height)
-
setWidth
void setWidth(int width)
-
useCache
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
-
-
-
-