当前位置: 首页>>代码示例>>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;未经允许,请勿转载。