Java Code Examples for android.content.ClipDescription#compareMimeTypes()
The following examples show how to use
android.content.ClipDescription#compareMimeTypes() .
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: ImageKeyboard.java From input-samples with Apache License 2.0 | 6 votes |
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; }
Example 2
Source File: DocumentsProvider.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
/** * @hide */ 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); }
Example 3
Source File: DocumentsProvider.java From FireFiles with Apache License 2.0 | 6 votes |
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); }
Example 4
Source File: DocumentsProvider.java From FireFiles with Apache License 2.0 | 6 votes |
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); }
Example 5
Source File: DocumentsProvider.java From FireFiles with Apache License 2.0 | 6 votes |
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); }
Example 6
Source File: ImageKeyboard.java From android-CommitContentSampleIME with Apache License 2.0 | 6 votes |
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; }