当前位置: 首页>>代码示例>>Java>>正文


Java UriUtil.isLocalContentUri方法代码示例

本文整理汇总了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;
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:32,代码来源:ImageRequest.java

示例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;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:30,代码来源:LocalVideoThumbnailProducer.java

示例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;
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:15,代码来源:ReactImageView.java

示例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));
}
 
开发者ID:john1jan,项目名称:ReactNativeSignatureExample,代码行数:7,代码来源:ReactImageView.java

示例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));
}
 
开发者ID:NorthFoxz,项目名称:react-native-imagewand,代码行数:7,代码来源:RNImageWand.java


注:本文中的com.facebook.common.util.UriUtil.isLocalContentUri方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。