public class BrazeImageUtils
extends java.lang.Object
Constructor and Description |
---|
BrazeImageUtils() |
Modifier and Type | Method and Description |
---|---|
static android.graphics.Bitmap |
getBitmap(android.content.Context context,
android.net.Uri uri,
BrazeViewBounds viewBounds)
Downloads an image from the internet or loads an image locally and returns a bitmap object.
|
static int |
getDensityDpi(android.content.Context context) |
static int |
getDisplayHeightPixels(android.content.Context context) |
static int |
getDisplayWidthPixels(android.content.Context context) |
static int |
getImageLoaderCacheSize()
Gets the size in bytes to give the image loader's cache.
|
static int |
getPixelsFromDensityAndDp(int dpi,
int dp) |
static void |
resizeImageViewToBitmapDimensions(android.graphics.Bitmap bitmap,
android.widget.ImageView imageView)
Resizes the
ImageView to match the aspect ratio derived
from the bitmap. |
public static android.graphics.Bitmap getBitmap(android.content.Context context, android.net.Uri uri, BrazeViewBounds viewBounds)
context
- Application context.uri
- The uri of the remote image.viewBounds
- The bounds for the destination view.public static int getDisplayWidthPixels(android.content.Context context)
public static int getDisplayHeightPixels(android.content.Context context)
public static int getDensityDpi(android.content.Context context)
public static int getPixelsFromDensityAndDp(int dpi, int dp)
dpi
- dpi of the screendp
- dimension of the original imagepublic static void resizeImageViewToBitmapDimensions(android.graphics.Bitmap bitmap, android.widget.ImageView imageView)
ImageView
to match the aspect ratio derived
from the bitmap. Note that the width of the
ImageView
will be unchanged. Calls directly on the caller thread.public static int getImageLoaderCacheSize()