当前位置: 首页>>代码示例>>Java>>正文


Java ContentResolver.acquireUnstableContentProviderClient方法代码示例

本文整理汇总了Java中android.content.ContentResolver.acquireUnstableContentProviderClient方法的典型用法代码示例。如果您正苦于以下问题:Java ContentResolver.acquireUnstableContentProviderClient方法的具体用法?Java ContentResolver.acquireUnstableContentProviderClient怎么用?Java ContentResolver.acquireUnstableContentProviderClient使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.ContentResolver的用法示例。


在下文中一共展示了ContentResolver.acquireUnstableContentProviderClient方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: uncompressDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
public static boolean uncompressDocument(ContentResolver resolver, Uri fromDocumentUri) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            fromDocumentUri.getAuthority());
    try {
        final Bundle in = new Bundle();
        in.putString(Document.COLUMN_DOCUMENT_ID, getDocumentId(fromDocumentUri));
        in.putParcelable(DocumentsContract.EXTRA_URI, fromDocumentUri);

        resolver.call(fromDocumentUri, METHOD_UNCOMPRESS_DOCUMENT, null, in);
        return true;
    } catch (Exception e) {
        Log.w(TAG, "Failed to uncompress document", e);
        return false;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:18,代码来源:DocumentsContract.java

示例2: compressDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
public static boolean compressDocument(ContentResolver resolver, Uri fromDocumentUri, ArrayList<String> fromDocumentIds) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            fromDocumentUri.getAuthority());
    try {
        final Bundle in = new Bundle();
        in.putString(Document.COLUMN_DOCUMENT_ID, getDocumentId(fromDocumentUri));
        in.putParcelable(DocumentsContract.EXTRA_URI, fromDocumentUri);
        in.putStringArrayList(DocumentsContract.EXTRA_DOCUMENTS_COMPRESS, fromDocumentIds);
        resolver.call(fromDocumentUri, METHOD_COMPRESS_DOCUMENT, null, in);
        return true;
    } catch (Exception e) {
        Log.w(TAG, "Failed to compress document", e);
        return false;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:18,代码来源:DocumentsContract.java

示例3: createDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Create a new document with given MIME type and display name.
 *
 * @param parentDocumentUri directory with
 *            {@link DocumentsContract.Document#FLAG_DIR_SUPPORTS_CREATE}
 * @param mimeType MIME type of new document
 * @param displayName name of new document
 * @return newly created document, or {@code null} if failed
 */
public static Uri createDocument(ContentResolver resolver, Uri parentDocumentUri,
                                 String mimeType, String displayName) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            parentDocumentUri.getAuthority());
    try {
        return createDocument(client, parentDocumentUri, mimeType, displayName);
    } catch (Exception e) {
        Log.w(TAG, "Failed to create document", e);
        return null;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:23,代码来源:DocumentsContract.java

示例4: renameDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Change the display name of an existing document.
 * <p>
 * If the underlying provider needs to create a new
 * {@link DocumentsContract.Document#COLUMN_DOCUMENT_ID} to represent the updated display
 * name, that new document is returned and the original document is no
 * longer valid. Otherwise, the original document is returned.
 *
 * @param documentUri document with {@link DocumentsContract.Document#FLAG_SUPPORTS_RENAME}
 * @param displayName updated name for document
 * @return the existing or new document after the rename, or {@code null} if
 *         failed.
 */
public static Uri renameDocument(ContentResolver resolver, Uri documentUri,
                                 String displayName) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            documentUri.getAuthority());
    try {
        return renameDocument(client, documentUri, displayName);
    } catch (Exception e) {
        Log.w(TAG, "Failed to rename document", e);
        return null;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:27,代码来源:DocumentsContract.java

示例5: deleteDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Delete the given document.
 *
 * @param documentUri document with {@link Document#FLAG_SUPPORTS_DELETE}
 * @return if the document was deleted successfully.
 */
public static boolean deleteDocument(ContentResolver resolver, Uri documentUri) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            documentUri.getAuthority());
    try {
        deleteDocument(client, documentUri);
        return true;
    } catch (Exception e) {
        Log.w(TAG, "Failed to delete document", e);
        return false;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:20,代码来源:DocumentsContract.java

示例6: copyDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Copies the given document.
 *
 * @param sourceDocumentUri document with {@link DocumentsContract.Document#FLAG_SUPPORTS_COPY}
 * @param targetParentDocumentUri document which will become a parent of the source
 *         document's copy.
 * @return the copied document, or {@code null} if failed.
 */
public static Uri copyDocument(ContentResolver resolver, Uri sourceDocumentUri,
                               Uri targetParentDocumentUri) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            sourceDocumentUri.getAuthority());
    try {
        return copyDocument(client, sourceDocumentUri, targetParentDocumentUri);
    } catch (Exception e) {
        Log.w(TAG, "Failed to copy document", e);
        return null;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:22,代码来源:DocumentsContract.java

示例7: moveDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Moves the given document under a new parent.
 *
 * @param sourceDocumentUri document with {@link Document#FLAG_SUPPORTS_MOVE}
 * @param sourceParentDocumentUri parent document of the document to move.
 * @param targetParentDocumentUri document which will become a new parent of the source
 *         document.
 * @return the moved document, or {@code null} if failed.
 */
public static Uri moveDocument(ContentResolver resolver, Uri sourceDocumentUri,
        Uri sourceParentDocumentUri, Uri targetParentDocumentUri) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            sourceDocumentUri.getAuthority());
    try {
        return moveDocument(client, sourceDocumentUri, sourceParentDocumentUri,
                targetParentDocumentUri);
    } catch (Exception e) {
        Log.w(TAG, "Failed to move document", e);
        return null;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:24,代码来源:DocumentsContract.java

示例8: acquireUnstableContentProviderClient

import android.content.ContentResolver; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
   public static ContentProviderClient acquireUnstableContentProviderClient(ContentResolver resolver, String authority){
	if(Utils.hasJellyBeanMR1()){
    	return resolver.acquireUnstableContentProviderClient(authority);
	}
	else{
        return resolver.acquireContentProviderClient(authority);
	}
}
 
开发者ID:kranthi0987,项目名称:easyfilemanager,代码行数:10,代码来源:ContentProviderClientCompat.java

示例9: removeDocument

import android.content.ContentResolver; //导入方法依赖的package包/类
/**
 * Removes the given document from a parent directory.
 *
 * <p>In contrast to {@link #deleteDocument} it requires specifying the parent.
 * This method is especially useful if the document can be in multiple parents.
 *
 * @param documentUri document with {@link Document#FLAG_SUPPORTS_REMOVE}
 * @param parentDocumentUri parent document of the document to remove.
 * @return true if the document was removed successfully.
 */
public static boolean removeDocument(ContentResolver resolver, Uri documentUri,
        Uri parentDocumentUri) {
    final ContentProviderClient client = resolver.acquireUnstableContentProviderClient(
            documentUri.getAuthority());
    try {
        removeDocument(client, documentUri, parentDocumentUri);
        return true;
    } catch (Exception e) {
        Log.w(TAG, "Failed to remove document", e);
        return false;
    } finally {
        ContentProviderClientCompat.releaseQuietly(client);
    }
}
 
开发者ID:medalionk,项目名称:simple-share-android,代码行数:25,代码来源:DocumentsContract.java


注:本文中的android.content.ContentResolver.acquireUnstableContentProviderClient方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。