public class ImageCache
extends java.lang.Object
| 限定符和类型 | 方法和说明 |
|---|---|
static int |
calculateInSampleSize(android.graphics.BitmapFactory.Options options,
int reqWidth,
int reqHeight)
Calculate an inSampleSize for use in a
BitmapFactory.Options object when decoding
bitmaps using the decode* methods from BitmapFactory. |
static int |
getBitmapSize(android.graphics.drawable.BitmapDrawable value)
Get the size in bytes of a bitmap in a BitmapDrawable.
|
static java.io.File |
getDiskCacheDir(android.content.Context context,
java.lang.String uniqueName)
Get a usable cache directory (external if available, internal otherwise).
|
static java.io.File |
getExternalCacheDir(android.content.Context context)
Get the external app cache directory.
|
static long |
getUsableSpace(java.io.File path)
Check how much usable space is available at a given path.
|
static java.lang.String |
hashKeyForDisk(java.lang.String key)
A hashing method that changes a string (like a URL) into a hash suitable for using as a
disk filename.
|
static boolean |
isExternalStorageRemovable()
Check if external storage is built-in or removable.
|
public static int calculateInSampleSize(android.graphics.BitmapFactory.Options options,
int reqWidth,
int reqHeight)
BitmapFactory.Options object when decoding
bitmaps using the decode* methods from BitmapFactory. This implementation calculates
the closest inSampleSize that is a power of 2 and will result in the final decoded bitmap
having a width and height equal to or larger than the requested width and height.options - An options object with out* params already populated (run through a decode*
method with inJustDecodeBounds==truereqWidth - The requested width of the resulting bitmapreqHeight - The requested height of the resulting bitmappublic static java.lang.String hashKeyForDisk(java.lang.String key)
public static int getBitmapSize(android.graphics.drawable.BitmapDrawable value)
value - public static java.io.File getExternalCacheDir(android.content.Context context)
context - The context to usepublic static boolean isExternalStorageRemovable()
public static java.io.File getDiskCacheDir(android.content.Context context,
java.lang.String uniqueName)
context - The context to useuniqueName - A unique directory name to append to the cache dirpublic static long getUsableSpace(java.io.File path)
path - The path to check