public class BoxPreviewUtils
extends java.lang.Object
| Constructor and Description |
|---|
BoxPreviewUtils() |
| Modifier and Type | Method and Description |
|---|---|
static int |
calculateGridViewSpacing(android.content.Context context)
This function calculates spacing between gridview tiles making it dependent on device width.
|
static int |
calculateGridViewTileSize(android.content.Context context,
int columns)
This function takes in dimensions of device and returns the tile size (height and width)
to 90% of screen width spread over 2 columns
|
static int |
calculateSampleSize(android.graphics.BitmapFactory.Options options,
int reqWidth,
int reqHeight) |
static com.box.androidsdk.content.models.BoxFolder |
createArtificialBoxFolder(com.box.androidsdk.content.models.BoxIteratorItems iteratorItems) |
static java.util.HashMap<java.lang.String,java.lang.String> |
createAuthorizationHeader(com.box.androidsdk.content.models.BoxSession session)
Creates a HashMap representation of an authorization header from a BoxSession
|
static android.graphics.Bitmap |
decodeSampledBitmapFromStream(java.io.File file,
int reqWidth,
int reqHeight) |
static com.box.androidsdk.content.models.BoxFile |
getBoxFileWithMandatoryFields(com.box.androidsdk.content.models.BoxFile boxFile,
java.util.Set<java.lang.String> mandatoryBoxFileFields)
Return a copy of the BoxFile given in parameter with only the mandatory fields.
|
static int |
getDefaultIconResource(com.box.androidsdk.content.models.BoxItem boxItem)
Gets the default icon resource depending on what kind of boxItem is being viewed.
|
static java.lang.String |
getExtension(com.box.androidsdk.content.models.BoxItem item) |
static java.lang.String |
getFileSize(android.content.res.Resources resources,
long totalSize) |
static java.lang.String |
getFileSizeOutOfTotal(android.content.res.Resources resources,
long numSize,
long totalSize) |
static BoxApiPreview.Extensions |
getPreviewExtension(com.box.androidsdk.content.models.BoxFile boxfile) |
static int |
getStatusBarHeight(android.content.Context context)
Calculates the height of the status bar.
|
static boolean |
isConversionException(java.lang.Throwable exception) |
static boolean |
isInternetAvailable(android.content.Context context)
Check for an internet connection.
|
static boolean |
isPreviewUri(android.net.Uri uri) |
static boolean |
isSameListOfIds(java.util.List<com.box.androidsdk.content.models.BoxFile> list1,
java.util.List<com.box.androidsdk.content.models.BoxFile> list2) |
static boolean |
isTokenExpired(java.lang.Throwable exoPlayerException) |
static byte[] |
scaleBitmapBytes(android.content.Context context,
byte[] bitmapBytes)
Scales the bitmap down if it is larger than the screen size.
|
static void |
setAccentColor(android.content.res.Resources res,
android.widget.ProgressBar progressBar) |
static boolean |
streamExists(java.io.InputStream stream) |
static java.lang.String |
stringForTime(int timeMs) |
static byte[] |
toByteArray(java.io.InputStream stream) |
public static java.lang.String getFileSize(android.content.res.Resources resources,
long totalSize)
public static java.lang.String getFileSizeOutOfTotal(android.content.res.Resources resources,
long numSize,
long totalSize)
public static com.box.androidsdk.content.models.BoxFile getBoxFileWithMandatoryFields(com.box.androidsdk.content.models.BoxFile boxFile,
java.util.Set<java.lang.String> mandatoryBoxFileFields)
boxFile - original BoxFile to strip downmandatoryBoxFileFields - Set of mandatory BoxFile fieldspublic static com.box.androidsdk.content.models.BoxFolder createArtificialBoxFolder(com.box.androidsdk.content.models.BoxIteratorItems iteratorItems)
public static java.util.HashMap<java.lang.String,java.lang.String> createAuthorizationHeader(com.box.androidsdk.content.models.BoxSession session)
session - BoxSession to create the header withpublic static int calculateGridViewTileSize(android.content.Context context,
int columns)
context - Context for accessing Window Managercolumns - columns Number of columns in gridviewpublic static int calculateGridViewSpacing(android.content.Context context)
context - Context for accessing Window Managerpublic static int getStatusBarHeight(android.content.Context context)
context - current contextpublic static java.lang.String getExtension(com.box.androidsdk.content.models.BoxItem item)
public static java.lang.String stringForTime(int timeMs)
public static boolean isInternetAvailable(android.content.Context context)
context - current context.public static int getDefaultIconResource(com.box.androidsdk.content.models.BoxItem boxItem)
boxItem - The box item to show to user.public static boolean streamExists(java.io.InputStream stream)
public static byte[] toByteArray(java.io.InputStream stream)
public static android.graphics.Bitmap decodeSampledBitmapFromStream(java.io.File file,
int reqWidth,
int reqHeight)
public static int calculateSampleSize(android.graphics.BitmapFactory.Options options,
int reqWidth,
int reqHeight)
public static byte[] scaleBitmapBytes(android.content.Context context,
byte[] bitmapBytes)
throws java.io.IOException
context - current contextbitmapBytes - bytes of bitmap to scale down if necessaryjava.io.IOException - if bytes cannot be read or decoded into a bitmap.public static boolean isTokenExpired(java.lang.Throwable exoPlayerException)
public static void setAccentColor(android.content.res.Resources res,
android.widget.ProgressBar progressBar)
public static boolean isSameListOfIds(java.util.List<com.box.androidsdk.content.models.BoxFile> list1,
java.util.List<com.box.androidsdk.content.models.BoxFile> list2)
public static BoxApiPreview.Extensions getPreviewExtension(com.box.androidsdk.content.models.BoxFile boxfile)
public static boolean isPreviewUri(android.net.Uri uri)
public static boolean isConversionException(java.lang.Throwable exception)