本文整理汇总了Java中com.facebook.common.util.UriUtil.isLocalContentUri方法的典型用法代码示例。如果您正苦于以下问题:Java UriUtil.isLocalContentUri方法的具体用法?Java UriUtil.isLocalContentUri怎么用?Java UriUtil.isLocalContentUri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.common.util.UriUtil
的用法示例。
在下文中一共展示了UriUtil.isLocalContentUri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourceUriType
import com.facebook.common.util.UriUtil; //导入方法依赖的package包/类
/**
* This is a utility method which returns the type of Uri
* @param uri The Uri to test
* @return The type of the given Uri if available or SOURCE_TYPE_UNKNOWN if not
*/
private static @SourceUriType int getSourceUriType(final Uri uri) {
if (uri == null) {
return SOURCE_TYPE_UNKNOWN;
}
if (UriUtil.isNetworkUri(uri)) {
return SOURCE_TYPE_NETWORK;
} else if (UriUtil.isLocalFileUri(uri)) {
if (MediaUtils.isVideo(MediaUtils.extractMime(uri.getPath()))) {
return SOURCE_TYPE_LOCAL_VIDEO_FILE;
} else {
return SOURCE_TYPE_LOCAL_IMAGE_FILE;
}
} else if (UriUtil.isLocalContentUri(uri)) {
return SOURCE_TYPE_LOCAL_CONTENT;
} else if (UriUtil.isLocalAssetUri(uri)) {
return SOURCE_TYPE_LOCAL_ASSET;
} else if (UriUtil.isLocalResourceUri(uri)) {
return SOURCE_TYPE_LOCAL_RESOURCE;
} else if (UriUtil.isDataUri(uri)) {
return SOURCE_TYPE_DATA;
} else if (UriUtil.isQualifiedResourceUri(uri)) {
return SOURCE_TYPE_QUALIFIED_RESOURCE;
} else {
return SOURCE_TYPE_UNKNOWN;
}
}
示例2: getLocalFilePath
import com.facebook.common.util.UriUtil; //导入方法依赖的package包/类
@Nullable private String getLocalFilePath(ImageRequest imageRequest) {
Uri uri = imageRequest.getSourceUri();
if (UriUtil.isLocalFileUri(uri)) {
return imageRequest.getSourceFile().getPath();
} else if (UriUtil.isLocalContentUri(uri)) {
String selection = null;
String[] selectionArgs = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT
&& "com.android.providers.media.documents".equals(uri.getAuthority())) {
String documentId = DocumentsContract.getDocumentId(uri);
uri = MediaStore.Video.Media.EXTERNAL_CONTENT_URI;
selection = MediaStore.Video.Media._ID + "=?";
selectionArgs = new String[] {documentId.split(":")[1]};
}
Cursor cursor =
mContentResolver.query(
uri, new String[] {MediaStore.Video.Media.DATA}, selection, selectionArgs, null);
try {
if (cursor != null && cursor.moveToFirst()) {
return cursor.getString(cursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA));
}
} finally {
if (cursor != null) {
cursor.close();
}
}
}
return null;
}
示例3: shouldResize
import com.facebook.common.util.UriUtil; //导入方法依赖的package包/类
private boolean shouldResize(ImageSource imageSource) {
// Resizing is inferior to scaling. See http://frescolib.org/docs/resizing-rotating.html#_
// We resize here only for images likely to be from the device's camera, where the app developer
// has no control over the original size
if (mResizeMethod == ImageResizeMethod.AUTO) {
return
UriUtil.isLocalContentUri(imageSource.getUri()) ||
UriUtil.isLocalFileUri(imageSource.getUri());
} else if (mResizeMethod == ImageResizeMethod.RESIZE) {
return true;
} else {
return false;
}
}
示例4: shouldResize
import com.facebook.common.util.UriUtil; //导入方法依赖的package包/类
private static boolean shouldResize(@Nullable Uri uri) {
// Resizing is inferior to scaling. See http://frescolib.org/docs/resizing-rotating.html#_
// We resize here only for images likely to be from the device's camera, where the app developer
// has no control over the original size
return uri != null && (UriUtil.isLocalContentUri(uri) || UriUtil.isLocalFileUri(uri));
}
示例5: shouldResize
import com.facebook.common.util.UriUtil; //导入方法依赖的package包/类
private static boolean shouldResize(@Nullable Uri uri) {
// Resizing is inferior to scaling. See http://frescolib.org/docs/resizing-rotating.html#_
// We resize here only for images likely to be from the device's camera, where the app developer
// has no control over the original size
return uri != null && (UriUtil.isLocalContentUri(uri) || UriUtil.isLocalFileUri(uri));
}