Java Code Examples for android.content.ContentProviderClient#call()
The following examples show how to use
android.content.ContentProviderClient#call() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** {@hide} */ public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri, Uri childDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri); final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in); if (out == null) { throw new RemoteException("Failed to get a reponse from isChildDocument query."); } if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) { throw new RemoteException("Response did not include result field.."); } return out.getBoolean(DocumentsContract.EXTRA_RESULT); }
Example 2
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 6 votes |
public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri, Uri childDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri); final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in); if (out == null) { throw new RemoteException("Failed to get a reponse from isChildDocument query."); } if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) { throw new RemoteException("Response did not include result field.."); } return out.getBoolean(DocumentsContract.EXTRA_RESULT); }
Example 3
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 6 votes |
public static boolean isChildDocument(ContentProviderClient client, Uri parentDocumentUri, Uri childDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, childDocumentUri); final Bundle out = client.call(METHOD_IS_CHILD_DOCUMENT, null, in); if (out == null) { throw new RemoteException("Failed to get a reponse from isChildDocument query."); } if (!out.containsKey(DocumentsContract.EXTRA_RESULT)) { throw new RemoteException("Response did not include result field.."); } return out.getBoolean(DocumentsContract.EXTRA_RESULT); }
Example 4
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri createDocument(ContentProviderClient client, Uri parentDocumentUri, String mimeType, String displayName) throws Exception { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri); in.putString(DocumentsContract.Document.COLUMN_MIME_TYPE, mimeType); in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName); final Bundle out = client.call(METHOD_CREATE_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 5
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** {@hide} */ public static Uri createDocument(ContentProviderClient client, Uri parentDocumentUri, String mimeType, String displayName) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, parentDocumentUri); in.putString(Document.COLUMN_MIME_TYPE, mimeType); in.putString(Document.COLUMN_DISPLAY_NAME, displayName); final Bundle out = client.call(METHOD_CREATE_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 6
Source File: ContentProviderClientCompat.java From FireFiles with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static Bundle call(ContentResolver resolver, ContentProviderClient client, Uri uri, String method, String arg, Bundle extras) throws Exception{ if(Utils.hasJellyBeanMR1()){ return client.call(method, arg, extras); } else{ return resolver.call(uri, method, arg, extras); } }
Example 7
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri renameDocument(ContentProviderClient client, Uri documentUri, String displayName) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName); final Bundle out = client.call(METHOD_RENAME_DOCUMENT, null, in); final Uri outUri = out.getParcelable(DocumentsContract.EXTRA_URI); return (outUri != null) ? outUri : documentUri; }
Example 8
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri moveDocument(ContentProviderClient client, Uri sourceDocumentUri, Uri sourceParentDocumentUri, Uri targetParentDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri); in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, sourceParentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri); final Bundle out = client.call(METHOD_MOVE_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 9
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static void deleteDocument(ContentProviderClient client, Uri documentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); client.call(METHOD_DELETE_DOCUMENT, null, in); }
Example 10
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static void removeDocument(ContentProviderClient client, Uri documentUri, Uri parentDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, parentDocumentUri); client.call(METHOD_REMOVE_DOCUMENT, null, in); }
Example 11
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri renameDocument(ContentProviderClient client, Uri documentUri, String displayName) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); in.putString(DocumentsContract.Document.COLUMN_DISPLAY_NAME, displayName); final Bundle out = client.call(METHOD_RENAME_DOCUMENT, null, in); final Uri outUri = out.getParcelable(DocumentsContract.EXTRA_URI); return (outUri != null) ? outUri : documentUri; }
Example 12
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri moveDocument(ContentProviderClient client, Uri sourceDocumentUri, Uri sourceParentDocumentUri, Uri targetParentDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri); in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, sourceParentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri); final Bundle out = client.call(METHOD_MOVE_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 13
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** * {@hide} */ public static IntentSender createWebLinkIntent(ContentProviderClient client, Uri uri, Bundle options) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, uri); // Options may be provider specific, so put them in a separate bundle to // avoid overriding the Uri. if (options != null) { in.putBundle(EXTRA_OPTIONS, options); } final Bundle out = client.call(METHOD_CREATE_WEB_LINK_INTENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_RESULT); }
Example 14
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static Uri copyDocument(ContentProviderClient client, Uri sourceDocumentUri, Uri targetParentDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri); final Bundle out = client.call(METHOD_COPY_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 15
Source File: ContentProviderClientCompat.java From FireFiles with Apache License 2.0 | 5 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) public static Bundle call(ContentResolver resolver, ContentProviderClient client, Uri uri, String method, String arg, Bundle extras) throws Exception{ if(Utils.hasJellyBeanMR1()){ return client.call(method, arg, extras); } else{ return resolver.call(uri, method, arg, extras); } }
Example 16
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** {@hide} */ public static Uri moveDocument(ContentProviderClient client, Uri sourceDocumentUri, Uri sourceParentDocumentUri, Uri targetParentDocumentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, sourceDocumentUri); in.putParcelable(DocumentsContract.EXTRA_PARENT_URI, sourceParentDocumentUri); in.putParcelable(DocumentsContract.EXTRA_TARGET_URI, targetParentDocumentUri); final Bundle out = client.call(METHOD_MOVE_DOCUMENT, null, in); return out.getParcelable(DocumentsContract.EXTRA_URI); }
Example 17
Source File: DocumentsContract.java From FireFiles with Apache License 2.0 | 5 votes |
public static void deleteDocument(ContentProviderClient client, Uri documentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); client.call(METHOD_DELETE_DOCUMENT, null, in); }
Example 18
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 5 votes |
/** {@hide} */ public static void deleteDocument(ContentProviderClient client, Uri documentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, documentUri); client.call(METHOD_DELETE_DOCUMENT, null, in); }
Example 19
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 3 votes |
/** * Finds the canonical path. If uri is a document uri returns path from a root and * its associated root id. If uri is a tree uri returns the path from the top of * the tree. The {@link Path#getPath()} of the return value contains document ID * starts from the top of the tree or the root document to the requested document, * both inclusive. * * Callers can expect the root ID returned from multiple calls to this method is * consistent. * * @param uri uri of the document which path is requested. It can be either a * plain document uri or a tree uri. * @return the path of the document. * @see DocumentsProvider#findDocumentPath(String, String) * * {@hide} */ public static Path findDocumentPath(ContentProviderClient client, Uri uri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(DocumentsContract.EXTRA_URI, uri); final Bundle out = client.call(METHOD_FIND_DOCUMENT_PATH, null, in); return out.getParcelable(DocumentsContract.EXTRA_RESULT); }
Example 20
Source File: DocumentsContract.java From android_9.0.0_r45 with Apache License 2.0 | 3 votes |
/** * Returns metadata associated with the document. The type of metadata returned * is specific to the document type. For example the data returned for an image * file will likely consist primarily or soley of EXIF metadata. * * <p>The returned {@link Bundle} will contain zero or more entries depending * on the type of data supported by the document provider. * * <ol> * <li>A {@link DocumentsContract.METADATA_TYPES} containing a {@code String[]} value. * The string array identifies the type or types of metadata returned. Each * value in the can be used to access a {@link Bundle} of data * containing that type of data. * <li>An entry each for each type of returned metadata. Each set of metadata is * itself represented as a bundle and accessible via a string key naming * the type of data. * </ol> * * <p>Example: * <p><pre><code> * Bundle metadata = DocumentsContract.getDocumentMetadata(client, imageDocUri, tags); * if (metadata.containsKey(DocumentsContract.METADATA_EXIF)) { * Bundle exif = metadata.getBundle(DocumentsContract.METADATA_EXIF); * int imageLength = exif.getInt(ExifInterface.TAG_IMAGE_LENGTH); * } * </code></pre> * * @param documentUri a Document URI * @return a Bundle of Bundles. * {@hide} */ public static Bundle getDocumentMetadata( ContentProviderClient client, Uri documentUri) throws RemoteException { final Bundle in = new Bundle(); in.putParcelable(EXTRA_URI, documentUri); final Bundle out = client.call(METHOD_GET_DOCUMENT_METADATA, null, in); if (out == null) { throw new RemoteException("Failed to get a response from getDocumentMetadata"); } return out; }