public class Belvedere
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Belvedere.Builder
Builder for creating a customize
Belvedere instance. |
| Modifier and Type | Method and Description |
|---|---|
MediaIntent.CameraIntentBuilder |
camera()
Request an image from a camera app.
|
void |
clearStorage()
Clear the internal Belvedere cache.
|
MediaIntent.DocumentIntentBuilder |
document()
Request media from an external app.
|
static Belvedere |
from(android.content.Context context)
Get the global
Belvedere instance. |
MediaResult |
getFile(java.lang.String dir,
java.lang.String fileName)
Returns a
File and Uri for the given file name. |
void |
getFilesFromActivityOnResult(int requestCode,
int resultCode,
android.content.Intent data,
Callback<java.util.List<MediaResult>> callback)
Parse data from
Activity.onActivityResult(int, int, Intent). |
void |
getFilesFromActivityOnResult(int requestCode,
int resultCode,
android.content.Intent data,
Callback<java.util.List<MediaResult>> callback,
boolean resolveFiles)
Parse data from
Activity.onActivityResult(int, int, Intent). |
android.content.Intent |
getShareIntent(android.net.Uri uri,
java.lang.String contentType)
Create an
Intent for sharing an Uri. |
android.content.Intent |
getViewIntent(android.net.Uri uri,
java.lang.String contentType)
Create an
Intent for viewing an Uri. |
void |
grantPermissionsForUri(android.content.Intent intent,
android.net.Uri uri)
Grant all Apps that are resolvable through the provided
Intent Intent.FLAG_GRANT_READ_URI_PERMISSION and
Intent.FLAG_GRANT_WRITE_URI_PERMISSION. |
void |
resolveUris(java.util.List<android.net.Uri> uris,
java.lang.String directory,
Callback<java.util.List<MediaResult>> callback)
Copy the list of provided
Uri into the internal cache. |
void |
revokePermissionsForUri(android.net.Uri uri)
Revoke
Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION that were
previously granted by grantPermissionsForUri(Intent, Uri). |
static void |
setSingletonInstance(Belvedere belvedere)
Set the global
Belvedere instance. |
public static Belvedere from(android.content.Context context)
Belvedere instance.public static void setSingletonInstance(Belvedere belvedere)
belvedere - an instance created through Belvedere.Builderpublic MediaIntent.CameraIntentBuilder camera()
Belvedere.from(context) .camera() .open(activity);
public MediaIntent.DocumentIntentBuilder document()
Belvedere.from(context) .document() ... .open(activity);
public android.content.Intent getViewIntent(android.net.Uri uri,
java.lang.String contentType)
Intent for viewing an Uri.uri - Uri pointing to a filecontentType - (optional) the content type of the Uripublic android.content.Intent getShareIntent(android.net.Uri uri,
java.lang.String contentType)
Intent for sharing an Uri.uri - Uri pointing to a filecontentType - (optional) the content type of the Uripublic void getFilesFromActivityOnResult(int requestCode,
int resultCode,
android.content.Intent data,
Callback<java.util.List<MediaResult>> callback)
Activity.onActivityResult(int, int, Intent).
It's important that the same instance of Belvedere is used, which
was used to start the dialog or create the MediaIntent.
requestCode - The requestCode provided by Activity.onActivityResult(int, int, Intent)resultCode - The resultCode provided by Activity.onActivityResult(int, int, Intent)data - The Intent provided by Activity.onActivityResult(int, int, Intent)callback - Callback that will deliver a list of MediaResultpublic void getFilesFromActivityOnResult(int requestCode,
int resultCode,
android.content.Intent data,
Callback<java.util.List<MediaResult>> callback,
boolean resolveFiles)
Activity.onActivityResult(int, int, Intent).requestCode - The requestCode provided by Activity.onActivityResult(int, int, Intent)resultCode - The resultCode provided by Activity.onActivityResult(int, int, Intent)data - The Intent provided by Activity.onActivityResult(int, int, Intent)callback - Callback that will deliver a list of MediaResultresolveFiles - Set to true if belvedere should resolve selected filespublic MediaResult getFile(java.lang.String dir, java.lang.String fileName)
File and Uri for the given file name. The returned file
is located in Belvedere's internal cache and can be accessed through
BelvedereFileProvider.
Belvedere doesn't keep track of your files, you have to manage them.
dir - Directory name of the file or null if not needed.fileName - The file nameMediaResultpublic void resolveUris(java.util.List<android.net.Uri> uris,
java.lang.String directory,
Callback<java.util.List<MediaResult>> callback)
Uri into the internal cache.uris - The list of Uri to resolvedirectory - Name of directory for storing themcallback - Callback that will deliver a list of MediaResultpublic void grantPermissionsForUri(android.content.Intent intent,
android.net.Uri uri)
Intent Intent.FLAG_GRANT_READ_URI_PERMISSION and
Intent.FLAG_GRANT_WRITE_URI_PERMISSION.intent - An Intenturi - An Uripublic void revokePermissionsForUri(android.net.Uri uri)
Intent.FLAG_GRANT_READ_URI_PERMISSION and Intent.FLAG_GRANT_WRITE_URI_PERMISSION that were
previously granted by grantPermissionsForUri(Intent, Uri).uri - An Uripublic void clearStorage()