當前位置: 首頁>>代碼示例>>Java>>正文


Java ClipDescription.compareMimeTypes方法代碼示例

本文整理匯總了Java中android.content.ClipDescription.compareMimeTypes方法的典型用法代碼示例。如果您正苦於以下問題:Java ClipDescription.compareMimeTypes方法的具體用法?Java ClipDescription.compareMimeTypes怎麽用?Java ClipDescription.compareMimeTypes使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.content.ClipDescription的用法示例。


在下文中一共展示了ClipDescription.compareMimeTypes方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: openTypedAssetFileImpl

import android.content.ClipDescription; //導入方法依賴的package包/類
private final AssetFileDescriptor openTypedAssetFileImpl(
        Uri uri, String mimeTypeFilter, Bundle opts, CancellationSignal signal)
        throws FileNotFoundException {
    enforceTree(uri);
    final String documentId = getDocumentId(uri);
    if (opts != null && opts.containsKey(ContentResolver.EXTRA_SIZE)) {
        final Point sizeHint = opts.getParcelable(ContentResolver.EXTRA_SIZE);
        return openDocumentThumbnail(documentId, sizeHint, signal);
    }
    if ("*/*".equals(mimeTypeFilter)) {
         // If they can take anything, the untyped open call is good enough.
         return openAssetFile(uri, "r");
    }
    final String baseType = getType(uri);
    if (baseType != null && ClipDescription.compareMimeTypes(baseType, mimeTypeFilter)) {
        // Use old untyped open call if this provider has a type for this
        // URI and it matches the request.
        return openAssetFile(uri, "r");
    }
    // For any other yet unhandled case, let the provider subclass handle it.
    return openTypedDocument(documentId, mimeTypeFilter, opts, signal);
}
 
開發者ID:medalionk,項目名稱:simple-share-android,代碼行數:23,代碼來源:DocumentsProvider.java

示例2: isCommitContentSupported

import android.content.ClipDescription; //導入方法依賴的package包/類
private boolean isCommitContentSupported(@Nullable EditorInfo editorInfo, @NonNull String mimeType) {
    if (editorInfo == null) {
        return false;
    }

    final InputConnection ic = getCurrentInputConnection();
    if (ic == null) {
        return false;
    }

    if (!validatePackageName(editorInfo)) {
        return false;
    }

    final String[] supportedMimeTypes = EditorInfoCompat.getContentMimeTypes(editorInfo);
    for (String supportedMimeType : supportedMimeTypes) {
        if (ClipDescription.compareMimeTypes(mimeType, supportedMimeType)) {
            return true;
        }
    }
    return false;
}
 
開發者ID:ROKOLabs,項目名稱:ROKOmoji.Emoji.Keyboard.App-Android,代碼行數:23,代碼來源:KeyboardService.java

示例3: openTypedAssetFile

import android.content.ClipDescription; //導入方法依賴的package包/類
/**
 * Copied from super
 */
@Override @TargetApi(19)
public @Nullable AssetFileDescriptor openTypedAssetFile(@NonNull Uri uri, @NonNull String mimeTypeFilter, Bundle opts, CancellationSignal signal) throws FileNotFoundException {
    if ("*/*".equals(mimeTypeFilter)) {
        // If they can take anything, the untyped open call is good enough.
        return openAssetFile(uri, "r", signal);
    }
    String baseType = getType(uri);
    if (baseType != null && ClipDescription.compareMimeTypes(baseType, mimeTypeFilter)) {
        // Use old untyped open call if this provider has a type for this
        // URI and it matches the request.
        return openAssetFile(uri, "r", signal);
    }
    throw new FileNotFoundException("Can't open " + uri + " as type " + mimeTypeFilter);
}
 
開發者ID:OpenSilk,項目名稱:Orpheus,代碼行數:18,代碼來源:ArtworkProvider.java


注:本文中的android.content.ClipDescription.compareMimeTypes方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。