public class IconHelper extends Object
Constructor and Description |
---|
IconHelper(Context context,
int mode) |
Modifier and Type | Method and Description |
---|---|
Drawable |
getDocumentIcon(Context context,
String authority,
String id,
String mimeType,
int icon)
Gets a mime icon or package icon for a file.
|
void |
loadThumbnail(Uri uri,
String mimeType,
int docFlags,
int docIcon,
ImageView iconThumb,
ImageView iconMime,
ImageView subIconMime)
Load thumbnails for a directory list item.
|
void |
setThumbnailsEnabled(boolean enabled)
Enables or disables thumbnails.
|
void |
setViewMode(int mode)
Sets the current display mode.
|
void |
stopLoading(ImageView icon)
Cancels any ongoing load operations associated with the given ImageView.
|
public IconHelper(Context context, int mode)
context
- mode
- MODE_GRID or MODE_LISTpublic void setThumbnailsEnabled(boolean enabled)
enabled
- public void setViewMode(int mode)
mode
- See State.MODE_LIST
and State.MODE_GRID
.public void stopLoading(ImageView icon)
icon
- public void loadThumbnail(Uri uri, String mimeType, int docFlags, int docIcon, ImageView iconThumb, ImageView iconMime, @Nullable ImageView subIconMime)
uri
- The URI for the file being represented.mimeType
- The mime type of the file being represented.docFlags
- Flags for the file being represented.docIcon
- Custom icon (if any) for the file being requested.iconThumb
- The itemview's thumbnail icon.iconMime
- The itemview's mime icon. Hidden when iconThumb is shown.subIconMime
- The second itemview's mime icon. Always visible.public Drawable getDocumentIcon(Context context, String authority, String id, String mimeType, int icon)
context
- authority
- The authority string of the file.id
- The document ID of the file.mimeType
- The mime type of the file.icon
- The custom icon (if any) of the file.