Java Code Examples for android.content.ContentProviderClient#getType()
The following examples show how to use
android.content.ContentProviderClient#getType() .
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: BinaryDictionaryFileDumper.java From openboard with GNU General Public License v3.0 | 5 votes |
/** * Gets the content URI builder for a specified type. * * Supported types include QUERY_PATH_DICT_INFO, which takes the locale as * the extraPath argument, and QUERY_PATH_DATAFILE, which needs a wordlist ID * as the extraPath argument. * * @param clientId the clientId to use * @param contentProviderClient the instance of content provider client * @param queryPathType the path element encoding the type * @param extraPath optional extra argument for this type (typically word list id) * @return a builder that can build the URI for the best supported protocol version * @throws RemoteException if the client can't be contacted */ private static Uri.Builder getContentUriBuilderForType(final String clientId, final ContentProviderClient contentProviderClient, final String queryPathType, final String extraPath) throws RemoteException { // Check whether protocol v2 is supported by building a v2 URI and calling getType() // on it. If this returns null, v2 is not supported. final Uri.Builder uriV2Builder = getProviderUriBuilder(clientId); uriV2Builder.appendPath(queryPathType); uriV2Builder.appendPath(extraPath); uriV2Builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE); if (null != contentProviderClient.getType(uriV2Builder.build())) return uriV2Builder; // Protocol v2 is not supported, so create and return the protocol v1 uri. return getProviderUriBuilder(extraPath); }
Example 2
Source File: BinaryDictionaryFileDumper.java From Android-Keyboard with Apache License 2.0 | 5 votes |
/** * Gets the content URI builder for a specified type. * * Supported types include QUERY_PATH_DICT_INFO, which takes the locale as * the extraPath argument, and QUERY_PATH_DATAFILE, which needs a wordlist ID * as the extraPath argument. * * @param clientId the clientId to use * @param contentProviderClient the instance of content provider client * @param queryPathType the path element encoding the type * @param extraPath optional extra argument for this type (typically word list id) * @return a builder that can build the URI for the best supported protocol version * @throws RemoteException if the client can't be contacted */ private static Uri.Builder getContentUriBuilderForType(final String clientId, final ContentProviderClient contentProviderClient, final String queryPathType, final String extraPath) throws RemoteException { // Check whether protocol v2 is supported by building a v2 URI and calling getType() // on it. If this returns null, v2 is not supported. final Uri.Builder uriV2Builder = getProviderUriBuilder(clientId); uriV2Builder.appendPath(queryPathType); uriV2Builder.appendPath(extraPath); uriV2Builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE); if (null != contentProviderClient.getType(uriV2Builder.build())) return uriV2Builder; // Protocol v2 is not supported, so create and return the protocol v1 uri. return getProviderUriBuilder(extraPath); }
Example 3
Source File: BinaryDictionaryFileDumper.java From AOSP-Kayboard-7.1.2 with Apache License 2.0 | 5 votes |
/** * Gets the content URI builder for a specified type. * * Supported types include QUERY_PATH_DICT_INFO, which takes the locale as * the extraPath argument, and QUERY_PATH_DATAFILE, which needs a wordlist ID * as the extraPath argument. * * @param clientId the clientId to use * @param contentProviderClient the instance of content provider client * @param queryPathType the path element encoding the type * @param extraPath optional extra argument for this type (typically word list id) * @return a builder that can build the URI for the best supported protocol version * @throws RemoteException if the client can't be contacted */ private static Uri.Builder getContentUriBuilderForType(final Context context, final String clientId, final ContentProviderClient contentProviderClient, final String queryPathType, final String extraPath) throws RemoteException { // Check whether protocol v2 is supported by building a v2 URI and calling getType() // on it. If this returns null, v2 is not supported. final Uri.Builder uriV2Builder = getProviderUriBuilder(context, clientId); uriV2Builder.appendPath(queryPathType); uriV2Builder.appendPath(extraPath); uriV2Builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE); if (null != contentProviderClient.getType(uriV2Builder.build())) return uriV2Builder; // Protocol v2 is not supported, so create and return the protocol v1 uri. return getProviderUriBuilder(context, extraPath); }
Example 4
Source File: AbstractContentProviderStub.java From DroidPlugin with GNU Lesser General Public License v3.0 | 5 votes |
@Override public String getType(Uri uri) { String targetAuthority = uri.getQueryParameter(Env.EXTRA_TARGET_AUTHORITY); if (!TextUtils.isEmpty(targetAuthority) && !TextUtils.equals(targetAuthority, uri.getAuthority())) { ContentProviderClient client = getContentProviderClient(targetAuthority); try { return client.getType(buildNewUri(uri, targetAuthority)); } catch (RemoteException e) { handleExpcetion(e); } } return null; }
Example 5
Source File: BinaryDictionaryFileDumper.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
/** * Gets the content URI builder for a specified type. * * Supported types include QUERY_PATH_DICT_INFO, which takes the locale as * the extraPath argument, and QUERY_PATH_DATAFILE, which needs a wordlist ID * as the extraPath argument. * * @param clientId the clientId to use * @param contentProviderClient the instance of content provider client * @param queryPathType the path element encoding the type * @param extraPath optional extra argument for this type (typically word list id) * @return a builder that can build the URI for the best supported protocol version * @throws RemoteException if the client can't be contacted */ private static Uri.Builder getContentUriBuilderForType(final String clientId, final ContentProviderClient contentProviderClient, final String queryPathType, final String extraPath) throws RemoteException { // Check whether protocol v2 is supported by building a v2 URI and calling getType() // on it. If this returns null, v2 is not supported. final Uri.Builder uriV2Builder = getProviderUriBuilder(clientId); uriV2Builder.appendPath(queryPathType); uriV2Builder.appendPath(extraPath); uriV2Builder.appendQueryParameter(QUERY_PARAMETER_PROTOCOL, QUERY_PARAMETER_PROTOCOL_VALUE); if (null != contentProviderClient.getType(uriV2Builder.build())) return uriV2Builder; // Protocol v2 is not supported, so create and return the protocol v1 uri. return getProviderUriBuilder(extraPath); }